QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#217509 | #7448. rfplca | memset0 | AC ✓ | 1233ms | 10156kb | C++14 | 2.8kb | 2023-10-16 22:13:40 | 2023-10-16 22:13:40 |
Judging History
answer
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#ifndef memset0
#define endl '\n'
#endif
#define all(x) begin(x),end(x)
using namespace std;
const int N=4e5+9,S=250,B=N/S+9;
int n,m,f[N],g[N],h[N],bln[N];
struct Block{
int l,r,lazy;
bool force=true;
void rebuild(){
for(int i=l;i<=r;i++)f[i]=max(1,f[i]-lazy);
lazy=0;
for(int i=l;i<=r;i++)
if(f[i]>=l){
g[i]=g[f[i]];
h[i]=h[f[i]]+1;
}else{
g[i]=f[i];
h[i]=1;
}
if(force){
force=false;
for(int i=l;i<=r;i++)if(f[i]>=l){force=true; break;}
}
// cerr<<"FORCE :: "<<force<<endl;
// for(int i=l;i<=r;i++)cerr<<f[i]<<" \n"[i==r];
}
void jump(int d){
if(force){
for(int i=l;i<=r;i++)f[i]=max(1,f[i]-d);
rebuild();
}else{
lazy+=d;
}
}
}b[B];
int getf(int x){return b[bln[x]].force?f[x]:max(1,f[x]-b[bln[x]].lazy);}
int getg(int x){return b[bln[x]].force?g[x]:max(1,f[x]-b[bln[x]].lazy);}
int geth(int x){return b[bln[x]].force?h[x]:1;}
int depth(int u){
int dep=0;
cerr<<"DEPTH "<<u;
while(u!=1){
dep+=geth(u);
u=getg(u);
}
cerr<<" = "<<dep<<endl;
return dep;
}
int lca(int u,int v){
if(u==v)return u;
int pu=u,pv=v;
while(u!=v){
if(u>v)swap(u,v),swap(pu,pv);
pv=v,v=getg(v);
// cerr<<">>>> "<<u<<" "<<v<<endl;
}
u=pu,v=pv;
while(u!=v){
if(u>v)swap(u,v);
v=getf(v);
// cerr<<">> "<<u<<" "<<v<<endl;
}
return u;
}
int solve(vector<int> &b){
sort(all(b));
b.erase(unique(all(b)),b.end());
if(b.size()==1)return 1;
vector<int> c(b.size()-1);
for(int i=0;i<c.size();i++)c[i]=lca(b[i],b[i+1]);
b.insert(b.end(),all(c));
sort(all(b));
b.erase(unique(all(b)),b.end());
for(int x:b)cerr<<x<<",";cerr<<endl;
int ans=1;
for(int i=0;i+1<b.size();i++){
int t=lca(b[i],b[i+1]);
ans+=depth(b[i+1])-depth(t);
}
return ans;
}
int main(){
#ifdef memset0
// freopen("H2.in","r",stdin);
freopen("H2-big.in","r",stdin);
#endif
cin.tie(0)->sync_with_stdio(0);
cin>>n>>m;
for(int i=2;i<=n;i++)cin>>f[i];
for(int i=2;i<=n;i++)bln[i]=(i-1)/S+1;
for(int i=2;i<=n;i++)b[bln[i]].r=i;
for(int i=n;i>=2;i--)b[bln[i]].l=i;
for(int i=1;i<=bln[n];i++)b[i].rebuild();
for(int op,l,r,d,u,v,lastans=0,i=1;i<=m;i++){
cin>>op;
if(op==1){
cin>>l>>r>>d;
l^=lastans,r^=lastans,d^=lastans;
// cerr<<"! "<<"MODIFY "<<l<<" "<<r<<" "<<d<<endl;
if(bln[l]==bln[r]){
for(int i=l;i<=r;i++)f[i]=max(1,f[i]-d);
b[bln[l]].rebuild();
}else{
for(int i=l;i<=b[bln[l]].r;i++)f[i]=max(1,f[i]-d);
b[bln[l]].rebuild();
for(int i=b[bln[r]].l;i<=r;i++)f[i]=max(1,f[i]-d);
b[bln[r]].rebuild();
for(int i=bln[l]+1;i<bln[r];i++)b[i].jump(d);
}
}else{
cin>>u>>v;
u^=lastans,v^=lastans;
cout<<(lastans=lca(u,v))<<endl;
}
}
}
详细
Test #1:
score: 100
Accepted
time: 389ms
memory: 9852kb
input:
400000 400000 1 2 1 4 1 1 5 4 6 5 9 1 1 13 3 8 12 16 3 11 8 8 2 18 21 15 7 23 11 6 4 26 17 5 12 6 5 28 32 26 21 5 19 1 25 25 11 26 47 11 31 25 18 7 25 36 40 23 54 31 14 62 61 33 57 40 11 16 24 51 69 25 55 51 55 65 34 19 18 21 20 62 64 83 22 48 67 47 21 27 30 63 10 14 70 63 18 17 74 98 40 89 10 7 30 ...
output:
1 1 1 1 1 1 4 1 1 1 4 1 1 18 1 4 1 18 1 1 4 1 1 1 1 5 1 4 4 4 11 5 1 4 1 4 1 1 4 1 1 1 4 1 1 1 1 4 4 1 1 1 4 4 1 1 1 1 4 1 1 1 5 1 1 1 1 5 1 1 1 1 4 1 1 12 12 1 1 4 1 1 11 1 1 1 1 4 1 1 1 4 1 1 1 14 1 18 7 5 25 1 62 1 1 1 1 1 1 1 4 4 4 102 1 1 1 1 1 2 1 1 1 1 1 1 1 1 18 4 1 1 4 5 1 1 1 1 1 1 1 1 1 1...
result:
ok 200476 lines
Test #2:
score: 0
Accepted
time: 789ms
memory: 9856kb
input:
400000 400000 1 1 1 1 1 1 1 1 1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 9...
output:
1 1 289629 1 1 37362 1 1 1 1 1 2107 1 1 1 1 1 200528 1 1 1 1 1 1 1 1 1 11646 1 1 1 1 7608 1 1 1 1 1 12297 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 206102 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 234105 1 213107 1 1 1 1 47884 1 1 1 1 1 1 1 1 1 1 1 4725 1 1 1 2170 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 206097 1 ...
result:
ok 199431 lines
Test #3:
score: 0
Accepted
time: 725ms
memory: 10144kb
input:
400000 400000 1 2 2 4 4 5 7 7 9 10 11 12 13 14 15 15 16 17 18 20 20 22 22 23 24 26 27 27 28 30 31 32 32 33 35 35 37 38 38 40 41 41 42 43 45 45 46 47 49 49 51 52 53 53 54 56 57 58 58 60 60 61 63 64 64 65 66 68 68 70 71 71 72 73 75 75 76 78 79 79 81 81 82 83 85 85 87 88 88 90 91 92 92 94 95 95 96 98 9...
output:
210801 160667 149084 223804 42542 53089 15189 225821 254995 20768 39457 47988 79032 79157 32888 132798 56834 104162 380609 81459 27942 15916 76220 122556 5183 310812 148803 188513 211433 26186 271890 236458 281943 294363 101756 132671 61499 79360 30593 172339 261927 78569 135362 217756 23629 227179 ...
result:
ok 200314 lines
Test #4:
score: 0
Accepted
time: 733ms
memory: 9884kb
input:
400000 400000 1 1 3 3 1 1 6 3 1 5 9 8 4 14 15 16 17 14 13 16 14 22 14 24 20 18 21 23 22 22 22 29 32 30 29 29 36 32 32 38 36 33 38 43 44 45 45 46 48 45 45 49 48 51 49 49 48 55 51 54 52 56 61 60 61 60 65 64 66 66 62 66 69 73 66 75 71 77 77 79 75 81 79 76 85 83 86 86 82 83 83 89 87 87 90 92 97 94 94 92...
output:
66536 42746 75273 60596 395361 75345 176775 11033 45502 92873 10536 28053 95739 65423 23980 148212 148187 68177 95384 240392 167540 203213 115465 170774 55225 159774 117049 31929 63997 20775 168687 18075 230893 55461 8262 180040 126544 12538 157569 254873 43232 212315 165491 46473 21093 169898 7139 ...
result:
ok 200328 lines
Test #5:
score: 0
Accepted
time: 621ms
memory: 9888kb
input:
400000 400000 1 1 1 3 3 4 6 8 8 10 10 10 12 14 14 15 15 16 17 19 21 20 22 23 24 24 26 27 27 30 31 31 32 34 33 36 35 37 38 40 39 42 41 42 44 46 45 47 49 48 50 51 51 53 53 55 57 56 59 59 60 60 63 64 63 66 65 66 67 70 69 71 71 74 75 76 77 77 79 79 80 80 83 83 85 86 86 86 88 89 91 91 92 92 94 96 96 96 9...
output:
176159 114275 14085 231014 132050 95691 93758 210575 14952 83916 274682 13907 105473 48151 155526 90678 53411 182975 221031 126955 150326 307833 68995 166787 49652 104548 236019 113064 132156 65611 85394 34656 117176 608 190709 175534 95813 174875 192078 165010 183694 208180 24346 152280 314154 2491...
result:
ok 200095 lines
Test #6:
score: 0
Accepted
time: 640ms
memory: 9852kb
input:
400000 400000 1 1 3 3 1 1 6 3 1 5 9 8 4 14 15 16 17 14 13 16 14 22 14 24 20 18 21 23 22 22 22 29 32 30 29 29 36 32 32 38 36 33 38 43 44 45 45 46 48 45 45 49 48 51 49 49 48 55 51 54 52 56 61 60 61 60 65 64 66 66 62 66 69 73 66 75 71 77 77 79 75 81 79 76 85 83 86 86 82 83 83 89 87 87 90 92 97 94 94 92...
output:
265110 56921 177951 17569 11033 64259 70004 25947 80353 54746 65423 48917 161026 68177 264589 170774 77420 31929 94829 53873 168687 18075 21563 163635 51540 224275 114283 62827 126544 288274 12538 15780 209938 155113 3981 339925 79736 195100 97468 73031 103710 91813 118003 241688 138289 66328 182956...
result:
ok 199399 lines
Test #7:
score: 0
Accepted
time: 712ms
memory: 9800kb
input:
400000 400000 1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98...
output:
1 1 1 1 318434 1 1 143691 1 210125 1 1 13713 175331 1 1 1 1 1 11022 1 1 22733 1 1 210126 9546 134986 1 124872 1 103369 1 108106 42169 40449 1 1 8253 179436 142152 39135 1 121851 27988 1 1 1 63210 1 1 9626 1 1 121241 203789 1012 1 145550 1 86090 25925 1 1 95571 1 27060 197787 1 93637 200256 114145 34...
result:
ok 199398 lines
Test #8:
score: 0
Accepted
time: 860ms
memory: 10084kb
input:
400000 400000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 3...
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 187326 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 199964 lines
Test #9:
score: 0
Accepted
time: 1136ms
memory: 9852kb
input:
400000 400000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 9...
output:
91 82 94 91 93 52 45 29 31 36 27 59 19 17 64 1 1 1 1 1 1 1 29 1 1 1 1 1 41 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 22 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 115623 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 133037 1 1 1 1 1 1 1 47 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 40000 lines
Test #10:
score: 0
Accepted
time: 1233ms
memory: 9848kb
input:
400000 400000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 9...
output:
191 182 178 165 185 162 173 166 165 127 127 168 137 144 64 131 105 115 37 61 168 168 29 54 112 1 133 1 41 121 141 81 95 65 1 35 1 86 1 1 129 1 61 1 1 123 1 1 22 1 1 1 1 1 1 1 1 1 1 1 103 1 1 1 1 1 115623 1 1 1 1 1 1 1 1 1 1 1 71 1 1 1 1 1 133037 1 1 1 1 1 1 1 47 1 1 1 1 1 1 1 1 1 1 1 68 1 1 1 1 1 1 ...
result:
ok 40000 lines
Test #11:
score: 0
Accepted
time: 1109ms
memory: 10108kb
input:
400000 400000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 9...
output:
291 291 290 276 277 272 237 239 247 218 227 277 187 271 200 176 259 278 143 242 168 168 237 138 112 178 133 252 41 121 141 81 95 65 1 35 1 86 1 136 129 177 61 120 1 123 1 1 22 180 186 1 1 1 1 107 1 1 1 65 103 1 21 1 1 1 115623 115 1 1 1 1 1 1 1 1 1 1 71 1 1 1 1 1 133037 1 1 1 1 1 1 1 47 1 1 1 1 1 1 ...
result:
ok 40000 lines
Test #12:
score: 0
Accepted
time: 467ms
memory: 9800kb
input:
400000 400000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 9...
output:
195546 142231 188299 113064 129034 107442 113059 87306 63779 71726 131225 91431 101847 18176 36879 45704 67500 24079 24080 46574 24079 24079 24079 158137 24080 53649 52451 24079 99 24080 24079 52451 52450 24079 24079 24079 24080 1435 24079 1345 1347 1344 1344 1346 86326 1345 1345 257181 98837 1345 1...
result:
ok 200482 lines
Test #13:
score: 0
Accepted
time: 1180ms
memory: 9916kb
input:
400000 400000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 9...
output:
391 386 374 387 369 345 365 385 329 309 327 291 305 285 336 276 259 278 315 242 358 367 237 271 338 178 377 252 303 149 141 370 131 190 316 150 167 86 337 136 129 177 61 120 123 123 249 252 22 180 186 1 1 1 88 107 165 104 1 65 103 340 21 1 45 1 115623 115 1 1 1 1 1 1 1 1 1 1 71 266 14 1 1 1 133037 1...
result:
ok 40000 lines
Test #14:
score: 0
Accepted
time: 1178ms
memory: 9852kb
input:
400000 400000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 9...
output:
491 481 486 463 461 455 441 458 441 420 427 400 423 398 371 421 413 441 381 423 358 367 445 355 338 413 377 252 303 392 421 370 393 372 316 360 167 157 337 216 131 177 193 120 123 123 249 252 97 180 186 401 29 316 88 107 165 104 287 65 103 340 21 1 45 1 115623 115 153 226 1 146 1 1 1 1 1 1 71 266 14...
result:
ok 40000 lines
Test #15:
score: 0
Accepted
time: 1140ms
memory: 10100kb
input:
400000 400000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 9...
output:
591 581 573 572 557 547 557 531 523 511 527 495 491 525 472 466 567 441 487 423 548 566 445 488 564 413 377 505 565 392 421 370 393 372 316 360 318 429 337 497 499 237 449 246 375 538 249 252 464 180 186 401 473 316 324 107 165 104 287 65 103 340 205 488 45 75 115623 115 153 226 1 146 1 1 1 1 1 423 ...
result:
ok 40000 lines
Test #16:
score: 0
Accepted
time: 1214ms
memory: 9852kb
input:
400000 400000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 9...
output:
691 690 682 683 691 657 685 677 657 673 627 604 609 652 608 566 567 604 553 604 548 566 653 488 564 648 621 505 565 663 421 659 429 497 632 475 501 429 365 497 499 556 449 517 375 538 365 360 464 631 245 401 473 316 324 253 335 326 287 220 653 340 205 488 386 574 115623 115 153 226 310 146 373 610 2...
result:
ok 40000 lines
Test #17:
score: 0
Accepted
time: 276ms
memory: 8552kb
input:
100000 100000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 9...
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 100000 lines
Test #18:
score: 0
Accepted
time: 787ms
memory: 9916kb
input:
400000 400000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 9...
output:
30464 209869 346131 58298 87306 91431 324429 335615 71727 272855 203724 126725 49227 324366 262038 263155 69277 97745 86853 114040 24040 218806 101585 41582 26712 76484 209740 270655 126128 247387 100189 276196 154229 73723 211621 4636 192962 258268 116999 230952 258737 229156 110595 65655 92774 783...
result:
ok 200202 lines
Test #19:
score: 0
Accepted
time: 404ms
memory: 9852kb
input:
400000 400000 1 2 1 4 1 1 5 4 6 5 9 1 1 13 3 8 12 16 3 11 8 8 2 18 21 15 7 23 11 6 4 26 17 5 12 6 5 28 32 26 21 5 19 1 25 25 11 26 47 11 31 25 18 7 25 36 40 23 54 31 14 62 61 33 57 40 11 16 24 51 69 25 55 51 55 65 34 19 18 21 20 62 64 83 22 48 67 47 21 27 30 63 10 14 70 63 18 17 74 98 40 89 10 7 30 ...
output:
1 1 1 1 4 4 1 1 1 1 1 1 1 1 274 1 1 1 1 1 1 4 1 5 1 1 1 4 4 1 40 1 1 4 1 1 1 4 1 4 1 1 4 1 8 1 4 1 5 4 1 5 1 4 1 4 1 1 1 1 7 183 4 1 1 1 1 1 4 4 5 4 4 18 4 1 12 1 1 1 4 4 1 5 1 1 1 1 4 5 4 23 4 1 1 11 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 4 4 1 5 1 1 1 1 4 127 1 1 4 4 1 4 1 1 4 1 12 11 12 1 4 1 1 1 ...
result:
ok 199826 lines
Test #20:
score: 0
Accepted
time: 379ms
memory: 10156kb
input:
400000 400000 1 2 1 4 1 1 5 4 6 5 9 1 1 13 3 8 12 16 3 11 8 8 2 18 21 15 7 23 11 6 4 26 17 5 12 6 5 28 32 26 21 5 19 1 25 25 11 26 47 11 31 25 18 7 25 36 40 23 54 31 14 62 61 33 57 40 11 16 24 51 69 25 55 51 55 65 34 19 18 21 20 62 64 83 22 48 67 47 21 27 30 63 10 14 70 63 18 17 74 98 40 89 10 7 30 ...
output:
1 1 1 1 1 1 4 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 200476 lines
Test #21:
score: 0
Accepted
time: 722ms
memory: 9912kb
input:
400000 400000 1 1 1 3 3 4 6 8 8 10 10 10 12 14 14 15 15 16 17 19 21 20 22 23 24 24 26 27 27 30 31 31 32 34 33 36 35 37 38 40 39 42 41 42 44 46 45 47 49 48 50 51 51 53 53 55 57 56 59 59 60 60 63 64 63 66 65 66 67 70 69 71 71 74 75 76 77 77 79 79 80 80 83 83 85 86 86 86 88 89 91 91 92 92 94 96 96 96 9...
output:
101073 211829 326427 107757 119987 176159 10989 282713 87073 14085 231008 132050 19163 46545 84563 71799 58338 257776 185047 88731 17459 90678 196587 69916 179292 42914 323586 52162 140364 228808 180551 125544 68711 113064 152699 231292 192479 39818 14221 237320 85394 34656 40186 117176 20260 147942...
result:
ok 200289 lines
Test #22:
score: 0
Accepted
time: 614ms
memory: 9916kb
input:
400000 400000 1 2 2 4 4 5 7 7 9 10 11 12 13 14 15 15 16 17 18 20 20 22 22 23 24 26 27 27 28 30 31 32 32 33 35 35 37 38 38 40 41 41 42 43 45 45 46 47 49 49 51 52 53 53 54 56 57 58 58 60 60 61 63 64 64 65 66 68 68 70 71 71 72 73 75 75 76 78 79 79 81 81 82 83 85 85 87 88 88 90 91 92 92 94 95 95 96 98 9...
output:
161262 3721 42542 15189 362730 214568 116266 311821 351437 24200 63424 56834 104162 209382 15916 232797 232733 178403 620 257291 236002 305819 257291 132671 314616 30593 261930 147 164897 68758 153842 229733 61550 74335 162103 215815 252933 221564 91911 126631 233858 183265 155428 313622 20954 94438...
result:
ok 199414 lines
Test #23:
score: 0
Accepted
time: 735ms
memory: 10156kb
input:
400000 400000 1 1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 ...
output:
1 210416 7885 1 216008 36186 146716 1 1 217702 183830 1 213656 1 1 232671 1 1 1 173279 163087 1 69971 100996 1 1 1 1 1 1 1 1 1 71396 1 1 1 1 1 1 1 1 160231 131210 1 1 161995 1 1 1 1 200543 1 10552 1 1 1 16813 1 1 1 1 1 1 1 1 1 1 1 1 1 45381 1 1 1 148081 102158 1 1 1 1 1 103798 1 177666 40784 203246 ...
result:
ok 200064 lines