# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
50306 | 2018-06-10T00:59:26 Z | mra2322001 | Money (IZhO17_money) | C++14 | 1500 ms | 113396 KB |
#include <bits/stdc++.h> #define f0(i, n) for(int i(0); i<(n); i++) #define f1(i, n) for(int i(1); i<=(n); i++) using namespace std; typedef long long ll; const int N = 1e6 + 5; int n, a[N], f[N]; set <int> s; int solve(int u, int sl){ if(u== n + 1) return printf("%d", sl), 0; int v = f[u]; int l = u, r = v, ans = u; auto it = s.upper_bound(a[u]); while(l <= r){ int mid = (l + r)/2; if(a[mid] <= *it) l = mid + 1, ans = mid; else r = mid - 1; } for(int i = u; i <= ans; i++) s.insert(a[i]); solve(ans + 1, sl + 1); } int main(){ ios_base::sync_with_stdio(0); scanf("%d", &n); f1(i, n) scanf("%d", &a[i]); for(int i = n; i >= 1; i--){ if(i==n) f[i] = n; else{ if(a[i] <= a[i + 1]) f[i] = f[i + 1]; else f[i] = i; } } s.insert(0); s.insert(1e6 + 5); solve(1, 0); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 484 KB | Output is correct |
3 | Correct | 2 ms | 484 KB | Output is correct |
4 | Correct | 2 ms | 484 KB | Output is correct |
5 | Correct | 2 ms | 588 KB | Output is correct |
6 | Correct | 2 ms | 588 KB | Output is correct |
7 | Correct | 2 ms | 648 KB | Output is correct |
8 | Correct | 2 ms | 648 KB | Output is correct |
9 | Correct | 2 ms | 648 KB | Output is correct |
10 | Correct | 3 ms | 648 KB | Output is correct |
11 | Correct | 2 ms | 648 KB | Output is correct |
12 | Correct | 2 ms | 648 KB | Output is correct |
13 | Correct | 2 ms | 648 KB | Output is correct |
14 | Correct | 2 ms | 648 KB | Output is correct |
15 | Correct | 2 ms | 648 KB | Output is correct |
16 | Correct | 2 ms | 648 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 484 KB | Output is correct |
3 | Correct | 2 ms | 484 KB | Output is correct |
4 | Correct | 2 ms | 484 KB | Output is correct |
5 | Correct | 2 ms | 588 KB | Output is correct |
6 | Correct | 2 ms | 588 KB | Output is correct |
7 | Correct | 2 ms | 648 KB | Output is correct |
8 | Correct | 2 ms | 648 KB | Output is correct |
9 | Correct | 2 ms | 648 KB | Output is correct |
10 | Correct | 3 ms | 648 KB | Output is correct |
11 | Correct | 2 ms | 648 KB | Output is correct |
12 | Correct | 2 ms | 648 KB | Output is correct |
13 | Correct | 2 ms | 648 KB | Output is correct |
14 | Correct | 2 ms | 648 KB | Output is correct |
15 | Correct | 2 ms | 648 KB | Output is correct |
16 | Correct | 2 ms | 648 KB | Output is correct |
17 | Correct | 2 ms | 648 KB | Output is correct |
18 | Correct | 2 ms | 648 KB | Output is correct |
19 | Correct | 2 ms | 748 KB | Output is correct |
20 | Correct | 2 ms | 748 KB | Output is correct |
21 | Correct | 2 ms | 748 KB | Output is correct |
22 | Correct | 2 ms | 748 KB | Output is correct |
23 | Correct | 2 ms | 748 KB | Output is correct |
24 | Correct | 2 ms | 748 KB | Output is correct |
25 | Correct | 2 ms | 748 KB | Output is correct |
26 | Correct | 2 ms | 748 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 484 KB | Output is correct |
3 | Correct | 2 ms | 484 KB | Output is correct |
4 | Correct | 2 ms | 484 KB | Output is correct |
5 | Correct | 2 ms | 588 KB | Output is correct |
6 | Correct | 2 ms | 588 KB | Output is correct |
7 | Correct | 2 ms | 648 KB | Output is correct |
8 | Correct | 2 ms | 648 KB | Output is correct |
9 | Correct | 2 ms | 648 KB | Output is correct |
10 | Correct | 3 ms | 648 KB | Output is correct |
11 | Correct | 2 ms | 648 KB | Output is correct |
12 | Correct | 2 ms | 648 KB | Output is correct |
13 | Correct | 2 ms | 648 KB | Output is correct |
14 | Correct | 2 ms | 648 KB | Output is correct |
15 | Correct | 2 ms | 648 KB | Output is correct |
16 | Correct | 2 ms | 648 KB | Output is correct |
17 | Correct | 2 ms | 648 KB | Output is correct |
18 | Correct | 2 ms | 648 KB | Output is correct |
19 | Correct | 2 ms | 748 KB | Output is correct |
20 | Correct | 2 ms | 748 KB | Output is correct |
21 | Correct | 2 ms | 748 KB | Output is correct |
22 | Correct | 2 ms | 748 KB | Output is correct |
23 | Correct | 2 ms | 748 KB | Output is correct |
24 | Correct | 2 ms | 748 KB | Output is correct |
25 | Correct | 2 ms | 748 KB | Output is correct |
26 | Correct | 2 ms | 748 KB | Output is correct |
27 | Correct | 3 ms | 748 KB | Output is correct |
28 | Correct | 2 ms | 748 KB | Output is correct |
29 | Correct | 3 ms | 748 KB | Output is correct |
30 | Correct | 3 ms | 748 KB | Output is correct |
31 | Correct | 2 ms | 748 KB | Output is correct |
32 | Correct | 3 ms | 748 KB | Output is correct |
33 | Correct | 2 ms | 748 KB | Output is correct |
34 | Correct | 2 ms | 748 KB | Output is correct |
35 | Correct | 2 ms | 748 KB | Output is correct |
36 | Correct | 2 ms | 748 KB | Output is correct |
37 | Correct | 2 ms | 748 KB | Output is correct |
38 | Correct | 2 ms | 748 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 484 KB | Output is correct |
3 | Correct | 2 ms | 484 KB | Output is correct |
4 | Correct | 2 ms | 484 KB | Output is correct |
5 | Correct | 2 ms | 588 KB | Output is correct |
6 | Correct | 2 ms | 588 KB | Output is correct |
7 | Correct | 2 ms | 648 KB | Output is correct |
8 | Correct | 2 ms | 648 KB | Output is correct |
9 | Correct | 2 ms | 648 KB | Output is correct |
10 | Correct | 3 ms | 648 KB | Output is correct |
11 | Correct | 2 ms | 648 KB | Output is correct |
12 | Correct | 2 ms | 648 KB | Output is correct |
13 | Correct | 2 ms | 648 KB | Output is correct |
14 | Correct | 2 ms | 648 KB | Output is correct |
15 | Correct | 2 ms | 648 KB | Output is correct |
16 | Correct | 2 ms | 648 KB | Output is correct |
17 | Correct | 2 ms | 648 KB | Output is correct |
18 | Correct | 2 ms | 648 KB | Output is correct |
19 | Correct | 2 ms | 748 KB | Output is correct |
20 | Correct | 2 ms | 748 KB | Output is correct |
21 | Correct | 2 ms | 748 KB | Output is correct |
22 | Correct | 2 ms | 748 KB | Output is correct |
23 | Correct | 2 ms | 748 KB | Output is correct |
24 | Correct | 2 ms | 748 KB | Output is correct |
25 | Correct | 2 ms | 748 KB | Output is correct |
26 | Correct | 2 ms | 748 KB | Output is correct |
27 | Correct | 3 ms | 748 KB | Output is correct |
28 | Correct | 2 ms | 748 KB | Output is correct |
29 | Correct | 3 ms | 748 KB | Output is correct |
30 | Correct | 3 ms | 748 KB | Output is correct |
31 | Correct | 2 ms | 748 KB | Output is correct |
32 | Correct | 3 ms | 748 KB | Output is correct |
33 | Correct | 2 ms | 748 KB | Output is correct |
34 | Correct | 2 ms | 748 KB | Output is correct |
35 | Correct | 2 ms | 748 KB | Output is correct |
36 | Correct | 2 ms | 748 KB | Output is correct |
37 | Correct | 2 ms | 748 KB | Output is correct |
38 | Correct | 2 ms | 748 KB | Output is correct |
39 | Correct | 96 ms | 19452 KB | Output is correct |
40 | Correct | 175 ms | 37628 KB | Output is correct |
41 | Correct | 135 ms | 37628 KB | Output is correct |
42 | Correct | 92 ms | 37628 KB | Output is correct |
43 | Correct | 96 ms | 37628 KB | Output is correct |
44 | Correct | 217 ms | 44924 KB | Output is correct |
45 | Correct | 227 ms | 44924 KB | Output is correct |
46 | Correct | 280 ms | 45152 KB | Output is correct |
47 | Correct | 192 ms | 45152 KB | Output is correct |
48 | Correct | 223 ms | 45152 KB | Output is correct |
49 | Correct | 629 ms | 66112 KB | Output is correct |
50 | Correct | 626 ms | 66112 KB | Output is correct |
51 | Correct | 776 ms | 67968 KB | Output is correct |
52 | Correct | 755 ms | 67968 KB | Output is correct |
53 | Correct | 673 ms | 67968 KB | Output is correct |
54 | Correct | 639 ms | 67968 KB | Output is correct |
55 | Correct | 1365 ms | 101624 KB | Output is correct |
56 | Correct | 1422 ms | 108412 KB | Output is correct |
57 | Execution timed out | 1592 ms | 113396 KB | Time limit exceeded |
58 | Halted | 0 ms | 0 KB | - |