# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
62772 | 2018-07-30T03:18:11 Z | Tenuun | Money (IZhO17_money) | C++17 | 313 ms | 152412 KB |
#include<bits/stdc++.h> using namespace std; int tr[1000001], a[1000000]; void update(int ind, int val){ while(ind<=1000000){ tr[ind]+=val; ind+=ind&-ind; } } int get(int ind){ int ans=0; while(ind){ ans+=tr[ind]; ind-=ind&-ind; } return ans; } int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); memset(tr, 0, sizeof tr); int n, res=0, x, start=0, mx=0; cin >> n; for(int i=0; i<n; i++) cin >> a[i]; for(int i=0; i<n; i++){ start=i; mx=a[i]; //cout << i << " "; res++; while(i+1<n && a[i+1]>=mx && get(a[i+1]-1)-get(a[start])<=0){ i++; mx=max(mx, a[i]); } for(int j=start; j<=i; j++){ update(a[j], 1); } } cout << res; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 4216 KB | Output is correct |
2 | Correct | 6 ms | 4464 KB | Output is correct |
3 | Correct | 6 ms | 4464 KB | Output is correct |
4 | Correct | 6 ms | 4464 KB | Output is correct |
5 | Correct | 7 ms | 4504 KB | Output is correct |
6 | Correct | 5 ms | 4504 KB | Output is correct |
7 | Correct | 5 ms | 4504 KB | Output is correct |
8 | Correct | 6 ms | 4604 KB | Output is correct |
9 | Correct | 6 ms | 4692 KB | Output is correct |
10 | Correct | 6 ms | 4692 KB | Output is correct |
11 | Correct | 6 ms | 4692 KB | Output is correct |
12 | Correct | 6 ms | 4692 KB | Output is correct |
13 | Correct | 6 ms | 4768 KB | Output is correct |
14 | Correct | 7 ms | 4768 KB | Output is correct |
15 | Correct | 8 ms | 4768 KB | Output is correct |
16 | Correct | 6 ms | 4768 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 4216 KB | Output is correct |
2 | Correct | 6 ms | 4464 KB | Output is correct |
3 | Correct | 6 ms | 4464 KB | Output is correct |
4 | Correct | 6 ms | 4464 KB | Output is correct |
5 | Correct | 7 ms | 4504 KB | Output is correct |
6 | Correct | 5 ms | 4504 KB | Output is correct |
7 | Correct | 5 ms | 4504 KB | Output is correct |
8 | Correct | 6 ms | 4604 KB | Output is correct |
9 | Correct | 6 ms | 4692 KB | Output is correct |
10 | Correct | 6 ms | 4692 KB | Output is correct |
11 | Correct | 6 ms | 4692 KB | Output is correct |
12 | Correct | 6 ms | 4692 KB | Output is correct |
13 | Correct | 6 ms | 4768 KB | Output is correct |
14 | Correct | 7 ms | 4768 KB | Output is correct |
15 | Correct | 8 ms | 4768 KB | Output is correct |
16 | Correct | 6 ms | 4768 KB | Output is correct |
17 | Correct | 8 ms | 4768 KB | Output is correct |
18 | Correct | 8 ms | 4768 KB | Output is correct |
19 | Correct | 8 ms | 4768 KB | Output is correct |
20 | Correct | 8 ms | 4768 KB | Output is correct |
21 | Correct | 7 ms | 4768 KB | Output is correct |
22 | Correct | 8 ms | 4768 KB | Output is correct |
23 | Correct | 9 ms | 4768 KB | Output is correct |
24 | Correct | 7 ms | 4768 KB | Output is correct |
25 | Correct | 9 ms | 4768 KB | Output is correct |
26 | Correct | 8 ms | 4768 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 4216 KB | Output is correct |
2 | Correct | 6 ms | 4464 KB | Output is correct |
3 | Correct | 6 ms | 4464 KB | Output is correct |
4 | Correct | 6 ms | 4464 KB | Output is correct |
5 | Correct | 7 ms | 4504 KB | Output is correct |
6 | Correct | 5 ms | 4504 KB | Output is correct |
7 | Correct | 5 ms | 4504 KB | Output is correct |
8 | Correct | 6 ms | 4604 KB | Output is correct |
9 | Correct | 6 ms | 4692 KB | Output is correct |
10 | Correct | 6 ms | 4692 KB | Output is correct |
11 | Correct | 6 ms | 4692 KB | Output is correct |
12 | Correct | 6 ms | 4692 KB | Output is correct |
13 | Correct | 6 ms | 4768 KB | Output is correct |
14 | Correct | 7 ms | 4768 KB | Output is correct |
15 | Correct | 8 ms | 4768 KB | Output is correct |
16 | Correct | 6 ms | 4768 KB | Output is correct |
17 | Correct | 8 ms | 4768 KB | Output is correct |
18 | Correct | 8 ms | 4768 KB | Output is correct |
19 | Correct | 8 ms | 4768 KB | Output is correct |
20 | Correct | 8 ms | 4768 KB | Output is correct |
21 | Correct | 7 ms | 4768 KB | Output is correct |
22 | Correct | 8 ms | 4768 KB | Output is correct |
23 | Correct | 9 ms | 4768 KB | Output is correct |
24 | Correct | 7 ms | 4768 KB | Output is correct |
25 | Correct | 9 ms | 4768 KB | Output is correct |
26 | Correct | 8 ms | 4768 KB | Output is correct |
27 | Correct | 8 ms | 4800 KB | Output is correct |
28 | Correct | 7 ms | 4800 KB | Output is correct |
29 | Correct | 8 ms | 4800 KB | Output is correct |
30 | Correct | 8 ms | 4800 KB | Output is correct |
31 | Correct | 7 ms | 4800 KB | Output is correct |
32 | Correct | 8 ms | 4800 KB | Output is correct |
33 | Correct | 6 ms | 4800 KB | Output is correct |
34 | Correct | 7 ms | 4800 KB | Output is correct |
35 | Correct | 7 ms | 4800 KB | Output is correct |
36 | Correct | 6 ms | 4800 KB | Output is correct |
37 | Correct | 7 ms | 4800 KB | Output is correct |
38 | Correct | 7 ms | 4800 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 4216 KB | Output is correct |
2 | Correct | 6 ms | 4464 KB | Output is correct |
3 | Correct | 6 ms | 4464 KB | Output is correct |
4 | Correct | 6 ms | 4464 KB | Output is correct |
5 | Correct | 7 ms | 4504 KB | Output is correct |
6 | Correct | 5 ms | 4504 KB | Output is correct |
7 | Correct | 5 ms | 4504 KB | Output is correct |
8 | Correct | 6 ms | 4604 KB | Output is correct |
9 | Correct | 6 ms | 4692 KB | Output is correct |
10 | Correct | 6 ms | 4692 KB | Output is correct |
11 | Correct | 6 ms | 4692 KB | Output is correct |
12 | Correct | 6 ms | 4692 KB | Output is correct |
13 | Correct | 6 ms | 4768 KB | Output is correct |
14 | Correct | 7 ms | 4768 KB | Output is correct |
15 | Correct | 8 ms | 4768 KB | Output is correct |
16 | Correct | 6 ms | 4768 KB | Output is correct |
17 | Correct | 8 ms | 4768 KB | Output is correct |
18 | Correct | 8 ms | 4768 KB | Output is correct |
19 | Correct | 8 ms | 4768 KB | Output is correct |
20 | Correct | 8 ms | 4768 KB | Output is correct |
21 | Correct | 7 ms | 4768 KB | Output is correct |
22 | Correct | 8 ms | 4768 KB | Output is correct |
23 | Correct | 9 ms | 4768 KB | Output is correct |
24 | Correct | 7 ms | 4768 KB | Output is correct |
25 | Correct | 9 ms | 4768 KB | Output is correct |
26 | Correct | 8 ms | 4768 KB | Output is correct |
27 | Correct | 8 ms | 4800 KB | Output is correct |
28 | Correct | 7 ms | 4800 KB | Output is correct |
29 | Correct | 8 ms | 4800 KB | Output is correct |
30 | Correct | 8 ms | 4800 KB | Output is correct |
31 | Correct | 7 ms | 4800 KB | Output is correct |
32 | Correct | 8 ms | 4800 KB | Output is correct |
33 | Correct | 6 ms | 4800 KB | Output is correct |
34 | Correct | 7 ms | 4800 KB | Output is correct |
35 | Correct | 7 ms | 4800 KB | Output is correct |
36 | Correct | 6 ms | 4800 KB | Output is correct |
37 | Correct | 7 ms | 4800 KB | Output is correct |
38 | Correct | 7 ms | 4800 KB | Output is correct |
39 | Correct | 106 ms | 9844 KB | Output is correct |
40 | Correct | 187 ms | 16436 KB | Output is correct |
41 | Correct | 115 ms | 17480 KB | Output is correct |
42 | Correct | 103 ms | 19568 KB | Output is correct |
43 | Correct | 64 ms | 20884 KB | Output is correct |
44 | Correct | 225 ms | 30460 KB | Output is correct |
45 | Correct | 230 ms | 37212 KB | Output is correct |
46 | Correct | 217 ms | 44008 KB | Output is correct |
47 | Correct | 221 ms | 50916 KB | Output is correct |
48 | Correct | 240 ms | 57736 KB | Output is correct |
49 | Correct | 297 ms | 64736 KB | Output is correct |
50 | Correct | 283 ms | 71628 KB | Output is correct |
51 | Correct | 249 ms | 78380 KB | Output is correct |
52 | Correct | 234 ms | 85028 KB | Output is correct |
53 | Correct | 259 ms | 91864 KB | Output is correct |
54 | Correct | 241 ms | 98592 KB | Output is correct |
55 | Correct | 290 ms | 105284 KB | Output is correct |
56 | Correct | 276 ms | 112020 KB | Output is correct |
57 | Correct | 313 ms | 118772 KB | Output is correct |
58 | Correct | 266 ms | 125500 KB | Output is correct |
59 | Correct | 308 ms | 132260 KB | Output is correct |
60 | Correct | 219 ms | 138972 KB | Output is correct |
61 | Correct | 223 ms | 145748 KB | Output is correct |
62 | Correct | 221 ms | 152412 KB | Output is correct |