QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#597822 | #9251. Graph Changing | DBsoleil | AC ✓ | 600ms | 3728kb | C++23 | 3.4kb | 2024-09-28 19:00:31 | 2024-09-28 19:00:31 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int q,t,n,k,x,y;
int to[8][8][8];
int main(){
ios_base::sync_with_stdio(false);
cin>>q;
int S=q,T=0;
while(q--){
T++;
cin>>t>>n>>k>>x>>y;
// if(S==630&&T!=181)continue;
// if(S==630&&T==181)cout<<t<<" "<<n<<" "<<k<<" "<<x<<" "<<y<<" ";
// if(n==2&&k>1){cout<<"-1\n";continue;}
if(x>=y)swap(x,y);
if(k==1){
if(t==0){
cout<<y-x<<"\n";
}else cout<<1<<"\n";
}else if(k==2){
if(t==0){
cout<<y-x<<"\n";
}else if(n==2)cout<<-1<<"\n";
else if(n==3){
if(t==1&&y-x==2)cout<<1<<"\n";
else cout<<-1<<"\n";
}else if(n==4){
if(t&1){
if(y-x>=2)cout<<1<<"\n";
else if(x==2)cout<<3<<"\n";
else cout<<2<<"\n";
}else cout<<y-x<<"\n";
}else if(t&1){
if(y-x==1)cout<<2<<"\n";
else cout<<1<<"\n";
}else{
cout<<y-x<<"\n";
}
}else if(k==3&&n<=7){
if(n<=3){
if(t==0)cout<<y-x<<"\n";
else cout<<"-1\n";
}else if(n==4){
if(t==0)cout<<y-x<<"\n";
else if(t==1){
if(y-x==3)cout<<1<<"\n";
else cout<<"-1\n";
}else cout<<"-1\n";
}else if(n==5){
if(t==0)cout<<y-x<<"\n";
else if(t==1){
if(y-x>=3)cout<<1<<"\n";
else if(y==4&&x==2)cout<<3<<"\n";
else if(x==1&&y==2||x==4&&y==5)cout<<2<<"\n";
else cout<<"-1\n";
}else if(t==2&&y==4&&x==2)cout<<1<<"\n";
else cout<<"-1\n";
}else if(n==6){
if(t==0)cout<<y-x<<"\n";
else if(t==1){
if(y-x>=3)cout<<1<<"\n";
else if(y-x==1&&x!=3)cout<<2<<"\n";
else if(x==1||y==6)cout<<2<<"\n";
else cout<<3<<"\n";
}else if(t==2){
if(x==1||y==6)cout<<-1<<"\n";
else{
if(x==3)x=4;
else if(x==4)x=3;
if(y==3)y=4;
else if(y==4)y=3;
cout<<abs(y-x)<<"\n";
}
}else if(t==3&&x==2&&y==5)cout<<1<<"\n";
else cout<<-1<<"\n";
}else{
if(t==0)cout<<y-x<<"\n";
else if(t==1){
if(y-x>=k)cout<<"1\n";
else if(x>k||n-y>=k){
cout<<"2\n";
}else if(y>k&&n-x>=k){
cout<<"3\n";
}else cout<<"-1\n";
}else if(t==2&&x==3&&y==5)cout<<1<<"\n";
else cout<<"-1\n";
}
}else{
if(t==0)cout<<y-x<<"\n";
else if(t==1){
if(y-x>=k)cout<<"1\n";
else if(x>k||n-y>=k){
cout<<"2\n";
}else if(y>k&&n-x>=k){
cout<<"3\n";
}else cout<<"-1\n";
}else cout<<"-1\n";
}
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3664kb
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: 3672kb
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 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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: 2ms
memory: 3676kb
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: 3ms
memory: 3728kb
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: 3724kb
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: 592ms
memory: 3684kb
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: 527ms
memory: 3592kb
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: 564ms
memory: 3672kb
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: 597ms
memory: 3600kb
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: 576ms
memory: 3640kb
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: 580ms
memory: 3608kb
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: 598ms
memory: 3716kb
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: 531ms
memory: 3656kb
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: 600ms
memory: 3588kb
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: 572ms
memory: 3716kb
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: 381ms
memory: 3676kb
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: 372ms
memory: 3664kb
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 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1 1 -1 -1 1 1 -1 2 2 1 1 2 -1 2 -1 -1 -1 1 -1 2 -1 -1 -1 1 -1 -1 -1 1 -1 -1 -1 -1 1 4 -1 -1 1 1 -1 2 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 1 ...
result:
ok 999998 lines
Test #27:
score: 0
Accepted
time: 424ms
memory: 3636kb
input:
999997 0 9 10 1 3 4 7 1 6 7 2 2 10 1 2 0 3 8 1 3 4 3 4 2 3 5 6 4 5 6 0 6 1 2 6 5 8 5 4 5 0 5 7 3 5 2 7 2 1 7 3 8 1 3 6 0 10 2 4 5 1 8 7 4 5 3 2 9 1 2 1 9 10 5 9 5 4 6 1 4 3 3 9 2 3 1 3 7 2 3 1 9 6 3 5 1 2 5 1 2 5 10 3 7 9 3 3 6 2 3 0 7 5 1 6 3 5 4 4 5 2 2 8 1 2 3 6 5 1 5 3 5 10 1 2 0 5 9 4 5 1 2 5 1...
output:
2 1 -1 2 -1 -1 4 -1 2 6 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 5 -1 -1 -1 -1 1 -1 4 2 3 1 -1 -1 -1 3 2 1 -1 -1 1 3 -1 1 -1 -1 -1 1 -1 -1 1 -1 -1 1 -1 -1 -1 -1 1 -1 -1 1 -1 -1 -1 3 -1 1 -1 -1 -1 1 2 -1 -1 -1 -1 -1 1 2 1 -1 -1 1 -1 6 -1 -1 -1 -1 3 -1 1 -1 -1 -1 -1 2 -1 1 1 -1 -1 1 1 1 1 1 -1 -1 -1 2 1 -1 -...
result:
ok 999997 lines
Test #28:
score: 0
Accepted
time: 456ms
memory: 3604kb
input:
999996 0 4 1 2 3 4 3 3 2 3 0 7 6 1 7 3 7 5 6 7 3 3 5 1 2 1 6 1 2 6 0 10 6 2 10 3 3 10 2 3 4 2 2 1 2 1 9 8 5 6 5 8 6 6 8 3 8 7 3 6 5 8 8 3 5 2 4 1 2 3 2 2 7 1 2 3 6 3 5 6 1 10 9 8 10 5 5 6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