Task: | Delete Files |
Sender: | Kuha |
Submission time: | 2016-07-29 16:30:24 +0300 |
Language: | C++ |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | TIME LIMIT EXCEEDED | 0 |
test | verdict | time | |
---|---|---|---|
#1 | TIME LIMIT EXCEEDED | -- | details |
#2 | TIME LIMIT EXCEEDED | -- | details |
#3 | TIME LIMIT EXCEEDED | -- | details |
#4 | TIME LIMIT EXCEEDED | -- | details |
#5 | TIME LIMIT EXCEEDED | -- | details |
#6 | TIME LIMIT EXCEEDED | -- | details |
#7 | ACCEPTED | 0.06 s | details |
#8 | ACCEPTED | 0.05 s | details |
#9 | TIME LIMIT EXCEEDED | -- | details |
#10 | TIME LIMIT EXCEEDED | -- | details |
#11 | TIME LIMIT EXCEEDED | -- | details |
#12 | TIME LIMIT EXCEEDED | -- | details |
#13 | TIME LIMIT EXCEEDED | -- | details |
#14 | TIME LIMIT EXCEEDED | -- | details |
#15 | TIME LIMIT EXCEEDED | -- | details |
#16 | TIME LIMIT EXCEEDED | -- | details |
#17 | TIME LIMIT EXCEEDED | -- | details |
#18 | TIME LIMIT EXCEEDED | -- | details |
#19 | TIME LIMIT EXCEEDED | -- | details |
#20 | TIME LIMIT EXCEEDED | -- | details |
#21 | TIME LIMIT EXCEEDED | -- | details |
#22 | TIME LIMIT EXCEEDED | -- | details |
#23 | TIME LIMIT EXCEEDED | -- | details |
#24 | TIME LIMIT EXCEEDED | -- | details |
#25 | ACCEPTED | 0.06 s | details |
#26 | TIME LIMIT EXCEEDED | -- | details |
#27 | TIME LIMIT EXCEEDED | -- | details |
#28 | TIME LIMIT EXCEEDED | -- | details |
#29 | ACCEPTED | 0.05 s | details |
#30 | TIME LIMIT EXCEEDED | -- | details |
#31 | TIME LIMIT EXCEEDED | -- | details |
#32 | TIME LIMIT EXCEEDED | -- | details |
#33 | TIME LIMIT EXCEEDED | -- | details |
#34 | ACCEPTED | 0.06 s | details |
#35 | ACCEPTED | 0.05 s | details |
#36 | ACCEPTED | 0.06 s | details |
#37 | ACCEPTED | 0.05 s | details |
#38 | ACCEPTED | 0.06 s | details |
#39 | ACCEPTED | 0.06 s | details |
#40 | ACCEPTED | 0.06 s | details |
#41 | ACCEPTED | 0.06 s | details |
#42 | ACCEPTED | 0.06 s | details |
#43 | ACCEPTED | 0.05 s | details |
#44 | ACCEPTED | 0.06 s | details |
#45 | ACCEPTED | 0.06 s | details |
#46 | ACCEPTED | 0.06 s | details |
#47 | ACCEPTED | 0.05 s | details |
#48 | ACCEPTED | 0.06 s | details |
#49 | ACCEPTED | 0.06 s | details |
#50 | ACCEPTED | 0.06 s | details |
#51 | ACCEPTED | 0.05 s | details |
#52 | ACCEPTED | 0.06 s | details |
#53 | ACCEPTED | 0.06 s | details |
#54 | ACCEPTED | 0.25 s | details |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:33:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int i = 0; i < v.size(); i++) { ^ input/code.cpp:44:36: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int i = 1; i < v.size() - 1; i++) { ^ input/code.cpp:15:7: warning: unused variable 'p' [-Wunused-variable] int p = INF; ^
Code
#include <bits/stdc++.h> #define ll long long #define INF 999999999 #define LINF 999999999999999999LL #define N (1<<17) #define M 1000000007 using namespace std; int main () { int n; cin>>n; vector<pair<char, int>> v; v.push_back({'n', INF}); int p = INF; for (int i = 0; i < n; i++) { char c; int l; cin>>c>>l; if (v[v.size() - 1].first == c) { if (c == 'n') v[v.size() - 1].second = max(v[v.size() - 1].second, l); else v[v.size() - 1].second = min(v[v.size() - 1].second, l); } else { v.push_back({c, l}); } } if ((*(--v.end())).first == 'n') v.erase(--v.end()); v.push_back({'n', INF}); int l = v.size() / 2; int ans = 0; while (l > 0) { vector<pair<char, int>> x; for (int i = 0; i < v.size(); i++) { if (i % 2 == 1 && v[i].second <= v[i - 1].second && v[i].second <= v[i + 1].second) { l--; ans++; i++; x[x.size() - 1].second = max(x[x.size() - 1].second, v[i + 1].second); } else x.push_back(v[i]); } v = x; vector<pair<char, int>> y; y.push_back(v[0]); for (int i = 1; i < v.size() - 1; i++) { if (i % 2 == 0 && v[i].second < v[i - 1].second && v[i].second < v[i + 1].second) { l--; i++; y[y.size() - 1].second = min(y[y.size() - 1].second, v[i + 1].second); } else y.push_back(v[i]); } y.push_back(v[v.size() - 1]); v = y; } cout<<ans<<endl; }
Test details
Test 1
Verdict: TIME LIMIT EXCEEDED
input |
---|
576 y 514 n 505 y 613 y 641 ... |
correct output |
---|
117 |
user output |
---|
(empty) |
Test 2
Verdict: TIME LIMIT EXCEEDED
input |
---|
789 y 174 y 184 y 916 n 489 ... |
correct output |
---|
162 |
user output |
---|
(empty) |
Test 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
153 y 749 n 255 y 728 n 725 ... |
correct output |
---|
37 |
user output |
---|
(empty) |
Test 4
Verdict: TIME LIMIT EXCEEDED
input |
---|
554 y 714 n 389 n 123 y 954 ... |
correct output |
---|
122 |
user output |
---|
(empty) |
Test 5
Verdict: TIME LIMIT EXCEEDED
input |
---|
572 n 81 y 160 y 262 y 616 ... |
correct output |
---|
122 |
user output |
---|
(empty) |
Test 6
Verdict: TIME LIMIT EXCEEDED
input |
---|
426 n 977 y 656 n 100 n 28 ... |
correct output |
---|
83 |
user output |
---|
(empty) |
Test 7
Verdict: ACCEPTED
input |
---|
3 y 7 y 6 n 5 |
correct output |
---|
1 |
user output |
---|
1 |
Test 8
Verdict: ACCEPTED
input |
---|
166 n 955 y 364 y 372 y 621 ... |
correct output |
---|
41 |
user output |
---|
41 |
Test 9
Verdict: TIME LIMIT EXCEEDED
input |
---|
352 n 342 y 828 n 925 y 652 ... |
correct output |
---|
69 |
user output |
---|
(empty) |
Test 10
Verdict: TIME LIMIT EXCEEDED
input |
---|
304 y 962 y 712 n 754 n 359 ... |
correct output |
---|
69 |
user output |
---|
(empty) |
Test 11
Verdict: TIME LIMIT EXCEEDED
input |
---|
836 n 890 y 790 y 406 n 127 ... |
correct output |
---|
171 |
user output |
---|
(empty) |
Test 12
Verdict: TIME LIMIT EXCEEDED
input |
---|
1000 y 198 n 603 n 511 y 207 ... |
correct output |
---|
209 |
user output |
---|
(empty) |
Test 13
Verdict: TIME LIMIT EXCEEDED
input |
---|
1000 n 548 n 362 y 298 n 576 ... |
correct output |
---|
207 |
user output |
---|
(empty) |
Test 14
Verdict: TIME LIMIT EXCEEDED
input |
---|
1000 y 891 n 240 n 61 y 226 ... |
correct output |
---|
205 |
user output |
---|
(empty) |
Test 15
Verdict: TIME LIMIT EXCEEDED
input |
---|
1000 y 760 y 165 y 592 y 73 ... |
correct output |
---|
228 |
user output |
---|
(empty) |
Test 16
Verdict: TIME LIMIT EXCEEDED
input |
---|
1000 y 220 n 377 n 312 n 750 ... |
correct output |
---|
217 |
user output |
---|
(empty) |
Test 17
Verdict: TIME LIMIT EXCEEDED
input |
---|
1000 n 390 n 932 y 505 n 687 ... |
correct output |
---|
208 |
user output |
---|
(empty) |
Test 18
Verdict: TIME LIMIT EXCEEDED
input |
---|
3 y 7 n 6 y 5 |
correct output |
---|
2 |
user output |
---|
(empty) |
Test 19
Verdict: TIME LIMIT EXCEEDED
input |
---|
1000 y 140 y 896 y 599 n 308 ... |
correct output |
---|
214 |
user output |
---|
(empty) |
Test 20
Verdict: TIME LIMIT EXCEEDED
input |
---|
1000 y 107 y 681 y 755 y 51 ... |
correct output |
---|
215 |
user output |
---|
(empty) |
Test 21
Verdict: TIME LIMIT EXCEEDED
input |
---|
1000 y 537 y 404 y 445 n 934 ... |
correct output |
---|
211 |
user output |
---|
(empty) |
Test 22
Verdict: TIME LIMIT EXCEEDED
input |
---|
1000 n 597 y 510 n 464 n 76 ... |
correct output |
---|
196 |
user output |
---|
(empty) |
Test 23
Verdict: TIME LIMIT EXCEEDED
input |
---|
819 n 802 y 230 n 554 y 774 ... |
correct output |
---|
263 |
user output |
---|
(empty) |
Test 24
Verdict: TIME LIMIT EXCEEDED
input |
---|
307 n 667 y 198 n 985 y 531 ... |
correct output |
---|
95 |
user output |
---|
(empty) |
Test 25
Verdict: ACCEPTED
input |
---|
131 n 149 y 274 n 843 y 526 ... |
correct output |
---|
39 |
user output |
---|
39 |
Test 26
Verdict: TIME LIMIT EXCEEDED
input |
---|
807 n 229 y 726 n 63 y 923 ... |
correct output |
---|
256 |
user output |
---|
(empty) |
Test 27
Verdict: TIME LIMIT EXCEEDED
input |
---|
38 n 840 y 592 n 479 y 612 ... |
correct output |
---|
13 |
user output |
---|
(empty) |
Test 28
Verdict: TIME LIMIT EXCEEDED
input |
---|
699 n 945 y 34 n 441 y 601 ... |
correct output |
---|
237 |
user output |
---|
(empty) |
Test 29
Verdict: ACCEPTED
input |
---|
6 y 4 n 5 y 4 y 6 ... |
correct output |
---|
2 |
user output |
---|
2 |
Test 30
Verdict: TIME LIMIT EXCEEDED
input |
---|
957 n 513 y 323 n 105 y 961 ... |
correct output |
---|
333 |
user output |
---|
(empty) |
Test 31
Verdict: TIME LIMIT EXCEEDED
input |
---|
156 n 269 y 430 n 375 y 204 ... |
correct output |
---|
52 |
user output |
---|
(empty) |
Test 32
Verdict: TIME LIMIT EXCEEDED
input |
---|
760 n 146 y 180 n 861 y 743 ... |
correct output |
---|
249 |
user output |
---|
(empty) |
Test 33
Verdict: TIME LIMIT EXCEEDED
input |
---|
323 n 662 y 7 n 128 y 836 ... |
correct output |
---|
106 |
user output |
---|
(empty) |
Test 34
Verdict: ACCEPTED
input |
---|
373 n 100 n 995 n 435 n 946 ... |
correct output |
---|
0 |
user output |
---|
0 |
Test 35
Verdict: ACCEPTED
input |
---|
220 y 38 y 846 y 547 y 639 ... |
correct output |
---|
1 |
user output |
---|
1 |
Test 36
Verdict: ACCEPTED
input |
---|
981 n 952 n 180 n 735 n 406 ... |
correct output |
---|
0 |
user output |
---|
0 |
Test 37
Verdict: ACCEPTED
input |
---|
758 y 474 y 790 y 199 y 367 ... |
correct output |
---|
1 |
user output |
---|
1 |
Test 38
Verdict: ACCEPTED
input |
---|
262 n 837 n 221 n 836 n 371 ... |
correct output |
---|
0 |
user output |
---|
0 |
Test 39
Verdict: ACCEPTED
input |
---|
969 y 122 y 546 y 211 y 719 ... |
correct output |
---|
1 |
user output |
---|
1 |
Test 40
Verdict: ACCEPTED
input |
---|
773 n 368 n 640 n 356 n 39 ... |
correct output |
---|
0 |
user output |
---|
0 |
Test 41
Verdict: ACCEPTED
input |
---|
803 y 79 y 111 y 459 y 755 ... |
correct output |
---|
1 |
user output |
---|
1 |
Test 42
Verdict: ACCEPTED
input |
---|
190 n 192 n 453 n 996 n 894 ... |
correct output |
---|
0 |
user output |
---|
0 |
Test 43
Verdict: ACCEPTED
input |
---|
193 y 86 y 673 y 18 y 271 ... |
correct output |
---|
1 |
user output |
---|
1 |
Test 44
Verdict: ACCEPTED
input |
---|
1000 n 1000 n 1000 n 1000 y 1000 ... |
correct output |
---|
250 |
user output |
---|
250 |
Test 45
Verdict: ACCEPTED
input |
---|
1000 n 1000 y 1000 y 1000 y 1000 ... |
correct output |
---|
245 |
user output |
---|
245 |
Test 46
Verdict: ACCEPTED
input |
---|
1000 y 1000 n 1000 n 1000 y 1000 ... |
correct output |
---|
242 |
user output |
---|
242 |
Test 47
Verdict: ACCEPTED
input |
---|
1000 n 1000 n 1000 n 1000 y 1000 ... |
correct output |
---|
237 |
user output |
---|
237 |
Test 48
Verdict: ACCEPTED
input |
---|
1000 y 1000 y 1000 n 1000 y 1000 ... |
correct output |
---|
243 |
user output |
---|
243 |
Test 49
Verdict: ACCEPTED
input |
---|
1000 n 1000 n 1000 n 1000 n 1000 ... |
correct output |
---|
0 |
user output |
---|
0 |
Test 50
Verdict: ACCEPTED
input |
---|
1000 y 1000 y 1000 y 1000 y 1000 ... |
correct output |
---|
1 |
user output |
---|
1 |
Test 51
Verdict: ACCEPTED
input |
---|
1000 n 1000 n 1000 n 1000 n 1000 ... |
correct output |
---|
0 |
user output |
---|
0 |
Test 52
Verdict: ACCEPTED
input |
---|
1000 y 1000 y 1000 y 1000 y 1000 ... |
correct output |
---|
1 |
user output |
---|
1 |
Test 53
Verdict: ACCEPTED
input |
---|
1000 n 1000 n 1000 n 1000 n 1000 ... |
correct output |
---|
0 |
user output |
---|
0 |
Test 54
Verdict: ACCEPTED
input |
---|
5 y 10 y 5 n 4 y 8 ... |
correct output |
---|
1 |
user output |
---|
1 |