# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
91169 | 2018-12-26T12:41:28 Z | davitmarg | Money (IZhO17_money) | C++17 | 1500 ms | 53784 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; 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++) { set<int>::iterator 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
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 508 KB | Output is correct |
3 | Correct | 2 ms | 532 KB | Output is correct |
4 | Correct | 2 ms | 572 KB | Output is correct |
5 | Correct | 2 ms | 572 KB | Output is correct |
6 | Correct | 2 ms | 572 KB | Output is correct |
7 | Correct | 2 ms | 572 KB | Output is correct |
8 | Correct | 1 ms | 572 KB | Output is correct |
9 | Correct | 2 ms | 572 KB | Output is correct |
10 | Correct | 2 ms | 572 KB | Output is correct |
11 | Correct | 2 ms | 572 KB | Output is correct |
12 | Correct | 2 ms | 572 KB | Output is correct |
13 | Correct | 2 ms | 572 KB | Output is correct |
14 | Correct | 2 ms | 572 KB | Output is correct |
15 | Correct | 2 ms | 572 KB | Output is correct |
16 | Correct | 2 ms | 572 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 508 KB | Output is correct |
3 | Correct | 2 ms | 532 KB | Output is correct |
4 | Correct | 2 ms | 572 KB | Output is correct |
5 | Correct | 2 ms | 572 KB | Output is correct |
6 | Correct | 2 ms | 572 KB | Output is correct |
7 | Correct | 2 ms | 572 KB | Output is correct |
8 | Correct | 1 ms | 572 KB | Output is correct |
9 | Correct | 2 ms | 572 KB | Output is correct |
10 | Correct | 2 ms | 572 KB | Output is correct |
11 | Correct | 2 ms | 572 KB | Output is correct |
12 | Correct | 2 ms | 572 KB | Output is correct |
13 | Correct | 2 ms | 572 KB | Output is correct |
14 | Correct | 2 ms | 572 KB | Output is correct |
15 | Correct | 2 ms | 572 KB | Output is correct |
16 | Correct | 2 ms | 572 KB | Output is correct |
17 | Correct | 2 ms | 572 KB | Output is correct |
18 | Correct | 2 ms | 572 KB | Output is correct |
19 | Correct | 2 ms | 572 KB | Output is correct |
20 | Correct | 2 ms | 572 KB | Output is correct |
21 | Correct | 13 ms | 572 KB | Output is correct |
22 | Correct | 2 ms | 636 KB | Output is correct |
23 | Correct | 2 ms | 636 KB | Output is correct |
24 | Correct | 2 ms | 636 KB | Output is correct |
25 | Correct | 2 ms | 652 KB | Output is correct |
26 | Correct | 2 ms | 652 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 508 KB | Output is correct |
3 | Correct | 2 ms | 532 KB | Output is correct |
4 | Correct | 2 ms | 572 KB | Output is correct |
5 | Correct | 2 ms | 572 KB | Output is correct |
6 | Correct | 2 ms | 572 KB | Output is correct |
7 | Correct | 2 ms | 572 KB | Output is correct |
8 | Correct | 1 ms | 572 KB | Output is correct |
9 | Correct | 2 ms | 572 KB | Output is correct |
10 | Correct | 2 ms | 572 KB | Output is correct |
11 | Correct | 2 ms | 572 KB | Output is correct |
12 | Correct | 2 ms | 572 KB | Output is correct |
13 | Correct | 2 ms | 572 KB | Output is correct |
14 | Correct | 2 ms | 572 KB | Output is correct |
15 | Correct | 2 ms | 572 KB | Output is correct |
16 | Correct | 2 ms | 572 KB | Output is correct |
17 | Correct | 2 ms | 572 KB | Output is correct |
18 | Correct | 2 ms | 572 KB | Output is correct |
19 | Correct | 2 ms | 572 KB | Output is correct |
20 | Correct | 2 ms | 572 KB | Output is correct |
21 | Correct | 13 ms | 572 KB | Output is correct |
22 | Correct | 2 ms | 636 KB | Output is correct |
23 | Correct | 2 ms | 636 KB | Output is correct |
24 | Correct | 2 ms | 636 KB | Output is correct |
25 | Correct | 2 ms | 652 KB | Output is correct |
26 | Correct | 2 ms | 652 KB | Output is correct |
27 | Correct | 2 ms | 784 KB | Output is correct |
28 | Correct | 2 ms | 784 KB | Output is correct |
29 | Correct | 2 ms | 784 KB | Output is correct |
30 | Correct | 2 ms | 784 KB | Output is correct |
31 | Correct | 2 ms | 784 KB | Output is correct |
32 | Correct | 2 ms | 784 KB | Output is correct |
33 | Correct | 2 ms | 784 KB | Output is correct |
34 | Correct | 2 ms | 784 KB | Output is correct |
35 | Correct | 2 ms | 784 KB | Output is correct |
36 | Correct | 2 ms | 784 KB | Output is correct |
37 | Correct | 2 ms | 784 KB | Output is correct |
38 | Correct | 2 ms | 784 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 508 KB | Output is correct |
3 | Correct | 2 ms | 532 KB | Output is correct |
4 | Correct | 2 ms | 572 KB | Output is correct |
5 | Correct | 2 ms | 572 KB | Output is correct |
6 | Correct | 2 ms | 572 KB | Output is correct |
7 | Correct | 2 ms | 572 KB | Output is correct |
8 | Correct | 1 ms | 572 KB | Output is correct |
9 | Correct | 2 ms | 572 KB | Output is correct |
10 | Correct | 2 ms | 572 KB | Output is correct |
11 | Correct | 2 ms | 572 KB | Output is correct |
12 | Correct | 2 ms | 572 KB | Output is correct |
13 | Correct | 2 ms | 572 KB | Output is correct |
14 | Correct | 2 ms | 572 KB | Output is correct |
15 | Correct | 2 ms | 572 KB | Output is correct |
16 | Correct | 2 ms | 572 KB | Output is correct |
17 | Correct | 2 ms | 572 KB | Output is correct |
18 | Correct | 2 ms | 572 KB | Output is correct |
19 | Correct | 2 ms | 572 KB | Output is correct |
20 | Correct | 2 ms | 572 KB | Output is correct |
21 | Correct | 13 ms | 572 KB | Output is correct |
22 | Correct | 2 ms | 636 KB | Output is correct |
23 | Correct | 2 ms | 636 KB | Output is correct |
24 | Correct | 2 ms | 636 KB | Output is correct |
25 | Correct | 2 ms | 652 KB | Output is correct |
26 | Correct | 2 ms | 652 KB | Output is correct |
27 | Correct | 2 ms | 784 KB | Output is correct |
28 | Correct | 2 ms | 784 KB | Output is correct |
29 | Correct | 2 ms | 784 KB | Output is correct |
30 | Correct | 2 ms | 784 KB | Output is correct |
31 | Correct | 2 ms | 784 KB | Output is correct |
32 | Correct | 2 ms | 784 KB | Output is correct |
33 | Correct | 2 ms | 784 KB | Output is correct |
34 | Correct | 2 ms | 784 KB | Output is correct |
35 | Correct | 2 ms | 784 KB | Output is correct |
36 | Correct | 2 ms | 784 KB | Output is correct |
37 | Correct | 2 ms | 784 KB | Output is correct |
38 | Correct | 2 ms | 784 KB | Output is correct |
39 | Correct | 67 ms | 3540 KB | Output is correct |
40 | Correct | 120 ms | 4736 KB | Output is correct |
41 | Correct | 54 ms | 4736 KB | Output is correct |
42 | Correct | 52 ms | 4736 KB | Output is correct |
43 | Correct | 38 ms | 4736 KB | Output is correct |
44 | Correct | 145 ms | 5456 KB | Output is correct |
45 | Correct | 143 ms | 5528 KB | Output is correct |
46 | Correct | 146 ms | 5540 KB | Output is correct |
47 | Correct | 127 ms | 6652 KB | Output is correct |
48 | Correct | 136 ms | 6740 KB | Output is correct |
49 | Correct | 576 ms | 25248 KB | Output is correct |
50 | Correct | 636 ms | 25248 KB | Output is correct |
51 | Correct | 663 ms | 25248 KB | Output is correct |
52 | Correct | 650 ms | 25276 KB | Output is correct |
53 | Correct | 638 ms | 25276 KB | Output is correct |
54 | Correct | 593 ms | 25304 KB | Output is correct |
55 | Correct | 1254 ms | 53760 KB | Output is correct |
56 | Correct | 1322 ms | 53760 KB | Output is correct |
57 | Correct | 1466 ms | 53760 KB | Output is correct |
58 | Correct | 1312 ms | 53760 KB | Output is correct |
59 | Correct | 1498 ms | 53784 KB | Output is correct |
60 | Execution timed out | 1502 ms | 53784 KB | Time limit exceeded |
61 | Halted | 0 ms | 0 KB | - |