QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#251183 | #3042. Hilbert's Hotel | S00021 | AC ✓ | 129ms | 37244kb | C++14 | 1.9kb | 2023-11-14 12:37:37 | 2023-11-14 12:37:38 |
Judging History
answer
#include<bits/stdc++.h>
#define N 500005
#define int long long
#define pb push_back
#define fi first
#define se second
#define pii pair<int,int>
#define MP make_pair
#define M 1000000007
#define ls (rt<<1)
#define rs (rt<<1|1)
using namespace std;
int Q; multiset<int>st;
struct SGT{
int tag1[N<<3],tag2[N<<3];
void build(int rt,int l,int r){
tag1[rt]=1,tag2[rt]=0; if(l==r) return;
int md=(l+r)>>1; build(ls,l,md),build(rs,md+1,r);
}void upd(int rt,int d0,int d1){
(tag1[rt]*=d0)%=M,(tag2[rt]*=d0)%=M,(tag2[rt]+=d1)%=M;
}void pd(int rt){
upd(ls,tag1[rt],tag2[rt]);
upd(rs,tag1[rt],tag2[rt]); tag1[rt]=1,tag2[rt]=0;
}void modf(int rt,int l,int r,int L,int R,int d0,int d1){ if(L>R) return;
if(L<=l&&r<=R){upd(rt,d0,d1); return;} int md=(l+r)>>1; pd(rt);
if(L<=md) modf(ls,l,md,L,R,d0,d1); if(R>md) modf(rs,md+1,r,L,R,d0,d1);
}int ask(int rt,int l,int r,int x,int t){
if(l==r) return (t*tag1[rt]%M+tag2[rt])%M; int md=(l+r)>>1; pd(rt);
if(x<=md) return ask(ls,l,md,x,t); else return ask(rs,md+1,r,x,t);}
}T; int n,l0[N],l1[N],sum[N],cn,id[N];
signed main(){
scanf("%lld",&n),T.build(1,0,n);
for(int i=1;i<=n;i++){
int op,x,k; scanf("%lld",&op);
l0[i]=l0[i-1],l1[i]=l1[i-1],sum[i]=sum[i-1];
if(op==1){ id[i]=(++cn);
scanf("%lld",&k); if(k){
T.modf(1,0,n,0,cn-1,1,k);
T.modf(1,0,n,cn,cn,1,0),l1[i]=i;
}else{
T.modf(1,0,n,0,cn-1,2,0);
T.modf(1,0,n,cn,cn,2,1),l0[i]=i; } sum[i]+=k;
}if(op==2) scanf("%lld%lld",&x,&k),printf("%lld\n",T.ask(1,0,n,x,k-1));
if(op==3){ scanf("%lld",&x);
int po=i; while(1){
if(po<=0){puts("0"); break;}
if(x==0){printf("%lld\n",id[l1[po]]); break;}
if(sum[po]-sum[l0[po]]>x){
int t=lower_bound(sum+l0[po]+1,sum+po+1,sum[po]-x)-sum;
printf("%lld\n",id[t]); break;
}else{ x-=(sum[po]-sum[l0[po]]);
if(x&1){printf("%lld\n",id[l0[po]]); break;} x>>=1,po=l0[po]-1;
}}
}
}return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 8060kb
input:
10 3 0 1 3 2 1 2 1 0 3 10 2 2 5 1 5 1 0 3 5 2 3 3
output:
0 1 0 9 4 4
result:
ok 6 lines
Test #2:
score: 0
Accepted
time: 1ms
memory: 8064kb
input:
16 2 0 8 2 0 4 3 7 3 5 2 0 8 3 6 1 0 3 8 2 0 2 1 2 2 2 1 2 2 1 1 6 1 1 3 4 2 3 2
output:
7 3 0 0 7 0 0 2 0 0 3 2
result:
ok 12 lines
Test #3:
score: 0
Accepted
time: 1ms
memory: 8016kb
input:
11 2 0 8 3 9 1 5 2 0 10 2 0 5 1 0 3 9 2 2 7 2 2 3 3 0 1 0
output:
7 0 14 9 2 13 5 1
result:
ok 8 lines
Test #4:
score: 0
Accepted
time: 1ms
memory: 7976kb
input:
20 1 0 3 1 2 0 4 2 0 7 1 0 3 8 1 0 2 3 7 3 4 2 3 4 3 1 3 8 1 0 2 4 5 1 9 3 2 3 3 3 2 1 7 1 0
output:
1 6 12 0 13 1 7 3 0 9 5 5 5
result:
ok 13 lines
Test #5:
score: 0
Accepted
time: 1ms
memory: 7904kb
input:
11 1 0 2 0 4 2 0 9 1 1 1 9 1 4 2 0 8 2 4 3 2 1 3 1 2 2 3 6
output:
6 16 28 2 19 11
result:
ok 6 lines
Test #6:
score: 0
Accepted
time: 1ms
memory: 7868kb
input:
20 2 0 9 2 0 9 1 0 3 6 1 9 2 0 10 2 1 10 3 7 3 5 1 0 2 1 1 2 1 5 1 7 2 3 3 2 2 2 1 8 1 4 1 0 1 0 2 5 2
output:
8 8 0 27 28 2 2 20 36 12 9 20
result:
ok 12 lines
Test #7:
score: 0
Accepted
time: 1ms
memory: 7972kb
input:
15 2 0 4 3 4 1 0 2 1 7 3 10 1 0 1 0 2 1 1 2 1 2 2 2 5 1 0 2 2 10 1 0 2 1 6 1 0
output:
3 0 13 0 4 12 18 76 176
result:
ok 9 lines
Test #8:
score: 0
Accepted
time: 1ms
memory: 7988kb
input:
13 1 2 1 2 3 3 2 0 6 3 8 2 0 3 2 2 2 3 8 2 1 2 1 4 1 0 1 4 1 0
output:
1 9 0 6 1 0 3
result:
ok 7 lines
Test #9:
score: 0
Accepted
time: 1ms
memory: 7908kb
input:
11 3 4 2 0 9 3 9 1 0 3 5 1 0 2 0 8 2 0 9 2 2 3 3 6 2 0 9
output:
0 8 0 1 28 32 5 1 32
result:
ok 9 lines
Test #10:
score: 0
Accepted
time: 1ms
memory: 7972kb
input:
13 3 6 1 0 1 7 3 4 3 1 2 0 8 1 9 1 9 1 5 3 10 3 10 2 4 6 2 3 9
output:
0 2 2 21 4 4 10 22
result:
ok 8 lines
Test #11:
score: 0
Accepted
time: 1ms
memory: 7868kb
input:
17 3 10 3 0 2 0 7 3 3 2 0 9 1 0 2 0 7 2 0 10 2 0 6 2 1 4 1 0 1 0 3 7 2 1 2 3 3 1 9 3 5
output:
0 0 6 0 8 12 18 10 7 3 12 3 4
result:
ok 13 lines
Test #12:
score: 0
Accepted
time: 0ms
memory: 7908kb
input:
18 1 0 3 3 1 4 2 2 3 2 2 4 2 2 2 2 0 10 3 3 3 1 3 9 1 0 1 1 1 9 3 4 1 9 2 4 1 3 0 3 6
output:
1 2 3 1 22 2 2 1 5 18 6 6
result:
ok 12 lines
Test #13:
score: 0
Accepted
time: 0ms
memory: 8084kb
input:
990 3 613 3 983 3 529 2 0 4 2 0 8 3 352 3 136 2 0 1 2 0 6 3 144 3 936 1 7 3 102 2 0 3 2 0 4 1 0 2 0 10 3 381 3 200 2 2 4 1 6 3 251 1 9 2 4 5 1 3 2 3 6 2 1 4 3 65 2 2 6 2 2 4 3 934 2 3 6 2 3 3 2 2 10 2 1 2 2 5 3 3 618 3 996 3 335 3 268 2 3 6 1 5 1 5 2 4 7 1 6 1 5 3 347 3 646 1 3 1 6 2 8 1 3 845 1 7 3...
output:
0 0 0 3 7 0 0 0 5 0 0 0 9 10 32 2 0 7 2 4 17 24 2 29 25 0 17 14 37 20 2 0 0 2 0 17 19 0 2 14 2 2 2 17 3 109 4 195 30 28 54 24 24 24 8 0 3 368 24 17 24 1561 39 1369 24 28 875 103 28 219 20 74 234 28 26 28 28 379 742 28 56 26 1064 28 28 28 35 1288 426 18 28 1642 2 117 1049 819 44 19 26 44 28 24 3370 4...
result:
ok 652 lines
Test #14:
score: 0
Accepted
time: 1ms
memory: 8092kb
input:
942 1 0 3 671 3 788 1 4 3 146 2 0 9 2 2 3 3 130 3 343 3 783 1 10 3 36 1 9 2 1 7 1 0 3 85 2 4 3 2 5 3 2 5 9 1 0 2 0 9 3 913 2 1 8 2 2 4 3 164 1 6 2 5 7 1 6 3 628 1 3 2 1 6 1 7 1 0 3 545 3 319 3 551 3 672 3 464 3 680 3 670 2 11 3 2 6 7 2 4 8 3 535 1 9 3 394 2 9 2 1 0 2 7 6 1 10 1 0 2 1 2 1 0 2 2 4 2 3...
output:
1 0 0 20 2 0 1 1 0 36 5 4 5 17 156 6 152 88 0 32 1 151 11 11 11 5 5 5 6 5 70 100 11 11 25 102 1064 1872 1040 2774 220 19 669 413 27 19 20 4413 19 19 16 33 19 22 696 15 1403 19 19 130 28 197 1877 19 19 19 360 31 33 35 16 35 1703 855 423 35 2180 38 3 162 162 14182 4774 40 130406 40 3174 13 40 40 40 38...
result:
ok 607 lines
Test #15:
score: 0
Accepted
time: 1ms
memory: 7932kb
input:
904 3 946 3 64 3 559 3 380 1 4 1 0 3 555 1 7 1 9 3 319 2 4 3 1 2 1 0 3 104 1 2 1 4 1 9 2 3 5 2 9 9 2 7 2 2 7 2 1 7 1 1 2 1 1 3 180 3 687 1 2 2 11 1 3 785 1 10 1 5 2 1 4 3 758 3 275 3 182 2 12 2 2 6 4 2 14 5 3 718 3 356 1 4 2 5 2 1 1 2 13 3 2 16 1 1 5 1 6 2 6 1 3 573 2 14 1 1 3 2 19 2 3 211 2 8 4 3 2...
output:
0 0 0 0 2 2 2 0 45 8 14 14 59 6 0 2 0 88 2 6 2 16 47 4 2 0 46 12 0 57 6 16 1 0 56 14 85 87 27 2 58 39 6 6 2 22 6 89 6 1 0 42 280 29 618 30 2 487 1183 25 8 134 30 22 1070 30 30 22 30 255 29 30 820 22 313 1481 20 43 43 40 4252 39 30 43 6498 1218 43 46 15316 3476 2772 26 70 43 836 46 40 43 46 14164 39 ...
result:
ok 609 lines
Test #16:
score: 0
Accepted
time: 1ms
memory: 7896kb
input:
935 1 4 2 0 2 1 3 2 1 3 3 61 2 2 3 1 5 1 3 2 0 9 2 1 1 2 4 2 2 2 3 2 1 3 3 430 1 2 3 517 1 8 1 7 1 0 1 2 2 3 1 3 744 2 0 7 3 413 2 5 1 1 0 2 6 8 1 6 3 61 3 718 1 0 3 387 2 9 1 2 11 5 3 987 2 9 2 3 723 2 0 5 3 362 2 2 1 3 887 3 311 1 1 1 4 1 7 3 279 3 374 1 2 3 787 3 374 3 803 3 212 1 10 1 1 1 2 1 0 ...
output:
5 5 0 2 23 11 1 10 13 0 0 42 0 78 8 32 60 10 0 12 12 8 12 16 12 308 10 220 12 12 12 10 12 8 12 10 166 98 654 206 20 286 8 10 7 102 74 24 24 20 587 94 24 1137 24 13 1 24 34 6 31 35 17 24 8 24 137 31 38 31 23 93 121 31 31 38 24 2247 24 24 39 7 31 1929 161 71 22 227 185 177 101 57 12 931 31 31 31 26 46...
result:
ok 613 lines
Test #17:
score: 0
Accepted
time: 0ms
memory: 7932kb
input:
999 3 86 3 146 3 588 3 62 3 143 3 85 2 0 5 2 0 4 3 678 1 9 3 500 1 2 1 0 3 835 1 8 1 3 1 10 2 2 1 1 5 3 154 1 8 2 6 6 3 463 3 782 2 4 3 1 7 3 995 2 7 4 1 3 3 546 1 0 1 0 2 9 3 2 0 5 3 356 3 361 2 1 5 3 948 2 6 9 2 9 1 1 8 3 445 2 2 1 1 8 3 41 2 9 2 2 13 1 3 98 2 0 4 3 184 3 44 1 6 3 413 3 602 1 7 2 ...
output:
0 0 0 0 0 0 4 3 0 0 3 21 0 18 3 0 28 0 18 0 20 296 3 12 224 3 124 12 12 184 12 32 8 11 304 4 9 12 3 161 18 0 22 25 12 1 244 11 39 232 12 33 0 6 682 11 482 14 12 21 273 83 17 17 21 21 12 15 21 12 5 170 860 36 36 21 64 37 2744 156 26 21 264 32 36 2872 36 36 37 16 37 2 2198 37 21 317 369 37 41 21 21 30...
result:
ok 656 lines
Test #18:
score: 0
Accepted
time: 1ms
memory: 7952kb
input:
951 3 497 2 0 10 2 0 9 3 250 1 6 3 887 1 1 2 0 8 2 1 4 3 711 2 2 1 3 194 3 314 2 0 3 2 1 6 2 2 1 1 8 3 355 1 6 3 650 2 0 1 1 9 2 3 7 1 10 3 775 2 1 5 3 463 3 476 2 1 6 2 2 1 1 8 3 797 2 6 9 2 1 4 2 3 5 1 3 1 0 1 6 3 783 2 1 5 3 908 1 0 1 3 1 1 2 11 5 2 13 1 2 10 5 1 5 1 4 1 7 1 1 2 0 4 1 0 1 7 3 465...
output:
0 9 8 0 0 14 4 0 0 0 0 9 6 0 0 0 21 21 0 38 0 0 39 33 0 16 45 37 9 104 0 13 0 12 249 1 18 18 560 60 44 11 643 18 70 302 9 22 11 539 923 1115 155 7 29 1501 1565 205 9 29 29 163 347 29 22 102 17 1074 85 29 29 633 25 777 1 634 18 39 29 410 1522 47 489 39 362 1582 47 2256 47 750 39 62 39 34 2265 59 358 ...
result:
ok 611 lines
Test #19:
score: 0
Accepted
time: 0ms
memory: 8084kb
input:
913 3 715 2 0 5 3 302 1 2 2 0 1 2 1 2 1 3 1 6 2 1 2 1 1 2 1 1 2 2 1 3 14 3 729 2 2 2 2 2 3 2 1 1 3 732 3 516 1 9 1 7 2 6 1 2 3 5 3 255 3 303 3 27 3 747 2 1 1 1 3 1 7 2 0 4 3 2 2 6 2 3 178 1 9 1 0 1 7 1 3 1 1 1 7 3 364 1 0 2 0 8 3 513 1 9 1 4 3 902 1 4 2 13 1 3 801 2 2 1 3 329 1 10 3 958 3 320 3 984 ...
output:
0 4 0 2 1 10 10 7 0 0 8 9 10 0 0 0 21 0 0 1 0 26 41 8 11 0 0 252 15 15 31 0 221 0 15 15 15 43 15 0 83 9 15 23 23 23 23 824 239 15 79 95 925 40 915 936 23 850 56 19 21 37 37 21 54 37 2197 13 597 209 37 103 195 23 23 140 35 668 500 1708 91 14 196 2550 37 686 53 39 31 489 53 349 401 23 285 470 46 56 91...
result:
ok 602 lines
Test #20:
score: 0
Accepted
time: 1ms
memory: 8008kb
input:
977 3 637 3 620 3 388 1 0 2 0 7 2 1 1 3 989 3 446 1 0 3 987 3 20 1 6 3 241 1 7 1 6 1 2 2 3 4 3 400 2 5 2 1 6 1 9 3 758 3 657 2 0 10 3 772 3 601 2 5 1 2 7 3 3 327 3 51 2 2 3 3 314 3 609 1 3 1 8 2 7 3 1 0 1 0 3 782 3 667 3 953 3 292 1 4 1 5 1 8 1 4 3 431 1 3 1 10 3 464 1 7 1 7 1 0 1 4 1 5 2 3 5 3 713 ...
output:
0 0 0 12 1 1 0 2 0 2 18 2 3 1 2 72 0 2 17 11 2 2 41 1 2 22 11 12 12 1 11 11 465 2 11 11 1348 26 31 448 4754 31 31 1493 853 269 1365 28 28 31 31 719 3168 31 21 258 10 986 98 4724 21 2744 31 717 3973 28 649 31 31 31 1028 47 78 31 205 42 28 26 81 77 51 211 3551 1439 26 8 51 127 6 51 51 51 51 187 28 51 ...
result:
ok 626 lines
Test #21:
score: 0
Accepted
time: 1ms
memory: 7996kb
input:
940 1 6 3 869 1 3 3 579 2 0 4 2 1 5 3 443 3 460 1 4 3 715 3 42 2 0 5 1 5 2 0 2 1 7 3 260 1 9 2 3 3 3 502 1 8 3 420 1 4 3 676 3 54 1 0 1 6 2 2 3 2 6 8 2 4 4 3 192 3 470 2 1 6 3 663 2 6 6 2 2 1 2 8 1 3 205 3 193 3 840 1 3 2 0 1 3 616 2 0 4 1 0 3 3 2 8 2 3 440 2 7 4 3 320 3 683 2 5 7 1 3 1 10 2 5 6 3 8...
output:
0 0 12 7 0 0 0 0 17 19 0 23 0 0 0 0 84 44 68 0 0 96 9 40 80 6 9 9 0 101 9 107 12 22 9 46 9 12 126 135 12 58 14 15 15 12 61 54 18 18 18 18 18 17 18 44 17 19 18 18 28 12 17 17 18 9 17 273 18 18 388 18 47 18 17 18 8 15 90 159 18 34 139 53 18 15 34 161 34 100 76 74 2708 18 857 34 34 35 34 417 7 2593 34 ...
result:
ok 644 lines
Test #22:
score: 0
Accepted
time: 1ms
memory: 7948kb
input:
988 2 0 1 3 374 1 0 3 649 2 1 2 1 2 2 0 8 3 543 3 318 1 7 3 228 2 0 5 3 114 2 2 2 3 661 2 0 3 2 1 1 2 3 5 3 275 2 0 8 2 3 7 2 0 10 3 384 3 250 2 0 8 2 3 7 2 2 1 1 0 1 9 1 2 3 536 1 0 1 6 3 777 1 10 2 3 7 2 9 6 3 85 2 1 8 1 10 1 0 2 10 5 1 6 3 155 1 8 3 467 2 3 7 1 7 3 908 2 14 4 1 1 3 176 2 12 4 2 2...
output:
0 0 1 3 16 1 0 1 17 1 8 0 13 10 4 0 23 6 27 1 1 23 6 7 4 7 62 5 7 134 8 11 11 158 11 3 7 19 174 5 158 11 1 28 212 184 7 99 603 27 27 161 28 16 367 36 750 78 13 17 1086 36 1262 28 518 1566 28 30 28 1892 27 36 1288 28 28 2028 25 68 48 1384 28 36 216 36 54 1426 34 36 226 738 0 19 13 28 32 1088 15 234 3...
result:
ok 687 lines
Test #23:
score: 0
Accepted
time: 108ms
memory: 34924kb
input:
285800 1 589 2 1 115 2 1 226 2 1 514 2 1 456 3 629709122 1 619 2 2 192 3 459147753 1 38 2 2 576 2 3 8 3 201981823 3 524189144 2 3 32 1 56 2 4 20 3 214735859 1 890 2 5 636 3 478695264 3 460825804 2 5 103 3 952035202 2 0 286 1 525 1 288 1 957 2 0 618 3 735607495 2 1 93 2 1 286 1 985 2 9 663 1 683 2 2 ...
output:
114 225 513 455 0 191 0 613 7 0 0 31 19 0 635 0 0 102 0 2477 4579 0 3465 3658 662 5004 5531 0 0 0 6085 6160 6201 2926 0 0 0 4574 2946 0 17 12920 16648 11235 17 0 7809 17 17 0 13273 0 17 17 0 0 10365 1695 0 0 0 40360 0 50264 26 26 46388 279 51921 26 35101 0 17 26 3285 26 39483 26 17 26 2946 1358 26 1...
result:
ok 190990 lines
Test #24:
score: 0
Accepted
time: 101ms
memory: 35176kb
input:
291729 1 894 1 890 3 802126177 3 272286217 1 0 2 1 374 3 891152646 1 820 2 2 147 1 310 3 46206280 2 4 808 3 18706394 2 1 331 3 664920704 2 1 654 2 0 748 3 192123924 3 708982947 3 220679626 3 704888628 1 160 3 964332875 3 169548294 3 662085712 3 515358639 3 958291113 3 383486479 2 4 124 1 392 1 239 3...
output:
0 0 2526 0 1112 0 1117 0 3570 0 4216 6192 0 3 0 0 3 0 0 3 3 3 593 3 0 0 5 1897 0 0 0 0 0 3 3 2150 6351 1428 3 5329 3 3 3489 0 3 8227 0 2160 0 5477 0 0 3 3 82 20 20 3 20 0 20 4751 238 13901 12751 20 20 12981 20 10553 3 8989 0 1960 0 6055 20 168 20 16079 20 0 20 20 0 20 5514 20 7175 20 3794 0 25384 22...
result:
ok 194496 lines
Test #25:
score: 0
Accepted
time: 97ms
memory: 33676kb
input:
284878 1 658 1 878 1 399 2 0 139 1 36 2 2 769 1 823 2 3 335 3 383102579 1 735 2 2 460 3 907616047 3 165176802 2 1 219 3 425702053 3 428981593 1 721 2 0 39 3 727162062 1 477 1 311 2 2 562 3 451950835 3 65057699 1 710 1 712 2 6 339 3 7344432 2 2 628 1 75 1 978 3 19967679 1 97 1 402 3 160663473 1 702 3...
output:
2073 1203 1193 0 2452 0 0 3089 0 0 4288 0 4063 0 0 3269 0 5551 0 0 0 2502 0 6753 6868 5339 0 3156 0 4021 833 1931 0 1400 92 2825 8558 85 0 0 0 0 0 0 5908 0 0 0 0 10790 0 8549 2276 3721 0 0 0 7722 0 0 7467 0 12167 0 9930 32 32 26552 0 32 0 32 0 28113 32 9559 0 1385 2315 32 0 32 0 9841 22878 0 0 2384 ...
result:
ok 189957 lines
Test #26:
score: 0
Accepted
time: 105ms
memory: 34980kb
input:
294009 3 967557698 1 914 1 302 3 745869808 3 990025222 1 998 1 310 3 173316754 2 2 134 2 1 212 2 0 3 3 974856036 2 1 306 1 176 1 252 3 469723561 3 809790361 3 131203832 2 5 114 2 3 329 2 3 627 3 609236246 2 0 80 1 788 1 961 3 223398965 1 899 2 2 45 1 466 3 857489318 2 6 103 1 686 3 717426508 3 18954...
output:
0 0 0 0 1441 1821 2526 0 1915 0 0 0 365 1066 1364 0 3031 0 4428 0 3216 0 0 0 398 0 6193 2152 0 0 2796 1130 22440 22752 17 14 17 17 20 52796 17 20 26469 17 85466 4846 25 265216 13200 25 25 23 37377 4096 31 26510 3605 1285727 107572 31 848500 566772 773492 31 31 34429 31 75261 23 31 31 31 31 31 917779...
result:
ok 196252 lines
Test #27:
score: 0
Accepted
time: 109ms
memory: 34960kb
input:
282562 2 0 74 3 17540587 3 68688373 2 0 562 3 593200593 1 850 3 850964180 2 1 606 1 849 2 0 994 1 793 1 8 1 19 2 3 285 1 936 1 945 3 897195209 3 689162617 3 432243973 2 6 597 3 513148040 2 7 575 2 6 501 2 4 5 1 481 2 0 437 2 7 835 3 782722001 1 974 2 1 271 1 109 1 0 2 3 151 1 250 2 12 5 3 569019713 ...
output:
73 0 0 561 0 0 605 2692 311 0 0 0 1541 0 574 1445 1904 5317 1315 0 5275 7244 4 11 11 1436 11 11 14588 740 0 11 0 10972 1766 0 0 3085 161 10732 9200 11 10107 11 11 14370 3175 14801 3459 0 17134 3199 0 15506 12506 0 6631 4229 11 20505 0 11 11 0 11 12943 8697 11 17509 11 11 7739 0 11 11 37 18529 37 0 2...
result:
ok 188785 lines
Test #28:
score: 0
Accepted
time: 112ms
memory: 34984kb
input:
293374 1 225 3 447206486 2 0 878 1 827 1 194 3 390633943 3 360374143 3 637018590 3 951750234 1 0 2 3 71 3 526531042 1 66 1 835 2 1 225 1 0 3 531166748 3 609646428 2 6 825 3 281460658 2 4 438 3 722590971 3 436988302 3 107135791 1 449 2 4 953 1 404 1 733 1 380 2 0 436 1 837 3 747811327 2 9 264 3 61480...
output:
0 1102 0 0 0 0 140 0 3391 4 4 1648 0 3552 7 0 7 6061 10492 4 2213 0 4527 0 245 0 343 7 117 15 1511 15 0 4004 7 4 9 3525 21453 15 15 12821 17064 7377 15 1689 4 4 3852 7 2118 4 9620 9033 922 15 3760 15 30716 15 7 7 7 22041 15 15 15 11411 15 15 15 27735 30127 15049 51 15 16227 85699 12952 35104 51 1912...
result:
ok 195658 lines
Test #29:
score: 0
Accepted
time: 115ms
memory: 33832kb
input:
287143 3 402401437 2 0 394 1 93 3 644955565 1 606 2 0 840 3 697316701 1 657 3 482937747 3 844029157 2 1 54 2 0 669 3 162399854 2 2 461 2 1 88 1 62 1 490 2 3 359 1 320 1 348 2 3 396 1 391 1 486 2 0 984 3 126661122 2 8 116 1 774 2 4 24 3 366371654 3 695192494 1 86 3 885892130 3 860516461 2 11 64 3 794...
output:
0 393 0 1538 0 0 0 1316 2024 0 1117 1350 910 1615 4436 0 601 2832 0 0 0 0 63 0 0 2037 0 0 1963 0 0 0 0 5519 0 0 1531 0 0 5606 67 0 1731 0 2161 0 209 0 0 23 0 0 23 9671 0 17149 2963 180 27 27 27 27 27 26210 14411 29911 27 27 27 4290 8483 39631 3087 23 27 23 48604 23 8258 4853 4436 19235 27 28691 27 4...
result:
ok 191311 lines
Test #30:
score: 0
Accepted
time: 103ms
memory: 36996kb
input:
282111 3 312193607 2 0 560 1 664 3 4141348 1 107 2 2 89 1 196 3 224802799 1 0 3 513505207 3 258517554 1 722 2 2 4 2 4 17 3 333760602 2 0 701 2 3 103 2 3 71 1 48 1 44 3 342943369 2 7 19 2 7 35 3 567363618 3 536126078 1 85 2 5 170 1 810 3 453599856 3 701607165 2 5 49 3 498442155 1 374 2 8 60 2 1 341 1...
output:
0 559 0 88 0 4 0 1120 755 0 4056 926 862 4 18 34 0 0 346 4 0 1035 0 1243 3369 39 0 4 0 970 2424 0 4 2354 4 3211 5151 4 4 3587 21 20 7086 19966 21 21802 21 5017 15057 1816 3397 21 20 4 21 21 21 2729 21 2933 0 21 20 21 10428 21 3295 0 4 21 21 25631 21111 26215 996 10063 9219 21 21 21 21 21 20 4 0 1514...
result:
ok 188398 lines
Test #31:
score: 0
Accepted
time: 105ms
memory: 35128kb
input:
292901 1 701 3 91197427 2 1 626 3 434122436 1 175 1 22 1 369 2 3 12 2 3 22 2 2 58 1 566 3 417019594 2 3 3 1 110 3 213369210 1 921 1 483 1 597 2 4 169 1 415 1 847 3 297474705 1 301 1 2 1 762 2 14 724 2 12 187 2 8 20 2 7 549 2 10 237 3 503174622 2 2 14 3 51110086 1 864 3 433753526 2 15 237 1 650 1 249...
output:
0 625 0 380 390 448 0 937 0 2845 0 723 950 2943 3955 2148 0 5408 0 0 236 0 0 3206 642 0 0 0 2682 0 0 9010 0 2282 0 0 0 21466 25 25 6562 28 25 27 0 98931 0 54836 6658 58908 8500 28 73978 6 28 71625 28 8205 28 28 14171 93123 36939 6101 839 57203 27 5084 28 28 27657 30065 44 36394 28 2742 25 44 5284 44...
result:
ok 195292 lines
Test #32:
score: 0
Accepted
time: 96ms
memory: 36280kb
input:
285160 2 0 430 2 0 118 2 0 314 3 519690597 1 0 2 1 398 3 488819169 2 1 167 1 230 3 987277461 3 536897357 2 1 256 1 222 1 356 2 0 142 3 51827303 1 0 3 727040389 2 1 682 3 805524180 1 582 3 151359420 1 594 2 2 121 2 5 151 3 973152736 3 490971920 2 6 304 3 637107033 3 118697284 3 411400129 1 772 3 7126...
output:
429 117 313 0 795 1 333 1 1 741 1090 1 5 4342 0 1 2572 1477 0 0 897 5 0 5 0 1 5044 2848 565 1471 2200 3218 1988 5 1 5 5 8241 4351 6409 3989 5591 3792 5 2656 1 1 1 5546 5 0 4195 2962 9120 6462 5 5099 2980 1373 4367 3113 5 738 2103 7869 750 0 2342 2297 5 0 5 5 5984 1677 0 22 8939 1 9149 11004 10207 1 ...
result:
ok 189971 lines
Test #33:
score: 0
Accepted
time: 122ms
memory: 35888kb
input:
300000 2 0 206645902 3 636812873 1 997512702 2 0 239322423 2 0 504136008 2 1 804093075 3 371921677 2 0 328983963 1 283098207 3 348255721 2 0 11511005 2 0 520395076 3 984652715 1 705801389 2 0 739168623 1 92371913 3 808770816 3 281469617 2 2 129064647 1 664544935 2 2 255494310 1 65295784 1 666122355 ...
output:
206645901 0 236835117 501648702 804093074 1 326496657 1 292121906 801005977 1 725580906 2 3 927237948 718212539 649988257 9 8 10 267718588 10 10 693418111 14 918955204 15 776439118 513296405 16 16 573290907 19 280956541 458991884 129863464 22 22 21 216009995 856387310 114184303 228372748 663503951 8...
result:
ok 199761 lines
Test #34:
score: 0
Accepted
time: 121ms
memory: 35040kb
input:
300000 2 0 120279522 3 350149205 2 0 390226062 3 984974390 1 175531397 3 522290584 3 272836570 3 361541789 1 864564256 3 515741840 2 1 81980960 1 97952445 1 789323372 2 1 16283106 2 4 103627583 2 0 220863137 3 100436006 3 75300432 3 742403730 1 9918517 3 394132489 3 909010525 2 5 9549632 2 1 1270131...
output:
120279521 0 390226061 0 0 0 0 2 946545215 768123171 103627582 148234592 4 4 4 4 2 9549631 888771766 222765701 699951131 197549344 7 864402507 6 923282 196515693 7 3904431 7 9 7 6 928583625 12 13 15 15 158984149 347135488 212964913 15 575151723 250581014 15 18967907 17 17 879072123 275915436 17 19892...
result:
ok 199688 lines
Test #35:
score: 0
Accepted
time: 114ms
memory: 34236kb
input:
300000 1 392932082 3 989370668 3 131336184 2 0 932448145 3 592769392 2 0 63265356 3 193566892 1 491988188 3 736803473 1 0 3 98125290 1 643060748 1 414422196 1 720853393 3 818013412 1 666255954 3 720870569 1 868901045 3 695636669 3 130792954 3 229856724 2 7 118932827 1 22323720 1 515683361 2 9 352599...
output:
0 1 325380219 0 456197437 1 1 2 5 6 8 8 8 987833871 519209358 11 13 915737062 13 832563636 365610283 346691483 15 659216686 706869382 21 262124465 21 601125972 22 21 24 852043140 24 25 26 26 842810614 510013303 28 28 28 25559758 33344779 708701043 407810016 28 993045396 982512299 677296855 34 404929...
result:
ok 199798 lines
Test #36:
score: 0
Accepted
time: 129ms
memory: 36384kb
input:
300000 2 0 865179181 1 849733455 1 475888606 3 664764837 2 0 502122289 2 1 54621192 2 0 44654453 3 454734650 1 483168419 2 3 114508904 3 204936692 2 2 212477296 2 2 255869005 3 146069567 2 0 364340874 3 712328661 3 976844988 2 2 125622460 1 879501567 1 474840102 2 2 461660105 3 361717108 1 481467299...
output:
865179180 1 827744342 530509797 370276506 2 114508903 3 695645714 739037423 3 173131339 2 1 608790878 299170178 5 784112320 684761185 9 8 9 9 437806553 9 647880529 480016635 109358650 531898366 12 13 13 722268595 886070406 298719183 13 174258776 667732375 17 111969203 19 418552994 20201078 17 17 308...
result:
ok 200090 lines
Test #37:
score: 0
Accepted
time: 120ms
memory: 36348kb
input:
300000 3 65025048 3 300471686 3 262389793 1 617974611 3 888367034 2 0 643745991 2 0 34898350 2 1 209842882 1 728846510 3 316382357 3 337898147 3 251180716 1 192261125 3 343599429 2 2 296738763 2 3 119276772 1 198908858 1 43967128 3 319152449 1 593941774 3 419849297 1 224997097 2 5 9693486 2 4 169802...
output:
0 0 0 0 261720594 652872960 209842881 2 2 2 2 488999887 119276771 3 6 828632356 32708551 853722147 7 137090020 7 759064067 10 277439171 10 10 11 15925242 94311741 12 683957900 13 13 731440825 907992473 773887129 920868722 16 16 350570130 976339345 80877041 17 17 16 10854704 16 19 19 829512866 403205...
result:
ok 200018 lines
Test #38:
score: 0
Accepted
time: 122ms
memory: 34468kb
input:
300000 3 721612090 3 383268924 2 0 738487279 1 455617699 2 1 53299807 2 1 447484597 1 243117900 1 870985999 1 24956759 2 1 363456497 1 696069584 3 170877944 2 4 7084374 3 454741274 2 0 664175323 3 411689910 1 99054412 2 1 304324175 1 277918896 1 945275798 3 226625333 1 568562109 2 3 408661738 1 3860...
output:
0 0 738487278 53299806 447484596 502517147 5 703153957 5 954923249 5 238508814 8 20499274 10 865990341 10 10 972299477 10 667440612 753107437 11 417351744 10 338561752 428149590 734290779 458688708 153200428 16 15 15 16 16 16 781099806 17 774860992 16 17 360537466 18 20 200323263 39056426 970412331 ...
result:
ok 200194 lines
Test #39:
score: 0
Accepted
time: 107ms
memory: 37244kb
input:
300000 2 0 229734167 3 516616837 2 0 873676738 1 613454867 2 1 112582151 3 917963654 3 44975290 1 947378995 2 0 548865020 1 64171679 2 1 44386465 2 1 580086701 3 562014742 1 270319374 3 537354903 3 492174569 3 672530186 3 756510589 1 587943012 3 559767067 2 3 2518010 2 0 360286604 1 427226225 1 4788...
output:
229734166 0 873676737 112582150 0 1 109698867 55937131 591637367 2 2 2 2 2 5 860780395 843554516 91343130 177241392 746289135 6 7 7 605496854 177273219 845808994 10 10 10 10 10 155532706 12 11 11 80491445 531424747 19 23 23 26 347947262 201421475 29 411353565 474233956 27 300272321 93183888 90542867...
result:
ok 199672 lines
Test #40:
score: 0
Accepted
time: 117ms
memory: 33880kb
input:
300000 1 0 2 1 51915217 1 198869845 2 1 706361597 1 368729873 2 2 142534910 2 0 487029464 2 2 149567297 3 167181073 3 675573463 2 1 301004347 2 2 155785193 1 799179729 3 327100630 1 516849406 3 110113660 2 3 8031182 3 860651400 3 119624178 2 4 536229091 2 0 391342072 3 323914421 2 2 15707957 1 21165...
output:
103830433 611593031 511264782 541658637 518297169 3 1 169608404 524515065 4 5 324060309 4 5 53078489 666312981 5 700466957 4 5 5 757425440 14774528 9234662 405859770 78721205 7 8 8 8 9 9 553388939 323122036 10 953491488 721948159 13 140874470 721754629 586926997 18 949340878 763175546 18 18 18 18 18...
result:
ok 200263 lines
Test #41:
score: 0
Accepted
time: 119ms
memory: 34804kb
input:
300000 2 0 633299343 2 0 371195521 1 161261123 3 932744847 2 0 817373221 3 634766548 3 566480227 2 1 150951303 1 696226789 2 0 761657306 2 0 322064231 1 377340243 2 0 363656693 3 316942888 2 2 230204428 1 62852673 2 3 100898827 1 270060377 3 404378154 1 26601435 3 999199607 3 288287628 2 4 11628668 ...
output:
633299342 371195520 0 978634343 0 0 150951302 619145210 179552135 598484840 3 607544670 163751499 3 2 5 308290479 410544050 7 358594226 292016660 8 8 12 434950300 234235111 18 17 19 974551103 18 945497440 18 18 496585883 628647198 18 382412012 18 22 23 23 24 496056201 765467228 166095768 27 27 91656...
result:
ok 199796 lines
Test #42:
score: 0
Accepted
time: 122ms
memory: 34236kb
input:
300000 3 719026031 2 0 243654444 2 0 972110844 3 559390988 2 0 509727974 2 0 913815014 2 0 351407659 2 0 209117912 3 196753993 3 958668852 1 177440170 2 1 125865906 3 498572729 1 775142374 1 611871394 1 526960873 1 46350478 1 66233206 1 366990247 2 1 72605587 1 66540079 2 8 30324354 3 22107932 2 3 1...
output:
0 243654443 972110843 0 509727973 913815013 351407658 209117911 0 0 125865905 0 466154144 30324353 8 257585253 9 9 597411146 10 14 980168901 15 45758131 78652654 492894383 139549410 17 13 241980985 704323336 18 18 20 20 21 159976004 20 20 850494755 214761993 24 24 24 881440093 867854024 24 834676021...
result:
ok 200713 lines
Test #43:
score: 0
Accepted
time: 119ms
memory: 34416kb
input:
300000 2 0 818219322 3 821564513 1 0 2 1 242605730 1 0 1 0 3 787765411 2 1 315911520 2 3 221515123 3 164147396 1 414 3 519640201 3 580756810 2 4 272 1 6297 1 4940 1 7845 3 92940282 2 7 6946 1 1274 1 5492 3 433726347 2 4 388 1 4958 2 4 2 3 966375817 2 9 317 1 9156 1 546 1 8752 3 610978617 2 7 2328 3 ...
output:
818219321 0 485211459 3 527292142 443030245 1 3 1 271 2 6945 3 26235 30807 3 5274 3 32505 0 17371 1 3 688979837 19084 629225713 33235 3 2 1577 3 3 72588 3 3 3 88393 3 2 3 139428402 119958 82390 3 3 3 315937886 20479 59718 3 336113653 2 97515 158325 3 197163 3 215147 16854 138813 181005 27738 3 1 2 1...
result:
ok 199906 lines
Test #44:
score: 0
Accepted
time: 115ms
memory: 36992kb
input:
300000 2 0 40331947 2 0 374648773 3 781316236 2 0 948133808 1 0 3 55546218 1 0 2 1 235718976 1 0 1 0 1 9188 3 158109976 1 5411 1 4006 3 956749419 2 4 634894331 3 885016987 2 1 672915372 3 757373526 2 4 231612982 1 3339 3 497755327 2 6 1617 2 1 596190263 3 439706382 3 624172 2 0 376197223 2 3 3633007...
output:
40331946 374648772 0 948133807 0 942875902 2 3 269807259 3 766664479 4 463244568 4 8961 539066081 3 2 19177454 453224835 3 864704700 10981 3 76564540 13557 948 34728303 664872143 3 5169436 422 18443 35290 3 28683 541828491 35308 4 202797739 4 2 2 38247 2 53995 3 3 4 35571 857731906 1 34980 3 4 2 342...
result:
ok 199858 lines
Test #45:
score: 0
Accepted
time: 77ms
memory: 32732kb
input:
300000 3 647845865 2 0 400216725 2 0 799297587 3 516304862 3 784933302 3 257344997 3 839813569 2 0 167759991 3 788438689 3 15938400 2 0 721185079 2 0 449436686 2 0 666158163 2 0 819220721 3 560050496 2 0 659763128 3 922325401 3 602096973 2 0 884634348 2 0 116610670 2 0 960086525 2 0 429317086 3 1264...
output:
0 400216724 799297586 0 0 0 0 167759990 0 0 721185078 449436685 666158162 819220720 0 659763127 0 0 884634347 116610669 960086524 429317085 0 0 305874982 0 0 0 300977148 0 0 255328635 0 0 0 756026715 760202526 0 0 0 0 0 0 596656098 0 836926098 0 280313015 676376460 0 0 0 0 0 0 0 359528904 0 0 643544...
result:
ok 300000 lines
Test #46:
score: 0
Accepted
time: 76ms
memory: 36900kb
input:
300000 3 0 3 0 1 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 1 0 1 0 3 0 3 0 1 0 1 0 3 0 3 0 3 0 1 0 3 0 3 0 3 0 3 0 1 0 1 0 3 0 3 0 3 0 1 0 1 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 1 0 3 0 3 0 3 0 3 0 1 0 3 0 1 0 1 0 3 0 1 0 1 0 1 0 1 0 3 0 3 0 1 0 3 0 3 0 1 0 3 0 3 0 1 0 3 0 3 0 1 0 3 0 3 0 1 0 3 0 3 0 1...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok 200099 lines
Test #47:
score: 0
Accepted
time: 88ms
memory: 34884kb
input:
300000 1 7113847 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0...
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 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 150000 lines
Test #48:
score: 0
Accepted
time: 101ms
memory: 35916kb
input:
300000 1 711384789 1 511384789 1 0 1 0 1 27 1 82 1 31 1 90 1 30 1 37 1 90 1 3 1 11 1 35 1 19 1 84 1 27 1 82 1 96 1 69 1 59 1 41 1 5 1 84 1 19 1 27 1 64 1 3 1 4 1 64 1 60 1 76 1 10 1 81 1 51 1 46 1 42 1 95 1 8 1 71 1 69 1 20 1 53 1 92 1 40 1 85 1 29 1 35 1 70 1 37 1 84 1 22 1 21 1 48 1 90 1 73 1 8 1 ...
output:
4 4 3 4 3 4 2 4 2 3 2 4 3 3 4 3 4 4 4 4 2 4 4 2 2 3 2 4 3 3 2 4 4 2 4 4 2 4 4 4 4 4 4 4 2 3 4 2 3 4 2 2 4 4 4 3 3 3 2 2 4 3 4 4 4 4 4 2 3 4 2 2 3 4 2 2 4 4 3 4 3 4 2 4 3 2 2 4 4 4 4 3 2 4 3 3 4 4 4 3 4 4 4 4 2 2 3 2 3 4 3 4 2 2 2 2 4 2 4 3 3 4 4 2 3 2 4 2 4 4 3 3 4 3 4 2 3 4 2 3 4 4 2 4 2 4 2 4 2 3 ...
result:
ok 150000 lines