# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
51335 | 2018-06-17T13:50:35 Z | Nicksechko | Money (IZhO17_money) | C++11 | 1500 ms | 51600 KB |
#include <iostream> #include <fstream> #include <set> #include <map> #include <string> #include <vector> #include <bitset> #include <algorithm> #include <cstring> #include <cstdlib> #include <cmath> #include <cassert> #include <queue> #define mp make_pair #define pb push_back typedef long long ll; typedef long double ld; using namespace std; const int MX = 1001000; int n; int a[MX]; set<int> ss; int main() { // freopen("money.in", "r", stdin); // freopen("money.out", "w", stdout); scanf("%d", &n); for (int i = 0; i < n; ++i) scanf("%d", a + i); int cnt = 0; int now = 0; while (now < n) { ++cnt; auto it = ss.upper_bound(a[now]); int rb = 1e7; if (it != ss.end()) rb = *it; int lb = a[now]; while (now < n && a[now] >= lb && a[now] <= rb) ss.insert(a[now]), lb = a[now], ++now; } cout << cnt << "\n"; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 472 KB | Output is correct |
3 | Correct | 2 ms | 508 KB | Output is correct |
4 | Correct | 2 ms | 508 KB | Output is correct |
5 | Correct | 2 ms | 628 KB | Output is correct |
6 | Correct | 2 ms | 628 KB | Output is correct |
7 | Correct | 2 ms | 628 KB | Output is correct |
8 | Correct | 2 ms | 628 KB | Output is correct |
9 | Correct | 2 ms | 628 KB | Output is correct |
10 | Correct | 2 ms | 628 KB | Output is correct |
11 | Correct | 2 ms | 628 KB | Output is correct |
12 | Correct | 3 ms | 628 KB | Output is correct |
13 | Correct | 2 ms | 628 KB | Output is correct |
14 | Correct | 2 ms | 628 KB | Output is correct |
15 | Correct | 2 ms | 628 KB | Output is correct |
16 | Correct | 3 ms | 628 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 472 KB | Output is correct |
3 | Correct | 2 ms | 508 KB | Output is correct |
4 | Correct | 2 ms | 508 KB | Output is correct |
5 | Correct | 2 ms | 628 KB | Output is correct |
6 | Correct | 2 ms | 628 KB | Output is correct |
7 | Correct | 2 ms | 628 KB | Output is correct |
8 | Correct | 2 ms | 628 KB | Output is correct |
9 | Correct | 2 ms | 628 KB | Output is correct |
10 | Correct | 2 ms | 628 KB | Output is correct |
11 | Correct | 2 ms | 628 KB | Output is correct |
12 | Correct | 3 ms | 628 KB | Output is correct |
13 | Correct | 2 ms | 628 KB | Output is correct |
14 | Correct | 2 ms | 628 KB | Output is correct |
15 | Correct | 2 ms | 628 KB | Output is correct |
16 | Correct | 3 ms | 628 KB | Output is correct |
17 | Correct | 2 ms | 628 KB | Output is correct |
18 | Correct | 2 ms | 628 KB | Output is correct |
19 | Correct | 2 ms | 628 KB | Output is correct |
20 | Correct | 2 ms | 628 KB | Output is correct |
21 | Correct | 2 ms | 628 KB | Output is correct |
22 | Correct | 2 ms | 628 KB | Output is correct |
23 | Correct | 2 ms | 628 KB | Output is correct |
24 | Correct | 3 ms | 628 KB | Output is correct |
25 | Correct | 2 ms | 628 KB | Output is correct |
26 | Correct | 2 ms | 628 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 472 KB | Output is correct |
3 | Correct | 2 ms | 508 KB | Output is correct |
4 | Correct | 2 ms | 508 KB | Output is correct |
5 | Correct | 2 ms | 628 KB | Output is correct |
6 | Correct | 2 ms | 628 KB | Output is correct |
7 | Correct | 2 ms | 628 KB | Output is correct |
8 | Correct | 2 ms | 628 KB | Output is correct |
9 | Correct | 2 ms | 628 KB | Output is correct |
10 | Correct | 2 ms | 628 KB | Output is correct |
11 | Correct | 2 ms | 628 KB | Output is correct |
12 | Correct | 3 ms | 628 KB | Output is correct |
13 | Correct | 2 ms | 628 KB | Output is correct |
14 | Correct | 2 ms | 628 KB | Output is correct |
15 | Correct | 2 ms | 628 KB | Output is correct |
16 | Correct | 3 ms | 628 KB | Output is correct |
17 | Correct | 2 ms | 628 KB | Output is correct |
18 | Correct | 2 ms | 628 KB | Output is correct |
19 | Correct | 2 ms | 628 KB | Output is correct |
20 | Correct | 2 ms | 628 KB | Output is correct |
21 | Correct | 2 ms | 628 KB | Output is correct |
22 | Correct | 2 ms | 628 KB | Output is correct |
23 | Correct | 2 ms | 628 KB | Output is correct |
24 | Correct | 3 ms | 628 KB | Output is correct |
25 | Correct | 2 ms | 628 KB | Output is correct |
26 | Correct | 2 ms | 628 KB | Output is correct |
27 | Correct | 2 ms | 628 KB | Output is correct |
28 | Correct | 2 ms | 628 KB | Output is correct |
29 | Correct | 2 ms | 636 KB | Output is correct |
30 | Correct | 2 ms | 636 KB | Output is correct |
31 | Correct | 2 ms | 636 KB | Output is correct |
32 | Correct | 2 ms | 636 KB | Output is correct |
33 | Correct | 2 ms | 636 KB | Output is correct |
34 | Correct | 2 ms | 636 KB | Output is correct |
35 | Correct | 3 ms | 636 KB | Output is correct |
36 | Correct | 2 ms | 636 KB | Output is correct |
37 | Correct | 2 ms | 636 KB | Output is correct |
38 | Correct | 2 ms | 636 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 472 KB | Output is correct |
3 | Correct | 2 ms | 508 KB | Output is correct |
4 | Correct | 2 ms | 508 KB | Output is correct |
5 | Correct | 2 ms | 628 KB | Output is correct |
6 | Correct | 2 ms | 628 KB | Output is correct |
7 | Correct | 2 ms | 628 KB | Output is correct |
8 | Correct | 2 ms | 628 KB | Output is correct |
9 | Correct | 2 ms | 628 KB | Output is correct |
10 | Correct | 2 ms | 628 KB | Output is correct |
11 | Correct | 2 ms | 628 KB | Output is correct |
12 | Correct | 3 ms | 628 KB | Output is correct |
13 | Correct | 2 ms | 628 KB | Output is correct |
14 | Correct | 2 ms | 628 KB | Output is correct |
15 | Correct | 2 ms | 628 KB | Output is correct |
16 | Correct | 3 ms | 628 KB | Output is correct |
17 | Correct | 2 ms | 628 KB | Output is correct |
18 | Correct | 2 ms | 628 KB | Output is correct |
19 | Correct | 2 ms | 628 KB | Output is correct |
20 | Correct | 2 ms | 628 KB | Output is correct |
21 | Correct | 2 ms | 628 KB | Output is correct |
22 | Correct | 2 ms | 628 KB | Output is correct |
23 | Correct | 2 ms | 628 KB | Output is correct |
24 | Correct | 3 ms | 628 KB | Output is correct |
25 | Correct | 2 ms | 628 KB | Output is correct |
26 | Correct | 2 ms | 628 KB | Output is correct |
27 | Correct | 2 ms | 628 KB | Output is correct |
28 | Correct | 2 ms | 628 KB | Output is correct |
29 | Correct | 2 ms | 636 KB | Output is correct |
30 | Correct | 2 ms | 636 KB | Output is correct |
31 | Correct | 2 ms | 636 KB | Output is correct |
32 | Correct | 2 ms | 636 KB | Output is correct |
33 | Correct | 2 ms | 636 KB | Output is correct |
34 | Correct | 2 ms | 636 KB | Output is correct |
35 | Correct | 3 ms | 636 KB | Output is correct |
36 | Correct | 2 ms | 636 KB | Output is correct |
37 | Correct | 2 ms | 636 KB | Output is correct |
38 | Correct | 2 ms | 636 KB | Output is correct |
39 | Correct | 76 ms | 2428 KB | Output is correct |
40 | Correct | 168 ms | 3656 KB | Output is correct |
41 | Correct | 71 ms | 3656 KB | Output is correct |
42 | Correct | 60 ms | 3656 KB | Output is correct |
43 | Correct | 56 ms | 3656 KB | Output is correct |
44 | Correct | 180 ms | 4444 KB | Output is correct |
45 | Correct | 168 ms | 4444 KB | Output is correct |
46 | Correct | 174 ms | 4528 KB | Output is correct |
47 | Correct | 142 ms | 4528 KB | Output is correct |
48 | Correct | 163 ms | 4568 KB | Output is correct |
49 | Correct | 708 ms | 23036 KB | Output is correct |
50 | Correct | 681 ms | 23036 KB | Output is correct |
51 | Correct | 776 ms | 23036 KB | Output is correct |
52 | Correct | 691 ms | 23164 KB | Output is correct |
53 | Correct | 621 ms | 23164 KB | Output is correct |
54 | Correct | 654 ms | 23164 KB | Output is correct |
55 | Correct | 1436 ms | 51588 KB | Output is correct |
56 | Execution timed out | 1541 ms | 51600 KB | Time limit exceeded |
57 | Halted | 0 ms | 0 KB | - |