# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
91172 | 2018-12-26T12:45:54 Z | davitmarg | Money (IZhO17_money) | C++17 | 1500 ms | 51692 KB |
/* DEATH-MATCH Davit-Marg */ #include <iostream> #include <algorithm> #include <cmath> #include <vector> #include <string> #include <cstring> #include <map> #include <set> #include <queue> #include <deque> #include <stack> #include <iterator> #include <ctype.h> #include <stdlib.h> #include <fstream> #define mod 1000000007ll #define LL long long #define LD long double #define MP make_pair #define PB push_back using namespace std; int n,ans,a[1000006],l; set<int> s; stack<int> st; set<int>::iterator it; int main() { cin >> n; ans = 1; for (int i = 1; i <= n; i++) scanf("%d", a+i); s.insert(0); for (int i = 1; i <= n; i++) { it = s.upper_bound(l); if ((a[i] < a[i - 1]) || it != s.end() && (*it) < a[i] ) { l = a[i]; ans++; while (!st.empty()) { s.insert(st.top()); st.pop(); } } st.push(a[i]); } cout << ans << endl; return 0; } /* 6 1 3 5 2 4 6 */
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 372 KB | Output is correct |
3 | Correct | 2 ms | 448 KB | Output is correct |
4 | Correct | 2 ms | 524 KB | Output is correct |
5 | Correct | 2 ms | 608 KB | Output is correct |
6 | Correct | 2 ms | 608 KB | Output is correct |
7 | Correct | 2 ms | 616 KB | Output is correct |
8 | Correct | 2 ms | 616 KB | Output is correct |
9 | Correct | 2 ms | 616 KB | Output is correct |
10 | Correct | 1 ms | 616 KB | Output is correct |
11 | Correct | 2 ms | 616 KB | Output is correct |
12 | Correct | 1 ms | 616 KB | Output is correct |
13 | Correct | 2 ms | 616 KB | Output is correct |
14 | Correct | 2 ms | 616 KB | Output is correct |
15 | Correct | 2 ms | 616 KB | Output is correct |
16 | Correct | 2 ms | 616 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 372 KB | Output is correct |
3 | Correct | 2 ms | 448 KB | Output is correct |
4 | Correct | 2 ms | 524 KB | Output is correct |
5 | Correct | 2 ms | 608 KB | Output is correct |
6 | Correct | 2 ms | 608 KB | Output is correct |
7 | Correct | 2 ms | 616 KB | Output is correct |
8 | Correct | 2 ms | 616 KB | Output is correct |
9 | Correct | 2 ms | 616 KB | Output is correct |
10 | Correct | 1 ms | 616 KB | Output is correct |
11 | Correct | 2 ms | 616 KB | Output is correct |
12 | Correct | 1 ms | 616 KB | Output is correct |
13 | Correct | 2 ms | 616 KB | Output is correct |
14 | Correct | 2 ms | 616 KB | Output is correct |
15 | Correct | 2 ms | 616 KB | Output is correct |
16 | Correct | 2 ms | 616 KB | Output is correct |
17 | Correct | 2 ms | 616 KB | Output is correct |
18 | Correct | 2 ms | 616 KB | Output is correct |
19 | Correct | 2 ms | 616 KB | Output is correct |
20 | Correct | 2 ms | 616 KB | Output is correct |
21 | Correct | 2 ms | 616 KB | Output is correct |
22 | Correct | 2 ms | 616 KB | Output is correct |
23 | Correct | 2 ms | 616 KB | Output is correct |
24 | Correct | 2 ms | 616 KB | Output is correct |
25 | Correct | 2 ms | 616 KB | Output is correct |
26 | Correct | 2 ms | 616 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 372 KB | Output is correct |
3 | Correct | 2 ms | 448 KB | Output is correct |
4 | Correct | 2 ms | 524 KB | Output is correct |
5 | Correct | 2 ms | 608 KB | Output is correct |
6 | Correct | 2 ms | 608 KB | Output is correct |
7 | Correct | 2 ms | 616 KB | Output is correct |
8 | Correct | 2 ms | 616 KB | Output is correct |
9 | Correct | 2 ms | 616 KB | Output is correct |
10 | Correct | 1 ms | 616 KB | Output is correct |
11 | Correct | 2 ms | 616 KB | Output is correct |
12 | Correct | 1 ms | 616 KB | Output is correct |
13 | Correct | 2 ms | 616 KB | Output is correct |
14 | Correct | 2 ms | 616 KB | Output is correct |
15 | Correct | 2 ms | 616 KB | Output is correct |
16 | Correct | 2 ms | 616 KB | Output is correct |
17 | Correct | 2 ms | 616 KB | Output is correct |
18 | Correct | 2 ms | 616 KB | Output is correct |
19 | Correct | 2 ms | 616 KB | Output is correct |
20 | Correct | 2 ms | 616 KB | Output is correct |
21 | Correct | 2 ms | 616 KB | Output is correct |
22 | Correct | 2 ms | 616 KB | Output is correct |
23 | Correct | 2 ms | 616 KB | Output is correct |
24 | Correct | 2 ms | 616 KB | Output is correct |
25 | Correct | 2 ms | 616 KB | Output is correct |
26 | Correct | 2 ms | 616 KB | Output is correct |
27 | Correct | 2 ms | 636 KB | Output is correct |
28 | Correct | 2 ms | 636 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 | 2 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 | 256 KB | Output is correct |
2 | Correct | 2 ms | 372 KB | Output is correct |
3 | Correct | 2 ms | 448 KB | Output is correct |
4 | Correct | 2 ms | 524 KB | Output is correct |
5 | Correct | 2 ms | 608 KB | Output is correct |
6 | Correct | 2 ms | 608 KB | Output is correct |
7 | Correct | 2 ms | 616 KB | Output is correct |
8 | Correct | 2 ms | 616 KB | Output is correct |
9 | Correct | 2 ms | 616 KB | Output is correct |
10 | Correct | 1 ms | 616 KB | Output is correct |
11 | Correct | 2 ms | 616 KB | Output is correct |
12 | Correct | 1 ms | 616 KB | Output is correct |
13 | Correct | 2 ms | 616 KB | Output is correct |
14 | Correct | 2 ms | 616 KB | Output is correct |
15 | Correct | 2 ms | 616 KB | Output is correct |
16 | Correct | 2 ms | 616 KB | Output is correct |
17 | Correct | 2 ms | 616 KB | Output is correct |
18 | Correct | 2 ms | 616 KB | Output is correct |
19 | Correct | 2 ms | 616 KB | Output is correct |
20 | Correct | 2 ms | 616 KB | Output is correct |
21 | Correct | 2 ms | 616 KB | Output is correct |
22 | Correct | 2 ms | 616 KB | Output is correct |
23 | Correct | 2 ms | 616 KB | Output is correct |
24 | Correct | 2 ms | 616 KB | Output is correct |
25 | Correct | 2 ms | 616 KB | Output is correct |
26 | Correct | 2 ms | 616 KB | Output is correct |
27 | Correct | 2 ms | 636 KB | Output is correct |
28 | Correct | 2 ms | 636 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 | 2 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 | 66 ms | 2404 KB | Output is correct |
40 | Correct | 119 ms | 3708 KB | Output is correct |
41 | Correct | 53 ms | 3708 KB | Output is correct |
42 | Correct | 52 ms | 3708 KB | Output is correct |
43 | Correct | 38 ms | 3708 KB | Output is correct |
44 | Correct | 144 ms | 4476 KB | Output is correct |
45 | Correct | 140 ms | 4476 KB | Output is correct |
46 | Correct | 145 ms | 4476 KB | Output is correct |
47 | Correct | 127 ms | 4476 KB | Output is correct |
48 | Correct | 133 ms | 4476 KB | Output is correct |
49 | Correct | 515 ms | 23036 KB | Output is correct |
50 | Correct | 512 ms | 23036 KB | Output is correct |
51 | Correct | 537 ms | 23036 KB | Output is correct |
52 | Correct | 530 ms | 23036 KB | Output is correct |
53 | Correct | 804 ms | 23036 KB | Output is correct |
54 | Correct | 585 ms | 23036 KB | Output is correct |
55 | Correct | 1425 ms | 51680 KB | Output is correct |
56 | Correct | 1477 ms | 51692 KB | Output is correct |
57 | Execution timed out | 1554 ms | 51692 KB | Time limit exceeded |
58 | Halted | 0 ms | 0 KB | - |