QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#617415 | #9251. Graph Changing | ucup-team4153# | AC ✓ | 329ms | 3708kb | C++20 | 3.5kb | 2024-10-06 15:27:41 | 2024-10-06 15:27:41 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int solve0(int n, int k, int x, int y) {
return abs(x - y);
}
int solve1(int n, int k, int x, int y) {
if (abs(x - y) >= k)return 1;
if ((abs(x - 1) >= k && abs(1 - y) >= k) || ((abs(x - n) >= k && abs(n - y) >= k)))return 2;
if ((abs(x - 1) >= k && abs(1 - n) >= k && abs(n - y) >= k) ||
(abs(x - n) >= k && abs(n - 1) >= k && abs(1 - y) >= k))
return 3;
return -1;
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int q;
cin >> q;
while (q--) {
int t, n, k, x, y;
cin >> t >> n >> k >> x >> y;
if (t == 0) {
cout << solve0(n, k, x, y) << '\n';
continue;
} else if (t == 1) {
cout << solve1(n, k, x, y) << '\n';
continue;
}
if (k == 1) {
cout << 1 << '\n';
} else if (k == 2) {
if (n <= 3) {
cout << -1 << '\n';
} else {
if (t & 1)cout << solve1(n, k, x, y) << '\n';
else cout << solve0(n, k, x, y) << "\n";
}
} else if (k == 3) {
if (n == 6) {
if (t == 2) {
if (x == 2) {
if (y == 4)cout << 1 << '\n';
else if (y == 3)cout << 2 << '\n';
else if (y == 5)cout << 3 << '\n';
else cout << -1 << '\n';
} else if (x == 4) {
if (y == 2)cout << 1 << '\n';
else if (y == 3)cout << 1 << '\n';
else if (y == 5)cout << 2 << '\n';
else cout << -1 << '\n';
} else if (x == 3) {
if (y == 2)cout << 2 << '\n';
else if (y == 4)cout << 1 << '\n';
else if (y == 5)cout << 1 << '\n';
else cout << -1 << '\n';
} else if (x == 5) {
if (y == 2)cout << 3 << '\n';
else if (y == 4)cout << 2 << '\n';
else if (y == 3)cout << 1 << '\n';
else cout << -1 << '\n';
} else {
cout << -1 << '\n';
}
} else if (t == 3) {
if ((x == 2 && y == 5) || (x == 5 && y == 2)) {
cout << 1 << '\n';
} else {
cout << -1 << '\n';
}
} else {
cout << -1 << '\n';
}
} else if (n >= 4 && n <= 7 && t == 2) {
if (n == 4) {
cout << -1 << '\n';
} else if (n == 5) {
if ((x == 2 && y == 4) || (x == 4 && y == 2)) {
cout << 1 << '\n';
} else {
cout << -1 << '\n';
}
} else if (n == 7) {
if ((x == 3 && y == 5) || (x == 5 && y == 3)) {
cout << 1 << '\n';
} else {
cout << -1 << '\n';
}
}
} else {
cout << -1 << '\n';
}
} else {
cout << -1 << '\n';
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3564kb
input:
5 1 5 3 2 4 1 10 4 2 4 2 10 5 2 4 1 3 2 1 3 1 3 2 1 2
output:
3 2 -1 1 -1
result:
ok 5 lines
Test #2:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
30 1 2 1 1 2 1 2 2 1 2 1 2 3 1 2 1 2 4 1 2 1 2 5 1 2 1 2 6 1 2 2 2 1 1 2 2 2 2 1 2 2 2 3 1 2 2 2 4 1 2 2 2 5 1 2 2 2 6 1 2 3 2 1 1 2 3 2 2 1 2 3 2 3 1 2 3 2 4 1 2 3 2 5 1 2 3 2 6 1 2 4 2 1 1 2 4 2 2 1 2 4 2 3 1 2 4 2 4 1 2 4 2 5 1 2 4 2 6 1 2 5 2 1 1 2 5 2 2 1 2 5 2 3 1 2 5 2 4 1 2 5 2 5 1 2 5 2 6 1 2
output:
1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1
result:
ok 30 lines
Test #3:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
90 1 3 1 1 2 1 3 1 1 3 1 3 1 2 3 1 3 2 1 2 1 3 2 1 3 1 3 2 2 3 1 3 3 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
output:
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 2 1 1 1 1 1 1 2 1 1 1 1 1 2 1 1 1 1 2 1 1 1 2 1 1 2 1 2 2 2 1 1 1 1 1 1 2 2 1 1 1 1 1 2 2 1 1 1 1 2 2 1 1 1 2 2 1 1 2 2 1 2 2 2 2 2 2 1 1 1 1 1 2 2 2 1 1 1 1 2 2 3 1 1 1 2 3 3 1 1 2 2 2 1 2 2 2 2 2 2 2 2 2 -1 1 1...
result:
ok 1080 lines
Test #10:
score: 0
Accepted
time: 1ms
memory: 3560kb
input:
1350 1 10 1 1 2 1 10 1 1 3 1 10 1 1 4 1 10 1 1 5 1 10 1 1 6 1 10 1 1 7 1 10 1 1 8 1 10 1 1 9 1 10 1 1 10 1 10 1 2 3 1 10 1 2 4 1 10 1 2 5 1 10 1 2 6 1 10 1 2 7 1 10 1 2 8 1 10 1 2 9 1 10 1 2 10 1 10 1 3 4 1 10 1 3 5 1 10 1 3 6 1 10 1 3 7 1 10 1 3 8 1 10 1 3 9 1 10 1 3 10 1 10 1 4 5 1 10 1 4 6 1 10 1...
output:
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 2 1 1 1 1 1 1 2 1 1 1 1 1 2 1 1 1 1 2 1 1 1 2 1 1 2 1 2 2 2 1 1 1 1 1 1 1 2 2 1 1 1 1 1 1 2 2 1 1 1 1 1 2 2 1 1 1 1 2 2 1 1 1 2 2 1 1 2 2 1 2 2 2 2 2 2 1 1 1 1 1 1 2 2 2 1 1 1 ...
result:
ok 1350 lines
Test #11:
score: 0
Accepted
time: 1ms
memory: 3644kb
input:
1650 1 11 1 1 2 1 11 1 1 3 1 11 1 1 4 1 11 1 1 5 1 11 1 1 6 1 11 1 1 7 1 11 1 1 8 1 11 1 1 9 1 11 1 1 10 1 11 1 1 11 1 11 1 2 3 1 11 1 2 4 1 11 1 2 5 1 11 1 2 6 1 11 1 2 7 1 11 1 2 8 1 11 1 2 9 1 11 1 2 10 1 11 1 2 11 1 11 1 3 4 1 11 1 3 5 1 11 1 3 6 1 11 1 3 7 1 11 1 3 8 1 11 1 3 9 1 11 1 3 10 1 11...
output:
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 2 1 1 1 1 1 1 2 1 1 1 1 1 2 1 1 1 1 2 1 1 1 2 1 1 2 1 2 2 2 1 1 1 1 1 1 1 1 2 2 1 1 1 1 1 1 1 2 2 1 1 1 1 1 1 2 2 1 1 1 1 1 2 2 1 1 1 1 ...
result:
ok 1650 lines
Test #12:
score: 0
Accepted
time: 1ms
memory: 3564kb
input:
1980 1 12 1 1 2 1 12 1 1 3 1 12 1 1 4 1 12 1 1 5 1 12 1 1 6 1 12 1 1 7 1 12 1 1 8 1 12 1 1 9 1 12 1 1 10 1 12 1 1 11 1 12 1 1 12 1 12 1 2 3 1 12 1 2 4 1 12 1 2 5 1 12 1 2 6 1 12 1 2 7 1 12 1 2 8 1 12 1 2 9 1 12 1 2 10 1 12 1 2 11 1 12 1 2 12 1 12 1 3 4 1 12 1 3 5 1 12 1 3 6 1 12 1 3 7 1 12 1 3 8 1 1...
output:
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 2 1 1 1 1 1 1 2 1 1 1 1 1 2 1 1 1 1 2 1 1 1 2 1 1 2 1 2 2 2 1 1 1 1 1 1 1 1 1 2 2 1 1 1 1 1 ...
result:
ok 1980 lines
Test #13:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
2340 1 13 1 1 2 1 13 1 1 3 1 13 1 1 4 1 13 1 1 5 1 13 1 1 6 1 13 1 1 7 1 13 1 1 8 1 13 1 1 9 1 13 1 1 10 1 13 1 1 11 1 13 1 1 12 1 13 1 1 13 1 13 1 2 3 1 13 1 2 4 1 13 1 2 5 1 13 1 2 6 1 13 1 2 7 1 13 1 2 8 1 13 1 2 9 1 13 1 2 10 1 13 1 2 11 1 13 1 2 12 1 13 1 2 13 1 13 1 3 4 1 13 1 3 5 1 13 1 3 6 1...
output:
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 2 1 1 1 1 1 1 2 1 1 1 1 1 2 1 1 1 1 2 1 1 1 ...
result:
ok 2340 lines
Test #14:
score: 0
Accepted
time: 325ms
memory: 3556kb
input:
1000000 247642294 961448649 733001129 279130562 530835402 732002655 505705299 645705556 487588093 488005936 423909487 956469930 42118321 776825480 857914491 573024322 173584499 411922860 68071790 127760171 195256403 617390756 240978977 289616458 604023215 302970816 281642201 617886109 245587163 2738...
output:
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...
result:
ok 1000000 lines
Test #15:
score: 0
Accepted
time: 329ms
memory: 3544kb
input:
999999 818561732 105393047 308277328 55828222 95820891 626623416 914227808 963423453 365760112 463062746 685116026 447528560 848245265 304903588 410888549 190989264 573411702 351364570 477139815 538078040 165251011 443239658 880597903 283340857 321622039 580345373 729628729 253275172 260647549 56083...
output:
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...
result:
ok 999999 lines
Test #16:
score: 0
Accepted
time: 325ms
memory: 3644kb
input:
999998 641304551 95615249 714496774 44706863 82597067 99120825 296948618 325272169 221497167 253219866 547135214 407423323 615477879 395311431 402237613 902423318 562586582 197117012 215866474 332581531 746228275 461110170 365490393 8270545 13567149 209099954 601749155 822593415 70976179 302958983 7...
output:
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...
result:
ok 999998 lines
Test #17:
score: 0
Accepted
time: 309ms
memory: 3700kb
input:
999997 759014662 790870149 120716220 312341665 750583643 908054724 384702127 982088181 220708338 372080663 745590890 662285387 822901980 14637938 407944387 613857370 473613609 192612558 314642869 447537089 327205537 773947983 850382884 367385950 465660605 542887244 473869581 242168554 442534885 4616...
output:
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...
result:
ok 999997 lines
Test #18:
score: 0
Accepted
time: 328ms
memory: 3572kb
input:
999996 286790189 76059652 676678771 27025196 72899785 380552134 140538090 638904193 140356967 140371077 944046566 622180150 180069186 386081350 473991190 325291423 167821189 333332295 37470414 135098524 834553872 8637942 335275375 984215 5958852 245270753 51022707 516519501 15376414 50059575 4736168...
output:
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...
result:
ok 999996 lines
Test #19:
score: 0
Accepted
time: 275ms
memory: 3708kb
input:
1000000 5 961448649 14 279130562 530835402 0 505705299 11 487588093 488005936 5 956469930 6 776825480 857914491 5 173584499 5 68071790 127760171 5 617390756 2 289616458 604023215 2 281642201 14 245587163 273817065 5 411506287 9 42526705 317589066 3 547485462 9 271470684 437838096 5 996351074 6 74856...
output:
-1 417843 -1 -1 1 -1 -1 -1 -1 1 -1 1 6580696 422807208 153431515 -1 179429643 -1 84805156 -1 654790747 60452774 31347044 15066715 -1 18522683 -1 4346920 1 -1 -1 22973969 1 24950066 -1 -1 96093015 -1 1 -1 -1 -1 -1 -1 18083094 42298920 -1 1 -1 -1 -1 -1 1 -1 -1 90334756 24178093 126162761 -1 -1 -1 -1 1...
result:
ok 1000000 lines
Test #20:
score: 0
Accepted
time: 270ms
memory: 3580kb
input:
999999 0 105393047 8 55828222 95820891 2 914227808 13 365760112 463062746 3 447528560 10 304903588 410888549 1 573411702 5 477139815 538078040 5 443239658 13 283340857 321622039 5 729628729 7 260647549 560838179 3 215299701 10 34885046 213523791 2 859374122 1 544508624 795986441 4 864873312 7 416831...
output:
39992669 -1 -1 1 -1 -1 -1 1 -1 -1 -1 1 1 -1 -1 -1 -1 1 -1 -1 -1 1 10573113 -1 1 -1 -1 1 1 -1 -1 -1 68522961 -1 -1 -1 1 -1 -1 1 1 -1 -1 -1 1 17590651 -1 -1 -1 -1 11554641 -1 1 1 1 -1 -1 288548258 447374910 -1 1 1 19114954 -1 -1 1 1 -1 -1 -1 1 -1 121545976 1 -1 -1 -1 -1 1 -1 -1 -1 22273383 -1 99473454...
result:
ok 999999 lines
Test #21:
score: 0
Accepted
time: 273ms
memory: 3628kb
input:
999998 4 95615249 9 44706863 82597067 1 296948618 14 221497167 253219866 4 407423323 14 395311431 402237613 4 562586582 7 215866474 332581531 5 461110170 3 8270545 13567149 1 601749155 15 70976179 302958983 2 932067490 13 282852789 866650449 3 392745208 11 84796685 215041796 5 181898334 11 141866145...
output:
-1 1 -1 -1 -1 1 -1 -1 -1 350618868 -1 -1 -1 1 -1 -1 -1 1 -1 -1 71256593 1 122819155 20990479 274550506 -1 1 -1 -1 -1 1 -1 -1 -1 -1 118002775 -1 1 -1 -1 1 -1 -1 1 -1 -1 41577280 -1 -1 -1 -1 63382083 -1 -1 1 -1 1 -1 -1 640147 1 -1 254225645 86753831 103490873 54662526 1 -1 1 -1 -1 -1 1 -1 1 -1 1 -1 80...
result:
ok 999998 lines
Test #22:
score: 0
Accepted
time: 277ms
memory: 3680kb
input:
999997 0 790870149 10 312341665 750583643 4 384702127 1 220708338 372080663 2 662285387 10 14637938 407944387 0 473613609 3 314642869 447537089 4 773947983 9 367385950 465660605 5 473869581 14 442534885 461613235 0 726983133 1 417689049 679009425 5 221083595 5 123544654 169809378 0 872038508 7 57750...
output:
438241978 1 -1 132894220 -1 -1 261320376 -1 256026211 81434046 -1 483828385 1 -1 1 -1 -1 1 1 1 -1 -1 316297589 -1 -1 -1 -1 138841964 1 -1 1 149402190 28459733 -1 -1 -1 1 1 1 1 172487273 78450129 5779513 -1 1 -1 -1 -1 84682459 -1 -1 7655353 -1 -1 1 -1 -1 -1 -1 1 -1 -1 391436221 -1 -1 1 52970836 -1 -1...
result:
ok 999997 lines
Test #23:
score: 0
Accepted
time: 273ms
memory: 3584kb
input:
999996 0 76059652 6 27025196 72899785 4 140538090 3 140356967 140371077 0 622180150 1 386081350 473991190 3 167821189 5 37470414 135098524 3 8637942 15 984215 5958852 1 51022707 6 15376414 50059575 0 443750923 11 345920051 385212659 3 459487380 15 354903169 361806660 4 562178684 12 325063103 5252331...
output:
45874589 -1 87909840 -1 -1 1 39292608 -1 -1 1 -1 -1 -1 -1 20865528 -1 1 -1 1 -1 1 -1 1 -1 -1 -1 1 -1 67152271 -1 -1 77079066 1 -1 1 -1 40195106 -1 -1 1 169344308 10313868 1 1 50691532 1 -1 1 -1 1 -1 1 -1 -1 -1 1 -1 -1 1 -1 -1 -1 22802409 -1 1 1 -1 -1 -1 1 31178015 -1 -1 -1 1 -1 -1 14200880 1 -1 2356...
result:
ok 999996 lines
Test #24:
score: 0
Accepted
time: 181ms
memory: 3644kb
input:
1000000 5 6 9 2 5 0 6 6 1 5 5 6 1 3 4 5 5 10 4 5 5 8 7 2 3 2 8 9 3 4 5 7 9 1 6 3 9 9 7 9 5 8 1 1 4 5 2 6 1 2 2 2 3 1 2 5 7 7 5 7 0 10 7 2 3 0 8 1 2 6 0 6 3 1 6 5 10 4 6 7 0 4 6 3 4 4 8 5 5 6 0 5 2 3 5 3 3 8 2 3 0 3 6 2 3 0 5 10 2 4 0 9 4 6 9 0 2 2 1 2 5 9 5 3 7 0 2 7 1 2 4 4 7 1 3 0 10 1 1 2 5 2 1 1...
output:
-1 4 1 -1 -1 -1 -1 -1 1 -1 -1 -1 1 4 5 -1 1 -1 2 -1 1 2 3 1 -1 1 -1 1 1 -1 1 1 2 1 1 -1 1 -1 1 -1 -1 -1 -1 -1 3 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 2 6 1 -1 5 -1 -1 -1 -1 2 1 1 1 1 -1 -1 -1 -1 5 -1 -1 -1 1 -1 2 -1 -1 1 -1 -1 -1 -1 -1 2 -1 -1 -1 1 -1 -1 -1 1 -1 -1 3 1 -1 2 -1 1 -1 1 -1 -1 -1 3 1 -1 -1 1 -1 ...
result:
ok 1000000 lines
Test #25:
score: 0
Accepted
time: 181ms
memory: 3580kb
input:
999999 0 5 8 4 5 2 5 3 1 3 3 5 5 4 5 1 3 10 1 3 5 8 3 2 6 5 7 2 1 5 3 9 10 6 9 2 5 1 1 4 4 6 7 3 5 3 3 4 1 3 5 10 10 7 9 1 6 4 5 6 5 10 7 2 10 4 7 2 6 7 4 7 10 6 7 2 6 10 4 5 5 8 4 5 6 1 4 6 3 4 3 5 5 1 5 5 4 9 2 3 3 5 5 3 4 1 5 4 4 5 0 10 8 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