QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#619311 | #4150. 染色 | McIron233 | 100 ✓ | 101ms | 33312kb | C++14 | 3.0kb | 2024-10-07 13:50:15 | 2024-10-07 13:50:18 |
Judging History
answer
#include<stdio.h>
#include<vector>
#include<algorithm>
#define int long long
#define N 100005
using namespace std;
int n,m,Lc,Rc,col[N];
int dep[N],fa[N],siz[N],hson[N];
int top[N],id[N],rev[N];
vector<int>e[N];
struct segment_tree{
#define mid ((l+r)>>1)
#define lson (k<<1)
#define rson (k<<1|1)
int lc[N<<2],rc[N<<2],sum[N<<2],tag[N<<2];
void updcol(int k,int cl){
lc[k]=rc[k]=cl;
sum[k]=1,tag[k]=cl;
}
void pushup(int k){
sum[k]=sum[lson]+sum[rson];
if(rc[lson]==lc[rson])--sum[k];
lc[k]=lc[lson],rc[k]=rc[rson];
}
void pushdown(int k){
if(!tag[k])return;
updcol(lson,tag[k]);
updcol(rson,tag[k]);
tag[k]=0;
}
void buildseg(int k,int l,int r){
if(l==r){
lc[k]=rc[k]=col[rev[l]];
sum[k]=1;
return;
}
buildseg(lson,l,mid);
buildseg(rson,mid+1,r);
pushup(k);
}
void modify(int k,int l,int r,int ql,int qr,int val){
if(ql<=l && r<=qr){
updcol(k,val);
return;
}
pushdown(k);
if(ql<=mid)modify(lson,l,mid,ql,qr,val);
if(qr>mid)modify(rson,mid+1,r,ql,qr,val);
pushup(k);
}
int query(int k,int l,int r,int ql,int qr){
if(ql<=l && r<=qr){
if(l==ql)Lc=lc[k];
if(r==qr)Rc=rc[k];
return sum[k];
}
pushdown(k);
if(qr<=mid)return query(lson,l,mid,ql,qr);
if(ql>mid)return query(rson,mid+1,r,ql,qr);
int res=query(lson,l,mid,ql,qr)+query(rson,mid+1,r,ql,qr);
if(rc[lson]==lc[rson])--res;
return res;
}
#undef mid
#undef lson
#undef rson
}seg;
void dfs1(int k,int F){
dep[k]=dep[F]+1,fa[k]=F,siz[k]=1;
int l=e[k].size();
for(int i=0;i<l;++i){
int v=e[k][i];
if(v==F)continue;
dfs1(v,k);
siz[k]+=siz[v];
if(siz[v]>siz[hson[k]])hson[k]=v;
}
}
int _tot;
void dfs2(int k,int tp){
top[k]=tp,id[k]=++_tot,rev[_tot]=k;
if(!hson[k])return;
dfs2(hson[k],tp);
int l=e[k].size();
for(int i=0;i<l;++i){
int v=e[k][i];
if(v==fa[k] || v==hson[k])continue;
dfs2(v,v);
}
}
void change(int x,int y,int val){
while(top[x]!=top[y]){
if(dep[top[x]]<dep[top[y]])swap(x,y);
seg.modify(1,1,n,id[top[x]],id[x],val);
x=fa[top[x]];
}
if(id[x]>id[y])swap(x,y);
seg.modify(1,1,n,id[x],id[y],val);
}
int pos1,pos2;
int go(int x,int y){
int res=0; pos1=0,pos2=0;
while(top[x]!=top[y]){
if(dep[top[x]]<dep[top[y]])swap(x,y),swap(pos1,pos2);
res+=seg.query(1,1,n,id[top[x]],id[x]);
if(Rc==pos1)--res;
pos1=Lc,x=fa[top[x]];
}
if(id[x]>id[y])swap(x,y),swap(pos1,pos2);
res+=seg.query(1,1,n,id[x],id[y]);
if(Lc==pos1)--res;
if(Rc==pos2)--res;
return res;
}
signed main(){
scanf("%lld %lld",&n,&m);
for(int i=1;i<=n;++i)scanf("%lld",col+i);
for(int i=1;i<n;++i){
int u,v; scanf("%lld %lld",&u,&v);
e[u].push_back(v);
e[v].push_back(u);
}
dfs1(1,0);
dfs2(1,1);
seg.buildseg(1,1,n);
while(m--){
char opt; int x,y,c;
scanf(" %c %lld %lld",&opt,&x,&y);
if(opt=='C'){
scanf("%lld",&c);
change(x,y,c);
}
else printf("%lld\n",go(x,y));
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Pretests
Final Tests
Test #1:
score: 5
Accepted
time: 60ms
memory: 28744kb
input:
61955 79012 2 1 1 1 1 1 2 2 2 2 2 2 2 1 2 1 2 1 1 2 1 1 2 1 1 2 2 1 2 1 2 1 2 2 2 1 2 2 1 2 2 1 2 2 2 1 2 1 1 2 2 2 2 2 2 1 1 2 1 1 1 1 1 1 1 1 1 2 1 2 1 1 1 2 2 1 2 2 1 1 1 1 1 1 2 1 1 2 1 2 2 1 1 1 2 2 2 2 2 1 1 1 2 1 2 1 2 2 1 1 1 2 2 2 2 1 1 1 2 1 2 2 2 1 2 1 1 1 2 1 1 1 2 2 2 2 2 2 2 2 2 2 2 1 ...
output:
6504 1 1 1 2 1 2 890 4 3 1 1092 3 1 1 2 1 3 1442 2 2 2 2 4 1034 6 1 1 1 188 1 1 1 1 1 1 1 1 1 364 1 652 2 89 3 2 2 1 3 3 2 1 1 2 4 1 2 3 3 2 2 1 1 1 1 1 2 1 1 1 1 1 1 104 2 2 1 1 2 1 1 1 1 1 1 1 1 1 3 1 3 1 1 3 3 2 4 1 1 1 2 2 1 3 1 1 2 2 1 2 1 1 3 1 1 1 1 1 1 3 3 2 2 1 4 1 1 2 1 1 2 3 6 2 2 3 2 3 1...
result:
ok 39425 lines
Test #2:
score: 5
Accepted
time: 62ms
memory: 28680kb
input:
50532 78881 7 2 63 88 74 79 56 82 21 79 51 38 82 59 10 58 95 98 83 74 82 37 6 92 60 72 60 32 32 25 15 74 94 72 14 92 80 57 18 52 54 66 44 86 61 4 53 9 69 27 92 28 39 80 19 90 32 75 61 55 92 45 90 1 85 72 59 46 56 96 67 40 68 16 70 16 56 69 90 72 63 70 91 2 86 49 79 90 6 45 98 12 59 5 6 61 48 51 66 9...
output:
17483 987 1 2 3428 1 2 2381 4 2 2 2 227 3 3 6 3 1 3 1 2 190 6 1 221 1 4 6 4 2 1 2 2 1 4 4 1 4 4 2 3 5 4 216 2 1 1 2 1 6 2 5 3 4 2 1 2 2 3 3 1 3 2 7 4 2 2 2 3 3 2 5 3 6 3 3 3 1 3 1 1 2 3 3 2 1 1 2 3 2 2 1 1 1 3 5 4 3 6 2 8 8 5 4 1 1 1 5 1 6 4 1 2 5 2 2 1 3 1 4 4 1 3 1 4 2 1 3 5 5 1 1 2 5 7 5 5 7 2 4 ...
result:
ok 39316 lines
Test #3:
score: 5
Accepted
time: 76ms
memory: 33312kb
input:
91722 56099 897 246 384 412 355 981 897 355 355 355 384 202 897 246 394 384 897 246 202 355 384 384 412 981 394 412 394 355 246 981 394 202 412 394 412 355 355 394 384 981 355 355 412 246 202 412 897 981 384 897 394 394 394 384 394 412 246 394 246 412 412 412 202 384 412 897 384 897 355 897 981 384 ...
output:
1 2 2289 2 3 2 2 2 452 3 2 2 3 457 4 1 1 65 2 2 2 1 950 1 3 2 2 2 4 2 2 1 1 4 4 1 1 8 2 3 9 9 2 1 1 2 1 6 1 1 2 1 2 2 2 4 5 1 3 5 3 1 1 2 4 5 1 2 2 3 4 1 1 2 1 1 3 1 4 4 4 1 2 3 2 3 2 2 2 3 2 1 1 1 4 4 1 3 3 1 1 2 2 5 3 1 2 3 1 1 1 1 2 2 3 1 3 3 1 1 3 1 2 2 1 3 4 1 4 5 3 1 2 3 1 3 1 1 2 1 3 4 1 1 4 ...
result:
ok 27931 lines
Test #4:
score: 5
Accepted
time: 71ms
memory: 25188kb
input:
51119 94784 94086 57483 94086 93371 93371 36709 37156 61001 61001 42490 57483 21622 57483 93371 41062 28193 36709 41062 67694 21622 42490 37156 42490 37156 37156 27678 42490 67694 93371 28193 41062 90766 28193 37156 94086 42490 42490 57483 36709 90766 21622 57483 27678 27678 57483 36709 61001 41062 ...
output:
1465 7932 34390 14431 423 6 1528 2283 1 1 1991 2 3798 691 6124 1 3 3 1 1 1 2 2 1 1468 1 2 1 1 1 1 3 1 1 1 2 2 2 2 1 2 1 1 1 2 2 1 4 3 3 2 1 1 1 1 1 2 3 3 2 2 3 1 1 4 1 1 2 3 1 3 3 4 1 2 4 6 2 3 5 2 2 4 9 8 9 605 1 1 1 1 132 4 1 2 3 2 1 4 2 2 1 1 1 4 2 1 2 3 9 2 1 2 2 2 3 1 2 6 3 1 3 1 1 1 2 2 2 3 3 ...
result:
ok 47295 lines
Test #5:
score: 5
Accepted
time: 59ms
memory: 24328kb
input:
51192 58845 981330 83912 13679 494596 13679 83912 981330 232341 83912 981330 494596 494596 83912 232341 981330 494596 232341 232341 494596 232341 83912 981330 494596 13679 83912 83912 494596 13679 494596 494596 83912 494596 13679 494596 232341 494596 494596 232341 232341 83912 13679 981330 13679 839...
output:
3652 6629 24266 977 285 1 285 8165 1 1050 2 1 2 2 1 1 2 2 1 1 3 2 1 3 1 3 3 3 4 2 1 1 2 1 1 1 1 1 2 1 2 2 2 1 4 1 3 1 2 1 2 4 1 2 3 3 1 1 1 7 2 7 6 6 6 1 1 7 6 2 2 6 2 3 2 5 1 2 2 2 5 6 4 1 2 2 6 2 4 1 3 7 2 1 1 1 2 1 4 1 5 3 1 1 1 1 1 4 3 3 1 1 1 2 1 2 1 2 1 2 3 1 2 3 2 1 2 6 2 4 7 3 4 1 2 4 1 2 4 ...
result:
ok 29299 lines
Test #6:
score: 5
Accepted
time: 101ms
memory: 30400kb
input:
84090 93282 783193642 71580706 556490407 71580706 44596216 71580706 783193642 293719217 578128405 71580706 71580706 398314451 578128405 398314451 44596216 556490407 783193642 293719217 556490407 293719217 783193642 398314451 71580706 25443140 783193642 293719217 783193642 783193642 398314451 7831936...
output:
6040 47945 4422 34707 2511 21434 18584 7775 1 2 2 3 2 2 4 4 4 1 3 3 3 1 4 2 4 2 2 2 1 2 3 2 1 2 1 2 1 2 3 919 1 6 4 2 1 5 2 3 6 6 5 4 7 5 1 4 1 1 3 3 2 2 3 6 1 1 1 1 2 1 5 2 4 3 3 1 5 2 4 1 1 6 3 3 7 2 1 3 3 7 1 1 5 1 4 3 2 4 1 2 9 4 1 1 4 1 2 1 3 1 2 2 3 1 1 1 1 2 4 2 7 2 1 2 1 12 6 5 6 5 2 2 4 2 2...
result:
ok 46538 lines
Test #7:
score: 5
Accepted
time: 21ms
memory: 21852kb
input:
61955 512 2 1 1 1 1 1 2 2 2 2 2 2 2 1 2 1 2 1 1 2 1 1 2 1 1 2 2 1 2 1 2 1 2 2 2 1 2 2 1 2 2 1 2 2 2 1 2 1 1 2 2 2 2 2 2 1 1 2 1 1 1 1 1 1 1 1 1 2 1 2 1 1 1 2 2 1 2 2 1 1 1 1 1 1 2 1 1 2 1 2 2 1 1 1 2 2 2 2 2 1 1 1 2 1 2 1 2 2 1 1 1 2 2 2 2 1 1 1 2 1 2 2 2 1 2 1 1 1 2 1 1 1 2 2 2 2 2 2 2 2 2 2 2 1 2 ...
output:
4 12 6 7 6 3 7 9 9 8 7 5 8 13 7 7 4 9 5 5 7 6 5 7 7 6 5 9 8 7 11 5 4 9 6 6 5 7 6 7 8 10 9 7 10 8 9 7 5 6 8 9 4 11 7 10 12 4 4 9 11 5 10 12 8 10 11 6 4 7 7 7 8 6 4 11 13 6 13 6 7 9 5 5 5 11 4 9 6 7 8 11 6 8 8 9 9 1 5 7 10 8 12 13 10 10 10 8 6 7 6 3 6 9 10 9 9 10 8 5 6 13 8 7 7 6 8 8 6 9 4 5 11 7 7 7 ...
result:
ok 257 lines
Test #8:
score: 5
Accepted
time: 32ms
memory: 27844kb
input:
94874 903 37122797 770547723 549114847 183973646 23162110 445524515 195844889 964789479 536094567 900222642 183973646 668859984 668859984 445524515 183973646 183973646 445524515 964789479 183973646 183973646 900222642 755359093 549114847 195844889 900222642 195844889 195844889 37122797 964789479 668...
output:
25 22 18 11 18 9 14 15 11 11 17 17 11 14 7 16 17 14 17 15 16 12 12 14 14 15 15 14 9 11 22 14 14 20 17 9 15 15 17 15 11 16 18 17 14 11 11 10 10 14 17 13 9 11 15 10 16 13 17 17 11 15 15 12 15 21 11 10 18 14 16 15 17 11 17 15 14 18 16 14 12 13 16 15 12 10 11 12 10 17 13 13 17 6 13 15 19 16 11 9 16 15 2...
result:
ok 464 lines
Test #9:
score: 5
Accepted
time: 48ms
memory: 28108kb
input:
92984 8329 1 320 749 320 320 917 681 501 743 605 501 605 917 917 917 114 501 681 917 917 917 114 528 1 320 749 681 1 1 917 749 1 681 1 917 605 114 114 1 528 605 114 501 605 749 749 501 501 749 917 917 917 605 743 917 749 501 605 528 114 681 681 114 1 917 605 320 320 743 1 681 114 749 1 1 1 528 743 7...
output:
19 12 16 16 11 10 16 14 24 12 13 19 15 9 11 11 13 11 12 8 13 12 13 14 18 15 14 18 15 14 19 15 20 16 14 14 15 13 16 13 18 21 11 17 16 14 18 14 17 16 18 15 18 18 12 17 16 10 11 13 14 10 8 13 17 10 13 12 13 14 10 13 13 17 11 11 19 14 10 14 13 9 11 10 12 12 14 9 10 9 13 12 10 14 15 10 14 13 12 13 10 15 ...
result:
ok 4206 lines
Test #10:
score: 5
Accepted
time: 44ms
memory: 27696kb
input:
88141 5638 985242 565471 985242 565471 985242 971707 831247 971707 971707 971707 565471 945261 985242 55263 971707 55263 55263 971707 985242 831247 565471 55263 831247 985242 971707 971707 565471 55263 985242 971707 565471 831247 945261 831247 565471 985242 945261 945261 945261 55263 985242 55263 83...
output:
13 15 16 16 18 10 13 11 18 11 11 16 13 10 13 14 16 12 15 13 13 16 11 21 11 13 13 16 12 11 10 13 14 17 16 17 14 14 10 11 11 12 13 15 11 15 8 13 18 13 14 10 12 15 12 18 16 8 17 14 13 18 16 11 13 11 12 16 11 19 13 12 14 14 14 16 14 8 9 14 7 18 13 5 6 17 13 10 10 17 13 13 12 10 12 12 8 6 6 6 10 8 14 8 1...
result:
ok 2797 lines
Test #11:
score: 5
Accepted
time: 33ms
memory: 26544kb
input:
72801 81 760658523 56965747 56264873 760658523 664202223 56965747 56264873 56264873 480740301 664202223 56965747 760658523 56965747 56965747 56264873 480740301 664202223 760658523 56264873 56965747 56965747 664202223 56965747 480740301 480740301 56965747 760658523 480740301 56264873 56965747 6642022...
output:
2 2 4558 2366 2 2 3 1 2 447 4 3 3 4 3 9 1 753 5 7 3 2 79 3 208 4 5 2 4 2 1 5 3 2 1 4 2 2 966 4 2 5 3 3 2 5 2 4 2
result:
ok 49 lines
Test #12:
score: 5
Accepted
time: 30ms
memory: 28052kb
input:
73825 671 880775134 210188519 415245550 309468362 210188519 420331185 415245550 119215971 415245550 429387849 420331185 119215971 460103986 336232040 880775134 336232040 336232040 332321925 309468362 210188519 420331185 336232040 73993695 332321925 336232040 477366434 336232040 332321925 460103986 3...
output:
7436 4816 1 2 3 599 4 3 2 4 5 5 1 2 4 417 2 2 1 2 2 4 2 2 4 370 3 3 2 4 2 2 5 3 5 5 3 3 6 2 2 2 2 5 4 5 3 5 4 4 3 4 9 8 8 2 10 6 2 8 2 2 1 1 2 23 7 3 6 2 3 1 2 2 3 5 9 1 5 6 5 2 5 1 3 4 7 3 3 6 4 4 10 4 1 3 6 2 3 2 4 9 5 4 3 3 2 3 2 1 5 3 3 3 4 3 2 2 2 2 3 2 6 4 2 2 3 10 4 5 8 6 4 8 6 2 3 3 5 6 3 4 ...
result:
ok 351 lines
Test #13:
score: 5
Accepted
time: 30ms
memory: 25784kb
input:
58249 5199 35960691 742088334 754470754 742088334 201719914 10667096 201719914 509615858 201719914 742088334 754470754 35960691 754470754 742088334 201719914 35960691 742088334 754470754 679122297 10667096 754470754 679122297 35960691 679122297 742088334 679122297 742088334 742088334 509615858 67912...
output:
18238 796 2 4 1 2 1 2 3 3 1 2 1 2 3 3 3 2 4 4 1 5 1 3 1 6 5 2 155 2 3 3 2 6 3 2 9 3 1 5 5 2 3 3 3 6 4 7 4 7 5 3 2 2 4 2 4 1 1 2 5 9 1 5 4 4 6 1 1 3 3 4 4 3 3 1 2 4 4 4 4 4 5 4 2 3 5 6 2 2 1 3 1 2 5 6 3 2 3 2 3 3 2 5 10 2 5 2 3 2 3 2 2 2 4 2 2 1 1 7 7 1 3 8 3 3 2 6 3 1 8 4 1 1 1 2 10 1 2 7 4 3 3 3 4 ...
result:
ok 2620 lines
Test #14:
score: 5
Accepted
time: 86ms
memory: 30168kb
input:
95395 66806 1 1 2 2 1 1 2 1 2 1 2 2 1 1 1 1 2 2 1 1 1 1 2 1 2 2 1 2 1 2 1 2 1 2 2 1 2 2 2 1 2 2 2 1 1 2 1 1 1 2 2 2 1 2 1 2 2 1 1 1 1 1 2 1 2 2 1 2 2 2 2 2 1 2 1 2 2 2 2 2 1 2 2 1 1 2 2 1 2 2 2 1 1 1 1 2 1 1 1 1 1 1 2 2 2 2 2 2 2 2 1 2 2 2 1 1 2 2 1 1 1 2 2 2 2 2 1 1 2 2 2 1 2 2 1 1 2 2 2 2 2 1 2 1 ...
output:
4503 14289 1962 1 2380 2 1 1 2 3 1449 3 3 3 2 1 1 2 3 4 1 2 3 2 3 1 1 2 3 958 2 1 3 2 1 2 2 4 3 2 1 3 5 4 1 6 4 1 3 2 1 2 3 1 4 4 3 3 3 5 2 2 4 3 4 1 4 3 1 2 1 1 1 1 2 2 2 2 1 1 1 1 1 4 2 2 4 3 1 4 5 3 1 3 1 3 3 5 5 2 4 2 4 4 1 2 3 4 1 3 2 1 2 2 3 2 4 5 5 2 1 2 2 3 7 3 6 6 9 8 2 2 1 2 1 2 4 1 1 2 1 ...
result:
ok 33309 lines
Test #15:
score: 5
Accepted
time: 87ms
memory: 25892kb
input:
50377 82463 94464650 910420457 94464650 92535436 713395761 808844549 94464650 94464650 299731939 448587611 628316137 955272366 65744332 92535436 94464650 628316137 92535436 443973575 92535436 628316137 713395761 299731939 448587611 92535436 955272366 443973575 92535436 65744332 448587611 955272366 9...
output:
6370 7648 1 4226 1 3035 1 4276 5532 6566 1738 3 2052 2053 3 3 419 753 2 1 4 4 4 4 4 2 2 3 2 4 3 9 3 5 3 3 2 2 4 3 3 2 2 2 12 7 2 2 4 3 10 6 9 2 5 4 4 3 5 2 1 7 3 4 3 2 1 2 3 5 6 1 8 4 5 3 3 5 6 3 3 3 1 7 2 4 2 10 4 7 4 5 5 7 8 4 4 3 25 3 5 2 5 1 5 2 4 10 78 9 4 3 8 4 4 5 3 4 4 6 4 2 3 6 3 63 3 4 11 ...
result:
ok 41202 lines
Test #16:
score: 5
Accepted
time: 83ms
memory: 27532kb
input:
67921 71216 632455713 324022110 920097074 220771426 131923257 855782068 736322372 131923257 920097074 920097074 220771426 736322372 131923257 131923257 324022110 632455713 855782068 250588434 250588434 736322372 453990396 736322372 920097074 832040276 453990396 250588434 220771426 220771426 73632237...
output:
2914 1 3 95 4 2 5 1806 3 2 4 2 2 648 2 3 2 140 3 2 2 2 4 1 4 2 3 5 3 8 8 2 4 2 2 3 6 6 7 3 1 5 4 2 5 2 3 3 5 4 10 6 2 2 3 2 2 2 4 6 4 3 3 3 5 6 3 4 3 3 2 3 27 3 2 3 4 1 3 2 4 1 6 2 4 5 4 2 5 3 4 3 2 2 3 4 5 6 1 3 2 2 3 3 3 1 1 4 2 2 5 4 3 4 2 4 2 3 3 3 3 3 1 5 4 4 1 1 6 5 4 2 4 5 1 3 5 2 1 2 4 2 4 2...
result:
ok 35532 lines
Test #17:
score: 5
Accepted
time: 83ms
memory: 24840kb
input:
50103 83917 283207324 660780352 446073872 580363848 580363848 529518322 283207324 189849725 625665460 283207324 446073872 660780352 3704658 857390682 475716920 283207324 857390682 446073872 937124169 580363848 625665460 506098143 857390682 446073872 3704658 625665460 3704658 189849725 3704658 283207...
output:
2706 903 8491 3 1256 683 2 2 2 1987 3 518 2 2 1 2 1 3 1 6 4 2 6 2 1 6 2 5 2 7 3 4 1 2 6 2 2 2 4 8 3 10 7 9 1 5 1 10 4 1 3 2 6 2 2 7 4 2 4 4 2 4 5 3 6 10 4 6 1 1 2 4 8 2 2 3 6 4 4 6 4 2 6 6 7 2 1 1 2 5 2 7 4 3 7 2 4 1 3 9 5 4 9 9 2 3 2 2 5 2 2 2 1 5 1 4 2 2 7 4 6 3 5 6 1 4 4 1 5 5 2 3 1 3 2 2 1 1 2 3...
result:
ok 41915 lines
Test #18:
score: 5
Accepted
time: 26ms
memory: 12076kb
input:
69 64849 933094921 87175376 68802819 350187639 920627038 649522981 920627038 933094921 933094921 18729294 603394085 632848066 649522981 750251571 87175376 920627038 18729294 649522981 87175376 603394085 68802819 649522981 7874835 632848066 603394085 920627038 7874835 920627038 920627038 603394085 60...
output:
5 2 4 2 6 1 8 2 3 3 4 2 3 2 1 3 3 1 2 2 4 3 2 2 1 4 3 3 1 1 3 4 1 2 4 3 3 2 2 6 4 1 2 2 1 10 2 2 4 6 2 3 3 2 5 3 2 2 1 5 5 3 1 5 6 3 2 3 2 6 6 8 3 2 4 2 4 6 5 4 1 4 1 6 2 9 9 3 3 5 3 3 4 3 4 5 2 3 2 3 3 5 4 2 2 1 2 3 4 3 2 2 5 7 6 3 3 3 3 4 7 2 1 2 3 1 2 2 4 4 2 1 1 2 2 2 3 1 2 2 2 2 2 2 3 3 3 4 6 3...
result:
ok 32315 lines
Test #19:
score: 5
Accepted
time: 42ms
memory: 16332kb
input:
629 88514 170532224 428405086 563952643 5262915 5262915 2225293 970154739 517717091 72948585 517717091 354912107 346081200 354912107 112402357 346081200 5262915 2225293 170532224 428405086 72948585 915738263 563952643 915738263 346081200 517717091 563952643 915738263 5262915 428405086 428405086 3549...
output:
60 3 2 4 5 1 4 2 3 3 24 2 14 2 19 1 5 6 6 2 5 1 2 5 3 9 4 3 5 8 5 6 5 3 3 6 7 12 3 5 3 4 3 4 3 5 8 3 4 4 5 2 4 7 2 1 4 6 3 2 4 6 3 6 3 5 3 2 4 4 3 1 6 4 6 3 5 4 2 3 8 5 7 5 3 4 1 7 5 2 4 2 6 5 3 4 6 1 5 6 3 3 3 8 2 1 2 4 4 4 4 3 4 3 2 9 1 7 3 2 8 8 6 3 3 4 3 4 5 2 3 5 4 2 1 2 2 3 6 2 5 5 2 1 7 3 9 2...
result:
ok 44253 lines
Test #20:
score: 5
Accepted
time: 57ms
memory: 18888kb
input:
6838 94508 596286429 53183315 62078433 11309420 519096818 610549465 53183315 53183315 11309420 596286429 70712202 199374110 294093829 610549465 11309420 53183315 11309420 199374110 11309420 610549465 294093829 294093829 53183315 53183315 11309420 610549465 199374110 183127715 610549465 294093829 531...
output:
42 4 247 7 8 65 2 96 2 155 1 4 2 2 78 5 4 3 2 3 2 1 3 3 22 2 4 37 5 2 2 1 3 3 3 3 4 4 1 8 3 6 3 3 2 6 2 90 5 2 2 4 1 2 4 3 4 1 2 3 7 3 5 2 3 3 4 1 4 5 1 3 5 7 3 3 4 2 2 3 9 2 18 6 3 8 3 3 2 6 2 7 1 8 2 4 2 2 7 3 3 1 4 3 5 6 3 5 4 3 5 3 2 19 2 6 2 5 10 4 7 5 34 1 2 1 2 3 2 2 3 1 3 2 4 5 1 5 1 3 4 1 2...
result:
ok 47170 lines