QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#625106#9432. Permutation11d10xyAC ✓280ms3948kbC++141.5kb2024-10-09 17:28:402024-10-09 17:28:40

Judging History

你现在查看的是最新测评结果

  • [2024-10-09 17:28:40]
  • 评测
  • 测评结果:AC
  • 用时:280ms
  • 内存:3948kb
  • [2024-10-09 17:28:40]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
mt19937 g(time(0));
vector<int>ans,p0;
int n;
inline int ask(vector<int>p){
   cout<<"0 ";for(int i=1;i<=n;i++)cout<<p[i]<<' ';cout<<endl;
   int res;cin>>res;return res;
}
void solve(int l,int r,vector<int>nums){
   if(l==r)return ans[l]=nums[0],void();
   int mid=l+r>>1;
   shuffle(begin(nums),end(nums),g);
   vector<int>L,R;
   for(int i=0;i<nums.size();i+=2){
      if(L.size()==mid-l+1){
         for(int j=i;j<nums.size();j++)R.push_back(nums[j]);
         break;
      }
      if(R.size()==r-mid){
         for(int j=i;j<nums.size();j++)L.push_back(nums[j]);
         break;
      }
      int x=nums[i],y=nums[i+1];
      auto p=p0;
      for(int k=l;k<=mid;k++)p[k]=x;
      for(int k=mid+1;k<=r;k++)p[k]=y;
      int res=ask(p);
      if(res==0){
         L.push_back(y),R.push_back(x);
      }else if(res==2){
         L.push_back(x),R.push_back(y);
      }else{
         p=p0;
         for(int k=l;k<=mid;k++)p[k]=x;
         if(ask(p))L.push_back(x),L.push_back(y);
         else R.push_back(x),R.push_back(y);
      }
   }
   solve(l,mid,L),solve(mid+1,r,R);
}
int main(){
   cin>>n,p0.resize(n+1),ans.resize(n+1);
   if(n==1)return cout<<"1 1"<<endl,0;
   while(1){
      for(int i=1;i<=n;i++)p0[i]=g()%n+1;
      if(!ask(p0))break;
   }
   vector<int>S(n);
   for(int i=0;i<n;i++)S[i]=i+1;
   solve(1,n,S);
   cout<<"1 ";for(int i=1;i<=n;i++)cout<<ans[i]<<' ';cout<<endl;
   return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3676kb

input:

5
1
0
1
0
2
0
2

output:

0 2 2 2 2 4 
0 4 1 4 3 1 
0 1 1 1 5 5 
0 1 1 1 3 1 
0 3 3 2 3 1 
0 4 3 4 3 1 
0 4 1 4 1 5 
1 3 4 2 1 5 

result:

ok Accepted

Test #2:

score: 0
Accepted
time: 260ms
memory: 3872kb

input:

1000
2
3
1
2
0
0
1
0
0
1
0
1
1
1
1
1
0
1
1
1
0
1
1
1
0
2
1
1
1
0
0
0
0
0
0
2
1
0
0
2
1
1
2
2
2
1
1
1
0
2
0
1
0
2
1
1
1
1
2
0
1
1
0
2
1
1
1
1
0
1
1
2
0
1
0
0
1
1
1
1
1
0
0
0
1
1
1
0
0
1
0
2
1
1
2
1
0
1
1
0
2
2
2
0
1
0
2
1
1
1
0
0
1
0
2
1
1
0
1
0
0
0
1
0
1
1
1
0
2
0
1
1
0
1
0
1
0
0
1
1
0
1
0
1
1
0
2
1...

output:

0 372 312 462 827 914 934 326 529 168 346 396 200 735 667 158 388 968 319 676 440 897 79 114 618 10 243 906 856 80 368 593 120 76 470 826 584 660 162 63 293 973 870 584 461 263 934 4 319 724 373 747 40 353 36 244 354 51 548 512 895 472 831 241 403 433 286 264 808 556 714 170 900 721 245 630 310 980 ...

result:

ok Accepted

Test #3:

score: 0
Accepted
time: 1ms
memory: 3708kb

input:

1

output:

1 1

result:

ok Accepted

Test #4:

score: 0
Accepted
time: 1ms
memory: 3668kb

input:

2
2
1
0
2

output:

0 2 1 
0 1 1 
0 1 2 
0 2 1 
1 2 1 

result:

ok Accepted

Test #5:

score: 0
Accepted
time: 1ms
memory: 3648kb

input:

3
1
2
1
1
2
1
1
0
1
1
2

output:

0 1 1 1 
0 2 1 2 
0 3 3 1 
0 3 3 1 
0 2 1 2 
0 1 1 3 
0 3 2 1 
0 2 3 3 
0 3 3 1 
0 3 3 3 
0 3 1 3 
1 3 1 2 

result:

ok Accepted

Test #6:

score: 0
Accepted
time: 0ms
memory: 3832kb

input:

4
1
2
1
0
0
0
0
2

output:

0 2 3 3 1 
0 3 4 3 4 
0 2 4 4 2 
0 1 2 3 2 
0 1 1 4 4 
0 2 2 3 3 
0 4 3 3 2 
0 1 2 2 1 
1 3 4 2 1 

result:

ok Accepted

Test #7:

score: 0
Accepted
time: 1ms
memory: 3912kb

input:

6
0
1
0
2
2
0
1
1
2

output:

0 4 1 1 5 1 2 
0 5 5 5 1 1 1 
0 5 5 5 5 1 2 
0 2 2 2 6 6 6 
0 3 3 2 5 1 2 
0 4 3 1 5 1 2 
0 4 1 1 1 1 6 
0 4 1 1 1 1 2 
0 4 1 1 1 6 2 
1 3 4 2 1 6 5 

result:

ok Accepted

Test #8:

score: 0
Accepted
time: 1ms
memory: 3672kb

input:

7
2
0
1
1
1
0
0
1
0
2
2
1
1
2

output:

0 6 4 2 6 4 4 4 
0 2 5 7 2 2 4 1 
0 1 1 1 1 2 2 2 
0 1 1 1 1 2 4 1 
0 4 4 4 4 5 5 5 
0 4 4 4 4 2 4 1 
0 6 6 6 6 7 7 7 
0 2 2 1 1 2 4 1 
0 2 2 7 2 2 4 1 
0 3 7 7 2 2 4 1 
0 2 5 2 1 2 4 1 
0 2 5 7 2 5 5 6 
0 2 5 7 2 5 5 1 
0 2 5 7 2 6 5 1 
1 3 7 2 1 6 5 4 

result:

ok Accepted

Test #9:

score: 0
Accepted
time: 1ms
memory: 3608kb

input:

8
1
0
1
0
1
1
1
0
0
2
0
2
2
2
2
0

output:

0 6 3 7 5 7 4 7 8 
0 2 4 4 2 1 6 7 2 
0 8 8 8 8 4 4 4 4 
0 8 8 8 8 1 6 7 2 
0 7 7 7 7 3 3 3 3 
0 7 7 7 7 1 6 7 2 
0 5 5 5 5 6 6 6 6 
0 5 5 5 5 1 6 7 2 
0 2 2 3 3 1 6 7 2 
0 7 7 1 1 1 6 7 2 
0 7 3 4 2 1 6 7 2 
0 2 4 2 1 1 6 7 2 
0 2 4 4 2 6 6 8 8 
0 2 4 4 2 5 5 4 4 
0 2 4 4 2 6 5 7 2 
0 2 4 4 2 1 6 8...

result:

ok Accepted

Test #10:

score: 0
Accepted
time: 1ms
memory: 3608kb

input:

9
0
2
1
1
1
0
0
1
1
1
0
0
0
2
1
1
0
2

output:

0 1 1 7 2 4 2 3 9 1 
0 2 2 2 2 2 6 6 6 6 
0 3 3 3 3 3 9 9 9 9 
0 3 3 3 3 3 2 3 9 1 
0 5 5 5 5 5 4 4 4 4 
0 5 5 5 5 5 2 3 9 1 
0 8 8 8 8 8 1 1 1 1 
0 3 3 3 7 7 2 3 9 1 
0 3 3 3 2 4 2 3 9 1 
0 9 9 9 1 1 2 3 9 1 
0 9 9 9 2 4 2 3 9 1 
0 2 2 7 2 4 2 3 9 1 
0 7 3 7 2 4 2 3 9 1 
0 1 1 7 1 9 2 3 9 1 
0 1 1 ...

result:

ok Accepted

Test #11:

score: 0
Accepted
time: 1ms
memory: 3828kb

input:

10
0
1
1
2
0
0
1
0
0
2
2
1
0
0
0
2

output:

0 4 3 9 9 3 2 9 2 8 6 
0 3 3 3 3 3 1 1 1 1 1 
0 3 3 3 3 3 2 9 2 8 6 
0 7 7 7 7 7 5 5 5 5 5 
0 8 8 8 8 8 10 10 10 10 10 
0 2 2 2 2 2 9 9 9 9 9 
0 9 9 9 1 1 2 9 2 8 6 
0 9 9 9 9 3 2 9 2 8 6 
0 10 10 3 9 3 2 9 2 8 6 
0 3 7 9 9 3 2 9 2 8 6 
0 4 3 9 1 9 2 9 2 8 6 
0 4 3 9 9 3 2 2 2 6 6 
0 4 3 9 9 3 2 2 2...

result:

ok Accepted

Test #12:

score: 0
Accepted
time: 0ms
memory: 3668kb

input:

11
1
2
0
2
1
1
0
1
0
0
1
1
1
0
0
0
0
2
0
2
0
2
2
0

output:

0 10 7 2 6 5 2 9 8 7 8 1 
0 8 5 11 8 7 8 4 3 1 5 8 
0 1 3 3 2 10 4 2 6 7 1 1 
0 10 10 10 10 10 10 6 6 6 6 6 
0 3 3 3 3 3 3 7 7 7 7 7 
0 3 3 3 3 3 3 2 6 7 1 1 
0 2 2 2 2 2 2 1 1 1 1 1 
0 11 11 11 11 11 11 4 4 4 4 4 
0 11 11 11 11 11 11 2 6 7 1 1 
0 8 8 8 8 8 8 9 9 9 9 9 
0 7 7 7 3 3 3 2 6 7 1 1 
0 7 ...

result:

ok Accepted

Test #13:

score: 0
Accepted
time: 1ms
memory: 3668kb

input:

12
1
0
2
1
1
0
0
0
2
1
1
0
0
2
0
1
1
2
2
2
0
0

output:

0 10 7 7 5 7 8 3 12 10 12 12 10 
0 5 10 11 10 10 12 9 5 1 11 9 3 
0 10 10 10 10 10 10 8 8 8 8 8 8 
0 3 3 3 3 3 3 5 5 5 5 5 5 
0 3 3 3 3 3 3 9 5 1 11 9 3 
0 11 11 11 11 11 11 7 7 7 7 7 7 
0 2 2 2 2 2 2 1 1 1 1 1 1 
0 4 4 4 4 4 4 9 9 9 9 9 9 
0 3 3 3 9 9 9 9 5 1 11 9 3 
0 10 10 10 7 7 7 9 5 1 11 9 3 
...

result:

ok Accepted

Test #14:

score: 0
Accepted
time: 1ms
memory: 3668kb

input:

13
0
0
0
1
1
0
1
0
2
0
1
0
0
2
2
2
1
1
2
0
2
0
2
2
2
0

output:

0 1 4 1 10 2 12 3 1 8 3 1 7 2 
0 2 2 2 2 2 2 2 5 5 5 5 5 5 
0 3 3 3 3 3 3 3 9 9 9 9 9 9 
0 10 10 10 10 10 10 10 4 4 4 4 4 4 
0 10 10 10 10 10 10 10 1 8 3 1 7 2 
0 8 8 8 8 8 8 8 7 7 7 7 7 7 
0 6 6 6 6 6 6 6 11 11 11 11 11 11 
0 6 6 6 6 6 6 6 1 8 3 1 7 2 
0 13 13 13 13 13 13 13 12 12 12 12 12 12 
0 9 ...

result:

ok Accepted

Test #15:

score: 0
Accepted
time: 1ms
memory: 3744kb

input:

14
1
0
1
0
1
1
0
1
1
1
0
2
2
1
1
2
1
0
1
0
0
2
1
1
2
0
1
1
1
0
2
0
2
2
0
0

output:

0 6 11 9 13 11 4 11 2 12 14 2 2 11 8 
0 3 10 6 12 5 9 1 7 11 3 2 9 5 10 
0 2 2 2 2 2 2 2 8 8 8 8 8 8 8 
0 2 2 2 2 2 2 2 7 11 3 2 9 5 10 
0 13 13 13 13 13 13 13 14 14 14 14 14 14 14 
0 13 13 13 13 13 13 13 7 11 3 2 9 5 10 
0 11 11 11 11 11 11 11 10 10 10 10 10 10 10 
0 4 4 4 4 4 4 4 9 9 9 9 9 9 9 
0 ...

result:

ok Accepted

Test #16:

score: 0
Accepted
time: 1ms
memory: 3616kb

input:

15
0
1
0
1
1
0
0
0
1
1
2
0
1
0
1
1
2
1
1
2
0
0
2
2
2
2
0
1
1
2
2
2
0
2
2

output:

0 4 13 4 14 13 2 9 12 13 6 6 10 2 1 11 
0 5 5 5 5 5 5 5 5 2 2 2 2 2 2 2 
0 5 5 5 5 5 5 5 5 13 6 6 10 2 1 11 
0 10 10 10 10 10 10 10 10 4 4 4 4 4 4 4 
0 10 10 10 10 10 10 10 10 13 6 6 10 2 1 11 
0 14 14 14 14 14 14 14 14 1 1 1 1 1 1 1 
0 12 12 12 12 12 12 12 12 9 9 9 9 9 9 9 
0 8 8 8 8 8 8 8 8 15 15 ...

result:

ok Accepted

Test #17:

score: 0
Accepted
time: 249ms
memory: 3708kb

input:

975
1
0
1
1
2
2
1
1
1
0
2
1
1
2
1
1
2
1
0
2
1
0
2
2
2
2
2
1
1
0
1
0
0
2
1
1
1
1
1
1
2
1
0
2
1
1
0
0
1
1
0
1
0
1
1
1
0
1
0
1
1
1
1
1
0
1
0
1
1
1
0
1
0
2
1
1
2
2
2
0
2
2
1
0
1
0
0
1
1
1
1
1
1
1
0
2
2
1
1
2
0
1
0
1
0
1
1
2
0
2
2
2
1
1
0
1
1
1
0
2
2
2
1
1
0
0
0
0
2
1
1
2
0
2
1
0
1
1
0
1
0
2
1
1
0
1
1
1
...

output:

0 79 628 859 959 28 77 744 222 268 471 651 670 392 226 146 199 316 966 108 419 79 929 168 390 67 650 698 15 803 685 415 153 579 312 863 865 632 736 94 176 275 887 467 242 629 272 792 971 721 68 326 816 303 389 298 425 974 139 628 502 377 253 242 940 515 919 146 2 359 381 775 23 485 143 144 571 926 1...

result:

ok Accepted

Test #18:

score: 0
Accepted
time: 225ms
memory: 3648kb

input:

976
2
1
3
2
3
0
0
1
1
1
1
1
0
1
1
2
1
0
1
0
1
0
1
0
2
1
0
1
1
2
1
1
0
1
0
1
1
1
0
0
1
0
1
1
1
1
0
0
1
1
1
1
1
0
2
2
2
1
1
1
1
2
1
0
1
0
1
1
2
1
0
0
1
0
0
0
2
1
1
1
1
0
0
1
1
1
1
0
2
1
1
0
0
2
1
1
0
1
1
1
1
1
0
1
1
1
0
1
1
2
0
0
2
0
1
1
1
0
1
0
0
1
1
0
1
1
2
1
0
1
0
1
0
0
2
1
1
1
1
1
0
1
1
1
1
1
0
0
...

output:

0 657 767 357 840 422 544 691 825 415 65 25 894 136 272 846 122 903 97 331 425 903 295 603 44 131 943 809 857 156 217 406 846 79 810 931 531 107 691 524 44 117 876 391 934 522 429 749 827 454 589 125 967 173 479 702 41 775 21 232 824 215 213 81 31 596 718 754 944 676 467 497 828 385 303 467 239 750 ...

result:

ok Accepted

Test #19:

score: 0
Accepted
time: 261ms
memory: 3652kb

input:

977
0
1
0
0
1
1
0
1
0
2
1
1
1
1
0
1
1
2
1
1
2
1
0
2
1
1
1
0
2
1
1
0
1
0
1
1
1
0
1
0
1
1
1
0
0
1
0
1
1
2
1
0
2
1
0
1
1
1
1
1
0
2
2
1
1
1
1
1
1
1
1
1
0
1
0
2
2
2
1
0
0
1
1
1
0
1
0
0
1
1
0
0
2
0
1
0
0
1
0
1
1
2
1
0
0
0
1
1
0
1
0
1
1
0
2
1
1
1
1
1
1
1
1
2
1
0
2
1
0
2
2
1
0
0
0
0
1
1
0
1
0
2
2
1
1
1
1
1
...

output:

0 587 728 296 309 416 6 675 754 233 624 239 900 529 352 552 195 959 411 395 421 283 878 728 435 765 719 188 217 958 80 419 143 421 190 175 77 114 692 808 671 221 289 228 14 910 554 203 829 574 826 927 906 314 557 77 506 183 705 250 597 733 413 358 475 356 481 730 525 795 662 35 695 775 560 725 811 9...

result:

ok Accepted

Test #20:

score: 0
Accepted
time: 245ms
memory: 3712kb

input:

978
0
1
0
2
1
1
1
1
0
1
0
2
1
0
0
1
1
0
0
1
0
0
1
0
1
0
1
0
1
1
1
0
0
2
0
2
1
1
1
1
1
0
1
0
1
1
2
0
2
1
1
1
1
2
2
2
0
1
1
1
1
2
1
1
1
0
1
0
1
1
1
1
1
0
0
2
1
0
1
1
0
2
1
1
0
2
1
1
0
0
1
0
1
1
1
1
1
1
0
2
1
0
1
0
1
0
1
1
2
0
1
0
0
1
0
0
1
1
1
0
1
1
2
1
1
1
1
2
0
1
1
1
1
1
0
2
0
1
1
1
1
1
0
2
1
0
0
1
...

output:

0 229 331 561 35 24 903 898 156 580 366 565 818 936 646 2 449 807 323 185 507 796 525 814 501 870 733 956 652 318 786 793 905 181 836 772 265 978 579 422 201 156 399 294 287 696 596 399 76 561 721 912 599 74 450 957 143 838 505 205 361 130 360 897 550 188 360 78 445 821 369 334 652 319 774 765 869 6...

result:

ok Accepted

Test #21:

score: 0
Accepted
time: 280ms
memory: 3868kb

input:

979
1
2
2
2
2
0
1
0
0
1
0
2
0
1
1
1
1
2
1
0
1
0
2
0
1
0
1
0
1
0
1
0
1
1
1
0
0
0
1
1
2
2
2
2
1
1
1
1
1
1
2
1
0
1
0
1
1
0
0
2
2
1
1
0
0
1
0
1
0
1
1
1
1
1
1
0
1
0
0
1
1
0
1
1
1
0
0
2
1
0
1
0
0
1
1
0
2
1
1
2
2
0
2
2
0
1
1
2
1
0
1
0
1
0
1
0
0
1
0
2
1
0
0
1
1
1
1
1
1
2
2
0
2
1
1
1
1
1
0
1
1
2
2
1
0
1
1
2
...

output:

0 390 16 49 807 303 459 626 753 828 923 599 467 866 230 679 639 551 755 88 772 881 217 43 686 182 559 873 751 486 966 474 832 833 206 923 585 751 313 781 315 901 306 541 38 603 878 377 961 458 647 173 703 246 191 385 677 486 358 299 826 585 120 705 817 662 305 81 739 325 673 533 607 471 38 692 31 30...

result:

ok Accepted

Test #22:

score: 0
Accepted
time: 259ms
memory: 3744kb

input:

980
2
1
0
2
0
1
1
1
1
1
1
0
0
0
1
0
1
0
1
1
2
1
1
1
0
1
1
2
0
1
0
1
0
2
1
1
1
0
1
0
1
1
1
1
1
0
0
2
1
0
1
1
1
1
1
0
1
1
2
1
1
1
1
1
0
1
1
1
0
0
2
0
1
1
0
1
1
1
0
0
2
1
0
2
1
0
1
0
1
0
1
0
2
1
1
2
1
1
1
0
0
0
1
1
2
1
1
1
0
0
0
1
0
2
2
2
1
1
1
0
1
0
1
1
1
1
2
2
2
0
2
0
1
0
2
1
0
2
2
2
2
1
1
2
2
2
1
0
...

output:

0 714 35 541 170 228 314 199 320 729 255 293 305 857 124 644 242 493 219 688 314 277 828 259 712 616 919 14 282 555 152 599 494 661 979 289 544 831 655 219 660 402 495 757 919 970 942 711 962 718 303 530 146 762 109 708 80 67 33 721 28 122 367 390 122 133 458 550 713 269 428 889 652 331 548 597 843 ...

result:

ok Accepted

Test #23:

score: 0
Accepted
time: 253ms
memory: 3940kb

input:

981
3
2
0
1
1
2
0
1
0
1
0
0
1
1
1
0
1
0
0
1
0
1
0
1
0
1
1
0
1
1
0
2
0
2
1
0
2
0
1
0
0
0
0
1
0
0
0
2
1
0
0
0
1
0
1
1
2
2
1
1
2
1
1
2
1
0
1
0
0
0
0
1
1
1
1
0
2
2
2
0
0
0
0
1
1
0
1
0
2
2
1
1
0
0
2
0
1
0
1
0
1
0
1
1
0
0
1
0
1
1
2
0
2
0
1
1
2
1
1
2
2
2
0
0
0
2
1
1
2
0
2
2
1
1
1
0
2
0
1
0
1
1
0
1
1
2
2
0
...

output:

0 489 322 184 183 892 756 261 178 543 4 569 815 759 807 656 305 625 774 150 262 191 526 619 170 939 46 910 969 90 737 552 195 270 809 119 595 510 680 879 979 931 206 341 298 749 536 644 828 144 51 200 282 198 582 844 90 603 266 892 407 321 300 564 444 471 831 321 930 331 395 625 968 717 382 197 744 ...

result:

ok Accepted

Test #24:

score: 0
Accepted
time: 263ms
memory: 3660kb

input:

982
0
0
2
0
2
0
2
0
1
1
2
1
0
1
1
2
1
1
2
0
0
1
1
1
1
2
2
0
1
1
2
1
0
2
1
0
0
2
0
0
2
2
1
1
1
0
2
0
1
0
0
0
1
0
1
0
2
0
1
1
1
0
1
1
2
0
2
0
0
0
0
1
0
0
1
0
2
0
1
0
0
1
0
1
0
1
1
1
0
1
1
1
1
0
1
0
2
1
0
0
2
2
1
0
0
0
1
0
1
1
0
1
0
0
0
0
0
1
1
1
1
2
2
0
2
1
0
2
2
0
0
0
0
0
1
0
1
0
0
2
2
1
1
2
2
2
2
1
...

output:

0 757 228 189 336 510 963 22 575 198 669 651 856 709 322 847 519 441 216 695 474 670 728 221 67 942 396 971 819 60 346 172 857 800 777 491 137 498 134 407 469 600 671 291 564 117 80 752 195 796 449 915 32 180 810 382 31 284 634 920 309 219 423 769 58 813 434 254 921 694 409 594 243 494 277 373 71 26...

result:

ok Accepted

Test #25:

score: 0
Accepted
time: 242ms
memory: 3748kb

input:

983
1
1
4
2
0
1
0
1
0
0
1
1
0
2
1
0
1
1
1
1
2
0
0
1
1
0
2
0
1
1
0
1
1
2
0
1
1
2
2
1
0
1
0
1
0
1
1
1
0
2
1
0
2
1
0
1
0
0
2
1
0
1
1
2
1
1
2
1
1
0
1
1
1
0
2
2
0
1
0
2
1
0
1
0
1
1
0
1
1
2
2
0
0
1
1
2
1
1
1
1
1
0
0
1
0
2
2
1
1
1
0
0
1
1
1
0
2
1
0
1
1
0
2
2
1
1
1
0
1
0
0
0
1
0
2
0
0
0
0
2
1
0
1
1
2
1
0
1
...

output:

0 667 925 177 901 844 541 931 578 16 836 435 612 115 812 644 527 860 964 868 311 560 82 695 489 965 720 977 515 285 738 251 524 884 727 542 13 715 851 50 597 850 822 516 175 708 24 680 365 915 132 108 359 421 876 78 647 633 225 622 593 373 439 542 85 701 816 903 210 193 59 55 677 793 57 713 506 777 ...

result:

ok Accepted

Test #26:

score: 0
Accepted
time: 264ms
memory: 3948kb

input:

984
1
1
1
0
1
1
0
0
1
0
1
0
1
1
1
1
1
0
1
1
2
2
2
1
0
1
1
1
0
0
1
1
2
1
1
0
0
0
2
0
1
1
1
1
1
0
2
2
1
1
1
0
1
0
1
1
0
1
1
1
1
2
2
1
1
1
1
0
2
1
0
2
1
1
2
1
0
2
1
0
0
0
1
1
1
1
1
0
1
1
2
2
2
1
1
2
1
1
1
1
0
2
2
0
0
0
0
2
1
1
2
1
0
2
0
2
0
1
1
1
0
0
2
1
0
1
0
1
0
2
0
1
0
2
0
1
1
1
1
1
0
2
1
0
1
1
1
1
...

output:

0 774 857 57 521 758 629 276 794 847 539 495 664 384 755 182 458 103 594 152 93 530 874 335 61 763 909 155 941 18 818 401 331 496 843 98 267 339 764 756 854 768 879 903 157 623 563 216 822 939 519 179 516 350 37 389 873 851 392 71 506 387 478 140 242 863 154 927 458 702 75 100 269 833 214 352 345 95...

result:

ok Accepted

Test #27:

score: 0
Accepted
time: 236ms
memory: 3780kb

input:

985
1
0
2
1
1
2
1
0
0
1
0
1
1
2
2
1
0
2
1
1
2
0
1
0
0
0
1
0
2
2
1
1
2
1
0
0
0
0
0
1
1
2
2
1
0
0
2
1
0
2
2
1
1
0
0
1
0
0
2
0
1
0
1
1
1
0
1
1
0
1
0
2
1
1
0
2
1
1
1
1
1
1
2
2
1
1
2
1
0
1
0
1
0
2
2
0
1
1
0
1
0
2
2
1
0
2
1
1
2
1
1
0
0
1
0
0
0
1
1
2
0
1
1
1
0
0
1
0
2
1
0
1
1
1
1
0
1
1
0
2
0
1
0
2
2
2
2
1
...

output:

0 244 149 681 984 253 431 71 518 370 551 665 486 558 732 448 805 377 86 93 269 554 30 415 612 589 985 917 268 430 343 6 250 255 908 637 853 823 141 394 148 352 240 656 351 936 261 670 985 245 844 716 427 732 530 167 673 799 171 616 30 907 480 714 654 919 141 346 39 438 118 172 808 257 117 179 464 15...

result:

ok Accepted

Test #28:

score: 0
Accepted
time: 245ms
memory: 3656kb

input:

986
1
1
2
1
1
0
1
0
1
0
2
2
1
1
2
2
1
0
0
0
2
2
1
1
1
1
0
2
1
0
1
1
0
1
1
2
0
0
2
1
0
1
0
1
1
0
1
1
2
1
1
1
1
1
1
1
1
0
0
1
1
1
0
0
0
1
0
1
0
1
1
1
1
1
0
2
0
1
0
1
0
2
1
1
1
0
1
0
2
1
0
1
0
0
0
2
1
0
1
1
1
0
1
1
1
1
1
1
1
0
0
2
1
1
0
1
0
0
1
1
2
0
0
0
2
0
2
1
0
0
1
1
1
0
2
1
0
1
1
1
1
0
0
0
2
1
1
1
...

output:

0 978 15 581 751 576 153 339 670 363 500 199 978 5 54 471 784 163 72 175 637 368 228 54 895 166 85 33 668 429 548 769 426 192 901 670 391 795 286 477 566 106 287 808 706 673 557 720 505 716 540 17 314 275 511 929 170 723 981 954 195 860 44 403 302 734 254 565 856 914 98 849 9 620 483 574 51 826 1 88...

result:

ok Accepted

Test #29:

score: 0
Accepted
time: 275ms
memory: 3688kb

input:

987
1
0
2
1
1
2
0
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
0
0
2
2
2
0
1
0
0
1
1
2
0
1
0
1
0
1
0
1
1
1
0
2
1
0
1
1
1
0
1
0
2
2
1
0
0
0
1
1
2
0
1
1
0
1
0
0
2
0
1
0
2
1
1
0
0
0
1
1
1
0
1
0
0
1
1
2
1
0
2
1
0
0
1
0
1
1
2
0
2
1
0
0
0
1
0
0
1
0
0
1
0
1
1
1
1
0
1
0
1
0
0
1
0
1
1
2
2
1
0
1
0
0
2
1
0
0
1
1
1
0
1
0
0
...

output:

0 818 109 151 478 839 928 614 367 199 514 116 616 72 443 455 954 133 13 419 481 957 281 698 38 729 371 624 10 759 84 123 389 835 517 273 257 788 935 748 794 693 903 974 922 193 50 772 983 111 475 657 643 118 455 350 407 698 694 549 224 201 523 806 320 472 430 931 182 206 354 333 223 931 660 898 398 ...

result:

ok Accepted

Test #30:

score: 0
Accepted
time: 263ms
memory: 3644kb

input:

988
1
0
2
1
0
2
0
2
1
0
2
1
0
1
0
1
0
2
0
0
1
0
2
1
0
0
1
1
1
1
1
1
1
1
0
1
0
1
1
2
2
1
1
1
1
1
1
2
0
1
0
2
1
1
2
2
2
1
0
2
0
1
0
2
0
1
0
2
2
1
1
1
0
2
1
0
0
1
0
1
1
1
1
1
0
0
2
1
1
2
0
2
0
0
1
0
1
1
1
0
0
1
0
1
1
2
0
0
0
2
0
0
1
1
2
1
1
2
1
0
0
0
1
1
1
0
0
1
1
0
0
1
1
1
1
2
0
1
0
2
1
0
1
1
0
0
1
1
...

output:

0 619 783 40 877 246 692 686 529 85 267 27 476 742 545 902 97 740 25 715 532 585 454 674 941 922 955 660 192 769 913 3 635 887 321 146 243 20 845 602 161 385 543 149 646 54 333 681 928 323 890 439 447 502 702 534 259 971 29 243 646 204 876 329 529 498 86 460 896 94 543 481 591 56 483 786 388 634 429...

result:

ok Accepted

Test #31:

score: 0
Accepted
time: 264ms
memory: 3640kb

input:

989
1
0
1
0
1
1
1
0
1
0
1
1
2
1
0
0
0
1
0
1
0
1
1
1
1
1
1
1
0
2
0
1
0
0
2
1
1
1
0
1
1
1
1
0
1
0
1
0
1
1
0
1
1
0
2
1
0
1
1
2
0
0
1
1
1
0
1
0
0
1
0
0
1
0
0
2
1
0
1
1
0
1
0
1
1
1
1
1
1
0
1
0
0
1
1
2
2
1
1
1
1
1
1
0
2
2
2
0
0
1
0
2
1
1
0
2
2
0
2
1
0
1
1
0
2
1
1
1
1
2
1
1
2
1
0
1
1
2
1
1
1
1
0
0
0
1
0
1
...

output:

0 479 443 399 221 322 575 422 40 851 66 488 154 831 627 305 571 14 255 559 228 139 119 220 43 313 930 681 107 651 820 705 581 942 816 502 562 442 106 772 121 379 871 519 26 305 188 698 677 495 713 231 606 260 96 409 111 225 729 713 830 177 434 428 800 375 508 441 659 463 121 442 99 549 505 892 68 45...

result:

ok Accepted

Test #32:

score: 0
Accepted
time: 254ms
memory: 3712kb

input:

990
2
1
0
0
1
0
0
2
0
1
1
1
1
1
1
2
1
1
1
0
1
0
2
0
1
0
2
0
1
0
0
0
1
1
1
1
2
2
0
1
0
0
2
0
1
0
0
0
1
1
0
0
2
2
0
1
0
2
1
0
2
0
0
1
0
2
1
0
2
1
0
2
1
1
1
1
0
2
0
1
0
1
1
0
1
0
2
1
1
1
1
2
0
0
1
1
0
2
1
1
1
1
1
1
0
2
0
1
1
0
1
1
1
0
1
0
1
0
1
0
1
1
0
1
0
0
2
1
0
1
0
2
0
1
0
2
1
1
2
0
1
1
1
1
1
1
0
2
...

output:

0 101 491 832 545 939 334 2 797 882 125 444 634 171 775 243 698 284 178 508 461 696 215 899 312 493 702 800 82 187 645 607 984 519 673 211 660 894 631 825 568 518 280 179 973 12 527 351 839 780 367 709 43 711 483 626 242 414 588 985 333 333 584 367 180 69 537 576 129 224 291 827 810 591 912 934 332 ...

result:

ok Accepted

Test #33:

score: 0
Accepted
time: 273ms
memory: 3708kb

input:

991
1
0
1
0
2
0
0
0
1
0
2
1
1
2
1
1
1
0
2
1
0
2
2
1
0
1
1
1
1
1
1
2
2
1
1
1
1
0
2
0
0
1
0
0
1
0
1
0
2
2
2
0
1
0
1
0
2
1
0
0
2
1
1
2
1
1
1
1
1
1
1
0
1
1
2
0
0
1
1
1
1
1
0
1
0
2
1
0
1
0
2
1
1
0
1
0
0
2
0
1
0
1
0
0
1
0
2
0
0
1
1
1
0
1
0
1
0
1
1
2
1
1
0
1
1
1
0
1
0
1
1
1
1
0
1
1
0
2
2
1
1
1
1
2
0
2
2
0
...

output:

0 55 829 958 93 252 170 552 592 631 959 132 89 457 934 969 865 671 332 720 435 634 598 400 404 368 435 206 736 371 159 864 276 758 737 140 62 42 185 824 384 247 228 780 201 973 528 948 832 46 849 650 984 290 388 25 867 822 352 396 199 450 718 251 648 746 58 892 48 97 870 359 586 430 294 340 864 420 ...

result:

ok Accepted

Test #34:

score: 0
Accepted
time: 262ms
memory: 3712kb

input:

992
0
2
1
1
1
1
1
1
1
1
2
1
0
2
0
2
0
2
0
1
0
0
1
0
0
0
1
1
1
0
1
1
0
1
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
2
1
1
2
2
2
1
1
2
2
0
2
1
1
1
0
1
1
1
1
2
1
0
1
0
1
1
1
0
0
1
1
1
1
1
1
1
1
0
2
2
0
0
1
1
1
1
0
1
0
2
0
2
1
1
1
0
1
1
0
0
2
2
2
0
0
2
0
1
1
1
0
1
1
1
0
2
2
0
2
0
1
0
0
2
2
2
1
0
1
1
0
1
0
2
2
1
1
...

output:

0 370 115 113 89 772 564 628 818 484 96 714 88 899 727 146 627 193 403 858 756 798 411 470 204 657 139 943 102 312 566 986 592 608 724 360 313 412 11 573 711 595 46 385 127 916 759 881 354 586 516 174 87 793 204 506 245 247 242 483 132 546 284 893 392 276 129 722 411 334 165 301 448 978 826 621 973 ...

result:

ok Accepted

Test #35:

score: 0
Accepted
time: 272ms
memory: 3708kb

input:

993
2
0
1
1
2
1
0
1
0
1
0
0
1
0
2
2
1
0
1
0
0
2
2
1
0
0
1
1
2
1
1
0
0
0
1
1
0
1
1
0
1
0
0
1
0
1
0
1
1
1
1
2
2
1
1
2
1
0
1
0
2
1
0
1
0
1
0
1
0
0
1
0
2
1
0
2
1
1
1
1
2
0
2
2
1
0
2
0
1
0
0
0
1
0
0
2
0
2
1
0
2
1
0
1
1
0
0
1
0
2
1
1
0
0
0
2
2
1
0
1
0
1
0
2
1
1
0
2
1
1
1
1
0
1
1
1
0
0
2
2
2
0
2
2
1
0
1
0
...

output:

0 366 690 741 85 749 9 14 753 829 500 521 15 78 923 760 758 647 288 702 534 37 241 893 509 547 65 760 370 892 618 551 584 446 59 23 45 303 238 660 480 39 361 209 179 614 865 954 437 437 348 138 105 10 796 94 57 940 26 723 247 553 843 957 793 706 446 570 917 860 269 598 341 659 752 985 782 332 310 72...

result:

ok Accepted

Test #36:

score: 0
Accepted
time: 258ms
memory: 3720kb

input:

994
0
1
1
2
1
0
1
1
1
1
0
0
1
1
0
2
0
2
0
2
0
1
0
1
0
2
2
1
0
2
0
1
0
0
1
0
2
1
1
2
1
0
0
1
1
0
1
0
0
1
0
1
0
0
0
0
1
0
0
1
1
0
1
0
1
0
1
0
0
1
1
1
0
2
1
1
2
2
1
1
1
0
2
2
0
1
0
1
1
2
1
0
1
0
1
1
0
0
1
1
1
0
1
0
1
1
1
0
1
1
2
0
0
2
0
1
0
2
1
1
2
2
0
0
0
2
1
0
0
1
1
1
1
1
1
1
0
0
2
1
0
1
1
1
1
2
1
0
...

output:

0 714 531 373 232 586 173 570 729 53 807 87 437 812 974 217 44 114 383 365 282 119 747 907 855 325 815 392 278 621 563 956 271 470 676 821 473 19 673 104 79 703 478 53 665 787 891 341 326 247 691 659 851 302 631 38 765 756 886 982 859 755 435 97 4 670 776 407 196 327 959 480 308 871 58 167 926 429 4...

result:

ok Accepted

Test #37:

score: 0
Accepted
time: 255ms
memory: 3868kb

input:

995
2
2
2
0
1
0
1
0
2
1
1
2
1
1
2
1
0
0
2
1
0
2
2
2
0
0
1
1
1
0
1
1
1
1
0
1
1
1
0
1
0
0
1
1
0
2
0
1
0
2
1
0
2
0
0
1
1
0
0
2
1
0
1
1
1
0
1
1
1
0
0
0
0
2
1
1
2
1
1
1
1
0
1
1
1
1
1
0
1
0
0
2
1
1
0
0
2
2
2
1
1
2
1
1
1
0
2
0
1
0
1
1
1
1
2
1
0
0
1
0
0
0
1
0
2
0
1
1
1
0
2
1
1
2
1
1
0
2
1
1
2
2
0
0
1
0
1
1
...

output:

0 721 937 623 893 544 948 238 254 428 705 879 749 483 111 506 813 359 111 152 658 119 908 352 152 463 799 282 686 275 939 542 409 698 286 815 452 118 653 239 672 461 625 705 323 223 485 747 260 723 156 778 911 807 315 740 124 780 620 238 788 233 679 188 425 531 163 976 253 945 371 580 409 279 707 92...

result:

ok Accepted

Test #38:

score: 0
Accepted
time: 279ms
memory: 3876kb

input:

996
1
1
1
2
0
0
1
1
1
1
1
1
1
0
1
0
1
1
2
0
0
0
1
1
1
0
2
1
1
2
0
0
1
0
2
1
1
0
1
0
1
0
2
0
1
1
1
0
0
1
0
1
0
2
2
1
0
0
1
0
0
1
1
2
2
2
1
1
1
0
1
1
0
0
1
0
0
1
1
2
2
0
1
0
0
0
1
1
1
1
1
0
2
2
1
1
1
1
1
1
0
2
1
0
1
1
1
0
2
0
1
1
2
1
0
1
0
1
1
1
0
1
0
2
1
1
0
1
1
1
0
1
0
1
1
2
1
0
2
0
1
0
2
2
1
1
1
0
...

output:

0 903 905 821 821 579 885 67 650 132 989 73 776 821 475 864 924 171 42 802 432 882 382 474 91 506 65 315 817 741 758 975 211 37 816 620 733 129 907 184 619 661 48 460 767 105 375 622 327 736 658 517 975 956 41 323 954 146 124 756 871 640 643 337 135 970 625 217 940 358 473 630 634 653 554 537 74 491...

result:

ok Accepted

Test #39:

score: 0
Accepted
time: 248ms
memory: 3868kb

input:

997
1
1
0
0
1
0
0
1
1
1
1
2
0
2
2
1
0
1
0
0
1
1
1
0
1
0
1
0
1
1
1
0
1
1
1
1
1
0
1
1
1
0
0
1
0
1
0
1
1
2
0
1
1
1
0
1
0
1
1
0
2
1
0
0
0
0
2
2
0
0
1
1
1
1
0
1
1
1
1
1
0
2
1
1
2
2
1
0
1
0
1
0
1
1
1
0
0
1
1
2
0
1
1
1
1
2
1
0
0
0
0
1
1
1
0
2
2
2
1
1
2
1
0
2
1
1
0
1
1
2
2
1
0
2
2
1
0
1
0
2
1
1
1
0
1
0
1
1
...

output:

0 520 747 245 101 58 562 822 857 390 780 500 633 932 337 549 103 936 65 380 884 709 206 399 327 136 639 431 699 576 428 276 23 467 168 251 730 27 955 259 843 990 156 896 185 911 478 912 248 73 529 954 28 760 751 953 872 136 280 648 558 978 706 78 110 518 550 379 225 804 27 371 103 177 99 469 916 221...

result:

ok Accepted

Test #40:

score: 0
Accepted
time: 264ms
memory: 3716kb

input:

998
0
0
1
1
1
0
1
0
1
0
0
1
0
1
1
1
1
1
0
0
1
1
2
2
1
0
0
2
1
0
2
2
0
1
1
2
0
0
1
1
1
1
1
0
1
1
1
0
1
0
0
0
1
0
1
0
0
0
1
0
1
0
0
1
1
1
1
1
0
0
2
1
0
0
1
1
1
1
0
0
1
0
0
0
1
1
1
0
0
0
2
1
1
1
1
1
0
0
2
2
0
0
1
0
2
0
1
0
1
1
1
1
2
0
1
1
2
1
1
1
0
1
1
0
1
1
2
1
1
1
0
1
1
2
1
0
1
0
2
1
1
1
1
1
1
2
1
1
...

output:

0 562 409 437 670 816 388 544 816 854 16 914 748 199 128 303 964 652 759 518 746 4 94 612 455 578 497 296 687 901 246 827 193 557 539 734 232 50 196 859 573 750 207 176 276 847 691 212 644 994 847 155 624 579 581 887 828 220 541 10 550 434 259 985 673 785 57 374 38 260 648 770 322 110 596 958 468 93...

result:

ok Accepted

Test #41:

score: 0
Accepted
time: 253ms
memory: 3704kb

input:

999
2
1
2
1
2
2
3
2
1
2
0
2
0
0
1
1
1
0
1
1
2
1
1
1
1
2
0
1
1
2
2
0
2
2
0
2
1
0
0
1
0
1
0
2
0
1
0
2
1
1
0
1
0
1
1
2
1
1
1
1
2
1
1
2
2
1
1
1
0
1
0
1
1
0
1
0
2
2
1
0
1
0
1
0
0
0
0
1
1
2
1
0
1
1
1
0
0
0
1
1
2
2
2
1
1
1
1
0
2
1
1
1
1
1
0
1
1
0
2
0
1
1
1
1
0
2
1
0
0
0
0
2
0
0
0
2
1
1
1
0
1
0
0
1
1
1
1
1
...

output:

0 152 594 129 248 820 108 167 917 945 850 621 785 967 466 891 101 211 414 90 796 434 436 629 262 667 902 273 821 807 454 334 826 13 117 701 905 713 848 152 812 264 561 305 995 294 502 180 278 870 525 169 502 254 201 218 388 657 112 172 8 39 591 91 255 781 277 142 989 346 582 517 921 321 236 965 325 ...

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed