Task: | Riippuliito |
Sender: | Henrik Aalto |
Submission time: | 2020-02-09 13:08:43 +0200 |
Language: | C++ (C++11) |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
#2 | WRONG ANSWER | 0 |
#3 | WRONG ANSWER | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | WRONG ANSWER | 0.01 s | 1, 2, 3 | details |
#2 | WRONG ANSWER | 0.01 s | 1, 2, 3 | details |
#3 | WRONG ANSWER | 0.01 s | 1, 2, 3 | details |
#4 | WRONG ANSWER | 0.01 s | 1, 2, 3 | details |
#5 | WRONG ANSWER | 0.01 s | 1, 2, 3 | details |
#6 | WRONG ANSWER | 0.01 s | 1, 2, 3 | details |
#7 | WRONG ANSWER | 0.01 s | 1, 2, 3 | details |
#8 | WRONG ANSWER | 0.01 s | 2, 3 | details |
#9 | WRONG ANSWER | 0.01 s | 2, 3 | details |
#10 | WRONG ANSWER | 0.01 s | 2, 3 | details |
#11 | WRONG ANSWER | 0.01 s | 2, 3 | details |
#12 | WRONG ANSWER | 0.01 s | 2, 3 | details |
#13 | WRONG ANSWER | 0.01 s | 2, 3 | details |
#14 | WRONG ANSWER | 0.01 s | 2, 3 | details |
#15 | WRONG ANSWER | 0.20 s | 3 | details |
#16 | WRONG ANSWER | 0.21 s | 3 | details |
#17 | WRONG ANSWER | 0.21 s | 3 | details |
#18 | WRONG ANSWER | 0.21 s | 3 | details |
#19 | WRONG ANSWER | 0.22 s | 3 | details |
#20 | WRONG ANSWER | 0.25 s | 3 | details |
#21 | WRONG ANSWER | 0.25 s | 3 | details |
#22 | WRONG ANSWER | 0.01 s | 1, 2, 3 | details |
#23 | WRONG ANSWER | 0.01 s | 1, 2, 3 | details |
#24 | WRONG ANSWER | 0.01 s | 1, 2, 3 | details |
#25 | WRONG ANSWER | 0.01 s | 1, 2, 3 | details |
#26 | WRONG ANSWER | 0.01 s | 1, 2, 3 | details |
#27 | WRONG ANSWER | 0.01 s | 1, 2, 3 | details |
#28 | WRONG ANSWER | 0.01 s | 1, 2, 3 | details |
#29 | WRONG ANSWER | 0.01 s | 1, 2, 3 | details |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:57:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &N); ~~~~~^~~~~~~~~~ input/code.cpp:58:32: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result] for (i = 1; i <= N; ++i) scanf("%d", &D[i]); ~~~~~^~~~~~~~~~~~~
Code
#include "bits/stdc++.h" using namespace std; const int PN = 1 << 18; int N, D[200100], Puu[PN * 2]; void Muuta(int k, int x) { k += PN; Puu[k] = x; while (k /= 2) Puu[k] = max(Puu[k * 2], Puu[k * 2 + 1]); } int Hae(int a, int b) { int r = 0; for (a += PN, b += PN; a <= b; a /= 2, b /= 2) { if (a % 2 == 1) r = max(r, Puu[a++]); if (b % 2 == 0) r = max(r, Puu[b--]); } return r; } int Puu1[PN * 2], Puu2[PN * 2]; void Push(int s) { Puu1[s] = max(Puu1[s], Puu2[s]); if (s < PN) { Puu2[s * 2] = max(Puu2[s * 2], Puu2[s]); Puu2[s * 2 + 1] = max(Puu2[s * 2 + 1], Puu2[s]); Puu1[s * 2] = max(Puu1[s * 2], Puu2[s]); Puu1[s * 2 + 1] = max(Puu1[s * 2 + 1], Puu2[s]); } Puu2[s] = 0; } void LMuuta(int L, int R, int l, int r, int s, int x) { Push(s); if (R < l || r < L) return; if (l <= L && R <= r) { Puu1[s] = max(Puu1[s], x); Puu2[s] = max(Puu2[s], x); Push(s); } else { int m = (l + r) / 2; LMuuta(L, R, l, m, s * 2, x); LMuuta(L, R, m + 1, r, s * 2 + 1, x); Puu1[s] = max(Puu1[s * 2], Puu1[s * 2 + 1]); } } int LHae(int L, int R, int l, int r, int s) { Push(s); if (R < l || r < L) return 0; if (l <= L && R <= r) { return Puu1[s]; } int m = (l + r) / 2; return max( LHae(L, R, l, m, s * 2), LHae(L, R, m + 1, r, s * 2 + 1) ); } int main() { int i; scanf("%d", &N); for (i = 1; i <= N; ++i) scanf("%d", &D[i]); for (i = 1; i <= N; ++i) Muuta(i, D[i]); for (i = 1; i <= N; ++i) { int b = 0; for (int z = 1 << 18; z; z /= 2) { if (b + z + i <= N && Hae(i + 1, i + b + z) < D[i]) b += z; } int K = LHae(i, i, 1, PN, 1); // printf("%d - %d\n", i, i + b); if (b) { LMuuta(i + 1, i + b, 1, PN, 1, K + 1); } } printf("%d\n", Puu1[1]); }
Test details
Test 1
Group: 1, 2, 3
Verdict: WRONG ANSWER
input |
---|
10 1 1 1 1 1 1 1 1 1 1 |
correct output |
---|
1 |
user output |
---|
0 |
Test 2
Group: 1, 2, 3
Verdict: WRONG ANSWER
input |
---|
10 1 2 3 4 5 6 7 8 9 10 |
correct output |
---|
10 |
user output |
---|
0 |
Test 3
Group: 1, 2, 3
Verdict: WRONG ANSWER
input |
---|
10 10 9 8 7 6 5 4 3 2 1 |
correct output |
---|
10 |
user output |
---|
9 |
Test 4
Group: 1, 2, 3
Verdict: WRONG ANSWER
input |
---|
10 10 9 6 10 10 3 6 7 6 5 |
correct output |
---|
4 |
user output |
---|
5 |
Test 5
Group: 1, 2, 3
Verdict: WRONG ANSWER
input |
---|
10 51 90 27 98 85 47 14 55 82 52 |
correct output |
---|
6 |
user output |
---|
5 |
Test 6
Group: 1, 2, 3
Verdict: WRONG ANSWER
input |
---|
10 9 65 90 86 45 52 52 95 40 85 |
correct output |
---|
5 |
user output |
---|
3 |
Test 7
Group: 1, 2, 3
Verdict: WRONG ANSWER
input |
---|
10 3 46 77 16 59 32 22 41 87 89 |
correct output |
---|
7 |
user output |
---|
3 |
Test 8
Group: 2, 3
Verdict: WRONG ANSWER
input |
---|
5000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
correct output |
---|
1 |
user output |
---|
0 |
Test 9
Group: 2, 3
Verdict: WRONG ANSWER
input |
---|
5000 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
correct output |
---|
5000 |
user output |
---|
0 |
Test 10
Group: 2, 3
Verdict: WRONG ANSWER
input |
---|
5000 5000 4999 4998 4997 4996 4995 ... |
correct output |
---|
5000 |
user output |
---|
4999 |
Test 11
Group: 2, 3
Verdict: WRONG ANSWER
input |
---|
5000 10 8 10 5 4 9 2 9 10 10 1 2 7 ... |
correct output |
---|
9 |
user output |
---|
2273 |
Test 12
Group: 2, 3
Verdict: WRONG ANSWER
input |
---|
5000 655923386 310000737 281882248 ... |
correct output |
---|
28 |
user output |
---|
2500 |
Test 13
Group: 2, 3
Verdict: WRONG ANSWER
input |
---|
5000 123456789 123456790 123456791 ... |
correct output |
---|
2706 |
user output |
---|
2116 |
Test 14
Group: 2, 3
Verdict: WRONG ANSWER
input |
---|
5000 123456789 123456790 123456791 ... |
correct output |
---|
5000 |
user output |
---|
0 |
Test 15
Group: 3
Verdict: WRONG ANSWER
input |
---|
200000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
correct output |
---|
1 |
user output |
---|
0 |
Test 16
Group: 3
Verdict: WRONG ANSWER
input |
---|
200000 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
correct output |
---|
200000 |
user output |
---|
0 |
Test 17
Group: 3
Verdict: WRONG ANSWER
input |
---|
200000 200000 199999 199998 199997 19... |
correct output |
---|
200000 |
user output |
---|
199999 |
Test 18
Group: 3
Verdict: WRONG ANSWER
input |
---|
200000 4 7 8 3 3 10 3 4 2 6 10 8 5 8 ... |
correct output |
---|
10 |
user output |
---|
89713 |
Test 19
Group: 3
Verdict: WRONG ANSWER
input |
---|
200000 824527039 112439661 517794857 ... |
correct output |
---|
43 |
user output |
---|
99802 |
Test 20
Group: 3
Verdict: WRONG ANSWER
input |
---|
200000 123456789 123456790 123456791 ... |
correct output |
---|
30764 |
user output |
---|
97684 |
Test 21
Group: 3
Verdict: WRONG ANSWER
input |
---|
200000 123456789 123456790 123456791 ... |
correct output |
---|
61367 |
user output |
---|
102301 |
Test 22
Group: 1, 2, 3
Verdict: WRONG ANSWER
input |
---|
1 1 |
correct output |
---|
1 |
user output |
---|
0 |
Test 23
Group: 1, 2, 3
Verdict: WRONG ANSWER
input |
---|
2 1 1 |
correct output |
---|
1 |
user output |
---|
0 |
Test 24
Group: 1, 2, 3
Verdict: WRONG ANSWER
input |
---|
2 1 2 |
correct output |
---|
2 |
user output |
---|
0 |
Test 25
Group: 1, 2, 3
Verdict: WRONG ANSWER
input |
---|
2 2 1 |
correct output |
---|
2 |
user output |
---|
1 |
Test 26
Group: 1, 2, 3
Verdict: WRONG ANSWER
input |
---|
3 1 2 1 |
correct output |
---|
2 |
user output |
---|
1 |
Test 27
Group: 1, 2, 3
Verdict: WRONG ANSWER
input |
---|
3 1 2 3 |
correct output |
---|
3 |
user output |
---|
0 |
Test 28
Group: 1, 2, 3
Verdict: WRONG ANSWER
input |
---|
3 3 2 1 |
correct output |
---|
3 |
user output |
---|
2 |
Test 29
Group: 1, 2, 3
Verdict: WRONG ANSWER
input |
---|
3 2 1 2 |
correct output |
---|
2 |
user output |
---|
1 |