CF155A.I_love_%username%

入门

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Vasya adores sport programming. He can't write programs but he loves to watch the contests' progress. Vasya even has a favorite coder and Vasya pays special attention to him.

One day Vasya decided to collect the results of all contests where his favorite coder participated and track the progress of his coolness. For each contest where this coder participated, he wrote out a single non-negative number — the number of points his favorite coder earned in the contest. Vasya wrote out the points for the contest in the order, in which the contests run (naturally, no two contests ran simultaneously).

Vasya considers a coder's performance in a contest amazing in two situations: he can break either his best or his worst performance record. First, it is amazing if during the contest the coder earns strictly more points that he earned on each past contest. Second, it is amazing if during the contest the coder earns strictly less points that he earned on each past contest. A coder's first contest isn't considered amazing. Now he wants to count the number of amazing performances the coder had throughout his whole history of participating in contests. But the list of earned points turned out long and Vasya can't code... That's why he asks you to help him.

瓦西娅非常喜爱竞技编程。他虽然不会写程序,但却热衷于关注比赛的进程。瓦西娅甚至有一位自己最喜爱的程序员,并且会特别关注这位程序员的表现。

有一天,瓦西娅决定收集他最喜爱的程序员所参加过的所有比赛的成绩,并追踪其“酷炫程度”的变化。对于该程序员参加的每一场竞赛,瓦西娅都记录下一个非负整数——即该程序员在该场比赛中获得的分数。这些分数是按比赛实际进行的顺序记录的(显然,没有两场比赛是同时进行的)。

瓦西娅认为,当程序员在某场比赛中的表现满足以下两种情形之一时,该表现就是“惊人”的:他打破了自己此前的最佳成绩纪录,或打破了自己此前的最差成绩纪录。具体来说:

  • 若该场比赛中程序员获得的分数严格大于此前每一场参赛所获得的分数,则该表现是惊人的;
  • 若该场比赛中程序员获得的分数严格小于此前每一场参赛所获得的分数,则该表现也是惊人的。
    注意:程序员参加的第一场比赛不被视为“惊人”表现。
    现在,瓦西娅希望统计该程序员在其全部参赛历史中,“惊人”表现的总次数。然而,分数列表实在太长了,而瓦西娅又不会编程……因此,他请你来帮忙。

输入格式

The first line contains the single integer n (1 ≤ n ≤ 1000) — the number of contests where the coder participated.

The next line contains n space-separated non-negative integer numbers — they are the points which the coder has earned. The points are given in the chronological order. All points do not exceed 10000.

第一行包含一个整数 nn(1≤n≤10001 \leq n \leq 1000)—— 表示该程序员参加的比赛场数。

接下来的一行包含 nn 个用空格分隔的非负整数 —— 表示该程序员获得的分数。分数按时间顺序给出。所有分数均不超过 1000010000。

输出格式

Print the single number — the number of amazing performances the coder has had during his whole history of participating in the contests.

输出一个数字——该程序员在其整个参赛历史中所取得的“惊人表现”次数。

输入输出样例

  • 输入#1

    5
    100 50 200 150 200

    输出#1

    2
  • 输入#2

    10
    4664 6496 5814 7010 5762 5736 6944 4850 3698 7242

    输出#2

    4

说明/提示

In the first sample the performances number 2 and 3 are amazing.

In the second sample the performances number 2, 4, 9 and 10 are amazing.

在第一个样例中,表演编号 2 和 3 是惊人的。

在第二个样例中,表演编号 2、4、9 和 10 是惊人的。

输入解题思路,AI测评打分。不知道怎么写?

首页