-
Notifications
You must be signed in to change notification settings - Fork 0
/
abc152_c.cpp
54 lines (46 loc) · 1.03 KB
/
abc152_c.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include <iostream>
#include <string>
#include <vector>
#define rep(i, n) for (int i=0; i< (n); ++i)
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;
int main() {
int n;
cin >> n;
int p[n];
rep(i, n) cin >> p[i];
//rep(i, n) cout << p[i] << " ";
//cout << endl;
int cnt = 0;
int min = p[0];
for (int i=0; i< n; i++) {
if (min >= p[i]) {
cnt++;
}
if (min > p[i])
min = p[i];
}
cout << cnt << endl;
}
/*
vector<bool> ok(n, false);
int max = p[0];
int max_index = 0;
for (int i=0; i< n; i++) {
if (max >= p[i]) {
ok[i] = true;
ok[max_index] = true;
}
if (max < p[i]) {
max = p[i];
max_index = i;
}
}
int cnt = 0;
rep(i, n) {
if (ok[i])
cnt++;
}
*/