QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#421340 | #892. Minimal Cut | AFewSuns | AC ✓ | 211ms | 724116kb | C++20 | 5.1kb | 2024-05-25 16:44:10 | 2024-05-25 16:44:11 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
namespace my_std{
#define ll long long
#define bl bool
ll my_pow(ll a,ll b,ll mod){
ll res=1;
if(!b) return 1;
while(b){
if(b&1) res=(res*a)%mod;
a=(a*a)%mod;
b>>=1;
}
return res;
}
ll qpow(ll a,ll b){
ll res=1;
if(!b) return 1;
while(b){
if(b&1) res*=a;
a*=a;
b>>=1;
}
return res;
}
#define db double
#define pf printf
#define pc putchar
#define fr(i,x,y) for(register ll i=(x);i<=(y);i++)
#define pfr(i,x,y) for(register ll i=(x);i>=(y);i--)
#define go(u) for(ll i=head[u];i;i=e[i].nxt)
#define enter pc('\n')
#define space pc(' ')
#define fir first
#define sec second
#define MP make_pair
#define il inline
#define inf 1e18
#define random(x) rand()*rand()%(x)
#define inv(a,mod) my_pow((a),(mod-2),(mod))
il ll read(){
ll sum=0,f=1;
char ch=0;
while(!isdigit(ch)){
if(ch=='-') f=-1;
ch=getchar();
}
while(isdigit(ch)){
sum=sum*10+(ch^48);
ch=getchar();
}
return sum*f;
}
il void write(ll x){
if(x<0){
x=-x;
pc('-');
}
if(x>9) write(x/10);
pc(x%10+'0');
}
il void writeln(ll x){
write(x);
enter;
}
il void writesp(ll x){
write(x);
space;
}
}
using namespace my_std;
#define LC tree[x].lc
#define RC tree[x].rc
#define mod 998244353
vector<pair<pair<ll,ll>,ll> > ins1[20020],del1[20020],ins2[20020],del2[20020];
pair<ll,pair<ll,ll> > e[20020];
ll n,m,rt1[20020],rt2[20020],tot=0,cnt=0,fa[20020],siz[20020],ans=0;
struct nd{
ll t,pos,val;
};
il bl operator<(const nd &x,const nd &y){
return x.val<y.val;
}
il nd operator+(const nd &x,const nd &y){
return (nd){y.t,x.pos,x.val+y.val};
}
struct node{
nd minn,hminn,lz,lzmin;
ll lc,rc;
il void addtag(nd tg,nd tgmin){
hminn=min(hminn,minn+tgmin);
lzmin=min(lzmin,lz+tgmin);
minn=minn+tg;
lz=lz+tg;
}
}tree[10000010];
il void pushup(ll x){
tree[x].minn=min(tree[LC].minn,tree[RC].minn);
tree[x].hminn=min(tree[LC].hminn,tree[RC].hminn);
}
il void pushdown(ll x){
if(tree[x].lz.t){
tree[LC].addtag(tree[x].lz,tree[x].lzmin);
tree[RC].addtag(tree[x].lz,tree[x].lzmin);
}
tree[x].lz=tree[x].lzmin=(nd){0,0,0};
}
void build(ll &x,ll l,ll r){
x=++tot;
tree[x]=(node){(nd){0,l,(ll)inf},(nd){0,l,(ll)inf},(nd){0,0,0},(nd){0,0,0},0,0};
if(l==r) return;
ll mid=(l+r)>>1;
build(LC,l,mid);
build(RC,mid+1,r);
}
void mdf(ll x,ll l,ll r,ll ql,ll qr,nd v){
if(ql<=l&&r<=qr){
tree[x].addtag(v,v);
return;
}
tree[++tot]=tree[LC];
tree[++tot]=tree[RC];
LC=tot-1;
RC=tot;
pushdown(x);
ll mid=(l+r)>>1;
if(ql<=mid) mdf(LC,l,mid,ql,qr,v);
if(mid<qr) mdf(RC,mid+1,r,ql,qr,v);
pushup(x);
}
nd query(ll x,ll l,ll r,ll ql,ll qr,nd tg,nd tgmin){
if(ql<=l&&r<=qr) return min(tree[x].hminn,tree[x].minn+tgmin);
if(!tg.t){
tg=tree[x].lz;
tgmin=tree[x].lzmin;
}
else{
tgmin=min(tree[x].lzmin,tree[x].lz+tgmin);
tg=tree[x].lz+tg;
}
ll mid=(l+r)>>1;
nd res=(nd){0,0,(ll)inf};
if(ql<=mid) res=min(res,query(LC,l,mid,ql,qr,tg,tgmin));
if(mid<qr) res=min(res,query(RC,mid+1,r,ql,qr,tg,tgmin));
return res;
}
il void ins(ll l1,ll r1,ll l2,ll r2,ll w){
if(l1>r1||l2>r2) return;
ins1[l1].push_back(MP(MP(l2,r2),w));
del1[r1+1].push_back(MP(MP(l2,r2),w));
ins2[r2].push_back(MP(MP(l1,r1),w));
del2[l2-1].push_back(MP(MP(l1,r1),w));
}
il nd calc(ll l,ll r){
nd res1=(nd){0,0,(ll)inf},res2=(nd){0,0,(ll)inf};
if(1<l) res1=query(rt1[l-1],1,n,l,r-1,(nd){0,0,0},(nd){0,0,0});
res2=query(rt2[r],1,n,l,r-1,(nd){0,0,0},(nd){0,0,0});
if(res1<res2) return res1;
return (nd){res2.pos,res2.t,res2.val};
}
void solve(ll l,ll r){
if(l==r) return;
nd tmp=calc(l,r);
e[++cnt]=MP(tmp.val,MP(l,r));
if(tmp.t<l) swap(tmp.t,tmp.pos);
solve(l,tmp.t);
solve(tmp.t+1,r);
}
ll find(ll x){
if(x==fa[x]) return x;
return fa[x]=find(fa[x]);
}
int main(){
n=read();
m=read();
fr(i,1,m){
ll u=read(),v=read(),w=read();
if(u>v) swap(u,v);
ins(1,u-1,u,v-1,w);
ins(u,v-1,v,n,w);
}
build(rt1[0],1,n);
del1[1].push_back(MP(MP(1,n),(ll)inf));
del2[n].push_back(MP(MP(1,n),(ll)inf));
fr(i,1,n){
rt1[i]=rt1[i-1];
fr(j,0,(ll)ins1[i].size()-1){
tree[++tot]=tree[rt1[i]];
rt1[i]=tot;
mdf(rt1[i],1,n,ins1[i][j].fir.fir,ins1[i][j].fir.sec,(nd){i,0,ins1[i][j].sec});
}
fr(j,0,(ll)del1[i].size()-1){
tree[++tot]=tree[rt1[i]];
rt1[i]=tot;
mdf(rt1[i],1,n,del1[i][j].fir.fir,del1[i][j].fir.sec,(nd){i,0,-del1[i][j].sec});
}
}
build(rt2[n+1],1,n);
pfr(i,n,1){
rt2[i]=rt2[i+1];
fr(j,0,(ll)ins2[i].size()-1){
tree[++tot]=tree[rt2[i]];
rt2[i]=tot;
mdf(rt2[i],1,n,ins2[i][j].fir.fir,ins2[i][j].fir.sec,(nd){i,0,ins2[i][j].sec});
}
fr(j,0,(ll)del2[i].size()-1){
tree[++tot]=tree[rt2[i]];
rt2[i]=tot;
mdf(rt2[i],1,n,del2[i][j].fir.fir,del2[i][j].fir.sec,(nd){i,0,-del2[i][j].sec});
}
}
solve(1,n);
sort(e+1,e+cnt+1);
fr(i,1,n) fa[i]=i;
fr(i,1,n) siz[i]=1;
pfr(i,cnt,1){
ll x=find(e[i].sec.fir),y=find(e[i].sec.sec);
ans+=siz[x]*siz[y]*e[i].fir;
fa[y]=x;
siz[x]+=siz[y];
}
write((ans%mod+(n*(n-1)/2)*2000000000%mod)%mod);
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 5604kb
input:
4 2 1 3 2 2 4 2
output:
21067776
result:
ok "21067776"
Test #2:
score: 0
Accepted
time: 0ms
memory: 9372kb
input:
79 190 24 30 8372 16 17 3623 47 43 577 47 45 10000 50 49 9644 35 25 882 23 24 1994 54 55 7778 32 33 230 52 53 6078 5 10 8214 25 26 6829 21 22 340 67 68 6066 10 1 8104 9 10 3085 44 43 5659 33 34 5505 7 10 337 12 13 3804 5 1 4735 25 28 6650 61 60 9290 14 6 9857 38 35 6228 48 49 3076 60 59 4972 54 52 4...
output:
844859152
result:
ok "844859152"
Test #3:
score: 0
Accepted
time: 2ms
memory: 9628kb
input:
71 199 20 19 869 46 61 9375 62 52 877 32 31 267 41 63 678 25 23 1224 61 62 103 28 29 4640 51 52 2086 47 49 5163 27 28 3198 9 8 5530 68 69 5035 26 28 7214 36 40 8779 11 12 2949 10 11 5381 1 71 1450 23 24 4741 33 32 6857 6 9 8673 34 39 6459 32 33 1827 14 13 8042 5 6 51 70 6 146 21 22 276 20 17 5504 18...
output:
746051489
result:
ok "746051489"
Test #4:
score: 0
Accepted
time: 2ms
memory: 8576kb
input:
78 190 54 66 589 64 65 9958 71 72 2115 77 73 5248 54 58 5868 68 57 72 56 60 1476 1 77 7739 16 17 9093 60 59 5315 20 14 313 6 59 277 60 64 3132 75 72 455 63 64 6752 30 38 4810 71 76 2424 30 31 8090 71 73 6643 26 27 3489 4 60 315 62 63 8501 38 39 7761 61 59 2258 46 47 5454 17 18 972 59 55 333 69 56 73...
output:
582293834
result:
ok "582293834"
Test #5:
score: 0
Accepted
time: 2ms
memory: 8740kb
input:
74 198 10 11 767 25 26 4090 46 42 1653 2 5 3333 43 38 7106 53 52 6205 4 2 529 20 27 3335 49 52 2604 21 15 5265 28 29 949 8 7 4439 55 56 99 7 8 238 66 69 7812 17 29 1364 39 47 1270 9 8 5229 5 4 3465 43 42 7064 30 31 7767 25 32 5244 30 31 7196 7 9 3118 56 57 5779 43 39 9187 51 50 5735 16 12 7606 40 41...
output:
508442899
result:
ok "508442899"
Test #6:
score: 0
Accepted
time: 0ms
memory: 9516kb
input:
78 192 21 22 4125 3 4 3230 71 72 4489 76 77 8868 55 56 7672 17 18 5081 30 29 1254 18 19 3896 39 32 8008 7 8 7118 70 71 3546 47 39 994 12 13 4972 77 78 123 12 13 1701 8 7 1029 63 1 478 31 28 4211 5 6 8249 77 74 4092 73 74 795 51 52 6818 5 6 8430 9 10 7953 14 15 8539 45 46 3682 11 9 9308 15 17 2643 12...
output:
568925767
result:
ok "568925767"
Test #7:
score: 0
Accepted
time: 0ms
memory: 9548kb
input:
71 192 44 28 4637 45 27 8128 61 11 4055 3 69 777 71 1 7158 9 63 5849 55 17 1415 42 30 1583 17 55 7200 12 60 5049 42 30 2190 14 58 9752 40 32 2155 22 50 2608 55 17 422 64 8 6165 27 45 4354 48 24 2506 67 5 6327 45 27 4340 56 16 6535 6 66 5083 47 25 7297 33 39 1273 23 49 8104 12 60 8773 62 10 472 70 2 ...
output:
740575153
result:
ok "740575153"
Test #8:
score: 0
Accepted
time: 2ms
memory: 12104kb
input:
74 196 19 56 2208 20 55 5639 58 17 5675 68 7 3559 10 65 873 25 50 193 50 25 6346 54 21 931 56 19 6211 59 16 6563 7 68 7976 35 40 7101 67 8 2437 53 22 7139 7 68 8435 9 66 464 57 18 9881 18 57 1338 57 18 3184 2 73 7381 34 41 5615 36 39 3187 58 17 2430 66 9 7393 55 20 1222 41 34 1139 68 7 5408 39 36 16...
output:
500821698
result:
ok "500821698"
Test #9:
score: 0
Accepted
time: 2ms
memory: 8952kb
input:
77 192 15 55 74 46 5 1414 67 68 4865 8 25 3974 41 31 2480 42 63 3038 22 77 1372 37 17 1208 50 17 2197 58 68 669 1 22 1878 11 49 1465 74 2 3145 11 20 4555 42 25 979 50 49 7595 71 16 2859 13 77 4927 31 21 2599 21 23 1947 28 25 7614 28 58 1171 72 49 1826 70 58 731 48 74 2202 60 72 2635 52 27 1781 34 2 ...
output:
319693148
result:
ok "319693148"
Test #10:
score: 0
Accepted
time: 0ms
memory: 9992kb
input:
76 190 50 34 4806 62 10 2548 45 34 2023 21 28 189 17 49 2411 50 39 3689 28 11 2519 59 32 2598 72 64 8754 31 56 1325 57 58 3376 47 46 6921 28 61 752 75 35 1452 9 33 1213 63 19 208 42 73 1115 22 40 929 59 53 1063 46 51 5736 35 15 994 22 23 5109 49 21 428 12 58 494 47 74 2423 1 5 8528 29 75 2183 43 6 1...
output:
50667227
result:
ok "50667227"
Test #11:
score: 0
Accepted
time: 0ms
memory: 9816kb
input:
71 196 12 37 1395 29 70 684 3 38 855 37 36 2708 69 37 1550 47 52 9602 19 45 1957 14 9 7724 63 52 1541 18 14 8279 64 50 2595 33 69 1303 33 57 989 12 17 4600 50 64 3908 60 29 468 15 24 1803 64 39 1795 34 42 2170 28 23 1308 33 45 428 16 20 131 28 8 1027 42 49 1658 48 53 772 69 23 509 69 50 3253 9 42 16...
output:
765565056
result:
ok "765565056"
Test #12:
score: 0
Accepted
time: 0ms
memory: 22176kb
input:
293 993 140 142 9682 232 243 313 67 68 5028 130 129 5855 36 35 8091 96 95 2322 68 67 2355 176 175 4817 242 238 5923 213 211 2343 278 277 6300 281 283 596 269 265 642 160 165 1585 274 275 2148 224 225 9745 99 98 680 130 127 4692 224 222 7351 270 271 5653 140 142 5254 219 217 7041 204 203 1154 263 266...
output:
487446357
result:
ok "487446357"
Test #13:
score: 0
Accepted
time: 4ms
memory: 20988kb
input:
297 993 240 241 6989 266 264 4892 280 281 6358 266 267 5237 88 84 6062 281 286 5497 1 296 3082 49 48 9502 148 149 9732 294 1 4162 176 174 5358 216 217 2924 279 283 61 9 10 681 42 43 2886 43 38 1310 22 24 690 128 129 9666 10 9 7299 26 28 7230 19 21 2030 173 171 8453 34 31 4980 148 149 6886 166 167 33...
output:
635119625
result:
ok "635119625"
Test #14:
score: 0
Accepted
time: 6ms
memory: 20932kb
input:
291 991 205 204 7961 153 148 7043 56 54 3207 130 129 235 47 49 982 7 6 7918 70 74 66 259 260 5461 199 200 4584 271 273 8554 130 128 8487 23 22 7830 269 274 811 94 95 7381 98 99 4011 170 171 8357 83 86 2266 10 9 4076 152 148 2084 143 142 4403 70 71 3178 8 9 6140 110 111 9432 156 157 5593 147 146 2216...
output:
435016731
result:
ok "435016731"
Test #15:
score: 0
Accepted
time: 6ms
memory: 21328kb
input:
294 997 31 27 1334 48 43 9810 40 41 6209 260 270 7098 246 245 3813 246 247 2591 94 87 6194 220 221 1845 94 95 747 33 34 6336 73 67 8120 212 213 5883 127 144 7212 231 239 7259 35 38 767 35 33 4346 92 91 4569 126 127 1683 74 84 7833 89 90 4039 141 106 9006 183 190 9225 100 101 7471 31 34 148 280 282 6...
output:
585062748
result:
ok "585062748"
Test #16:
score: 0
Accepted
time: 0ms
memory: 21748kb
input:
298 992 260 261 8940 229 228 7784 37 38 3250 59 60 3266 43 42 8674 194 195 4921 202 200 941 110 114 5448 225 226 3661 204 205 3635 238 240 896 98 105 867 33 34 5019 13 14 1558 163 159 9152 36 40 8423 226 225 8471 250 251 9567 207 209 6328 77 78 8566 282 283 9587 32 33 2271 62 63 7413 122 123 303 201...
output:
676742353
result:
ok "676742353"
Test #17:
score: 0
Accepted
time: 0ms
memory: 25984kb
input:
291 997 140 152 2769 165 127 7362 191 101 3702 17 275 6461 162 130 7143 52 240 7388 240 52 6220 285 7 5148 286 6 1998 161 131 542 136 156 8621 36 256 6382 287 5 4876 118 174 1539 182 110 5065 149 143 7397 130 162 1150 186 106 8769 22 270 9991 48 244 8800 161 131 3201 46 246 9799 4 288 9053 53 239 74...
output:
423941983
result:
ok "423941983"
Test #18:
score: 0
Accepted
time: 6ms
memory: 25004kb
input:
297 998 80 218 6306 187 111 4494 158 140 5704 122 176 7475 31 267 969 293 5 5388 147 151 1299 289 9 7048 48 250 757 293 5 5914 5 293 223 63 235 6179 188 110 6762 154 144 9141 14 284 355 244 54 8132 46 252 6727 231 67 1171 244 54 6727 32 266 1816 198 100 1956 107 191 7170 112 186 8344 41 257 1620 269...
output:
617769996
result:
ok "617769996"
Test #19:
score: 0
Accepted
time: 3ms
memory: 25316kb
input:
299 994 44 136 381 161 120 1914 267 44 1155 204 232 2751 235 13 163 36 25 4549 195 285 717 188 3 571 72 250 459 106 201 989 92 281 191 37 250 618 183 84 891 137 60 1146 46 135 122 106 205 545 45 22 182 122 238 257 283 98 363 137 215 1056 4 294 3498 73 116 198 96 111 4957 138 29 407 138 7 114 21 154 ...
output:
895803524
result:
ok "895803524"
Test #20:
score: 0
Accepted
time: 3ms
memory: 26588kb
input:
294 991 258 164 932 35 44 3568 284 293 683 160 111 222 274 49 744 165 108 1098 54 106 576 293 168 428 186 219 2100 237 76 135 132 174 175 56 274 1168 190 138 1286 20 218 367 42 74 1586 105 279 181 146 208 391 98 292 140 268 119 387 124 21 198 37 281 1038 112 178 1060 246 168 124 27 229 250 117 280 2...
output:
704435821
result:
ok "704435821"
Test #21:
score: 0
Accepted
time: 0ms
memory: 25508kb
input:
295 997 38 250 335 95 66 3294 23 26 6828 248 116 63 271 120 28 260 160 238 102 118 2914 244 137 765 253 247 5979 40 99 371 249 112 136 193 70 738 287 40 1432 96 227 220 61 20 399 5 42 2190 63 199 235 148 247 532 27 150 680 36 33 163 236 109 613 204 281 1151 286 130 643 225 293 38 153 79 372 11 181 5...
output:
724135682
result:
ok "724135682"
Test #22:
score: 0
Accepted
time: 83ms
memory: 520268kb
input:
18294 19992 7993 7990 4961 3549 3550 4737 15480 15481 5224 11212 11213 7993 15209 15210 661 13866 13867 5556 15788 15789 9331 7279 7280 260 4084 4085 3153 16816 16817 4944 16503 16504 6105 3542 3543 6081 555 556 5133 7461 7462 446 3027 3028 2409 16493 16494 1055 1511 1512 5530 10259 10260 7165 16503...
output:
586636932
result:
ok "586636932"
Test #23:
score: 0
Accepted
time: 93ms
memory: 519608kb
input:
18415 19990 7606 7604 3349 6292 6293 5062 85 86 1933 12504 12505 7946 4767 4769 2839 7192 7193 3527 883 882 7618 516 515 2528 6698 6699 611 11141 11142 2514 5300 5301 3606 11698 11699 28 1388 1389 7922 6806 6807 31 9144 9145 8030 3239 3238 1881 5045 5046 4356 10851 10847 6483 8142 8143 5072 10465 10...
output:
295153184
result:
ok "295153184"
Test #24:
score: 0
Accepted
time: 117ms
memory: 510856kb
input:
15997 19990 14308 14309 2217 9943 9949 4228 3824 3825 8905 3596 3597 7959 9035 9036 9142 914 915 5631 14354 14357 952 15689 15690 4267 9988 9989 5266 7805 7807 1 109 110 1495 11953 11954 9977 9272 9273 3500 8470 8468 4943 13399 13400 3016 2492 2493 8679 3263 3264 2347 10315 10316 4148 12445 12451 57...
output:
485780517
result:
ok "485780517"
Test #25:
score: 0
Accepted
time: 117ms
memory: 519448kb
input:
17944 19993 3874 3875 2925 7905 7906 4257 10404 10405 1385 9219 9220 477 855 856 5135 17502 17503 6840 11555 11556 8013 5078 5079 8098 8678 8679 9161 3502 3503 6083 10940 10941 2581 13371 13372 6818 2409 2410 811 7550 7551 4499 12131 12132 4738 8117 8118 973 5605 5606 1940 6148 6142 7713 12799 12800...
output:
962907128
result:
ok "962907128"
Test #26:
score: 0
Accepted
time: 100ms
memory: 522308kb
input:
19255 19992 3890 3889 2259 11103 11104 421 2452 2455 4086 3377 3378 3477 3908 3909 9121 13669 13670 1287 2389 2390 6846 9707 9708 8229 18640 18641 2928 10706 10707 1789 2691 2692 7469 19118 19119 969 2094 2095 1814 11550 11549 593 12347 12350 4454 1811 1812 4612 8397 8398 9332 9646 9647 229 4252 425...
output:
173342232
result:
ok "173342232"
Test #27:
score: 0
Accepted
time: 92ms
memory: 518324kb
input:
17943 19996 15749 15750 6453 13736 13737 3619 11663 11666 7150 14398 14399 415 13582 13583 7588 8592 8593 6536 3550 3552 807 8316 8317 9360 13862 13870 3457 16294 16293 6364 7786 7787 4359 1097 1098 346 1186 1187 1950 1794 1797 7272 12480 12481 352 5351 5352 148 13211 13210 1656 5963 5964 6804 12762...
output:
538214981
result:
ok "538214981"
Test #28:
score: 0
Accepted
time: 88ms
memory: 519212kb
input:
17980 19996 15908 15909 7148 17816 17817 6708 12329 12330 1595 437 438 2264 11876 11877 5944 17707 17708 6725 12511 12513 3931 14502 14510 9398 17577 17578 2276 12777 12778 7118 9317 9307 5833 2172 2173 8338 17973 17974 5543 17006 17007 5277 10898 10897 5470 14981 14980 9160 15043 15044 2680 14904 1...
output:
496568492
result:
ok "496568492"
Test #29:
score: 0
Accepted
time: 146ms
memory: 518144kb
input:
17909 19999 525 526 1970 12808 12809 3450 2146 2142 5107 10075 10088 4298 9214 9215 4264 17493 17494 4707 17374 17373 6992 71 72 9672 1842 1844 3367 16856 16857 7355 5400 5401 841 5565 5566 8163 10590 10591 8765 6303 6300 1992 1294 1295 441 4625 4628 1 12951 12952 1548 5585 5586 1959 17479 17487 711...
output:
843763641
result:
ok "843763641"
Test #30:
score: 0
Accepted
time: 84ms
memory: 513984kb
input:
17130 19992 2316 2317 2372 9998 9999 8452 14736 14737 629 11009 11010 3713 1775 1774 4704 10472 10473 3621 14996 14997 9098 8093 8094 2349 16231 16232 7191 13457 13458 6067 6269 6270 4922 2804 2801 5899 1824 1825 313 13972 13973 4458 14486 14484 154 15049 15050 5857 8691 8692 2934 67 68 370 1741 174...
output:
801212583
result:
ok "801212583"
Test #31:
score: 0
Accepted
time: 126ms
memory: 512624kb
input:
15926 19991 1708 1709 4365 1818 1819 6662 12878 12879 6544 4672 4674 4987 15844 15845 4583 3985 3986 4306 7063 7064 2031 11520 11519 3941 2439 2440 4925 6405 6406 9093 9888 9889 3732 7015 7016 1395 8584 8579 5398 8157 8158 1846 7142 7141 6176 11724 11725 2694 3812 3813 9964 12100 12101 7683 7855 785...
output:
537750610
result:
ok "537750610"
Test #32:
score: 0
Accepted
time: 197ms
memory: 723088kb
input:
19990 19992 16899 3092 3908 17950 2041 3428 17569 2422 8646 15741 4250 9804 19472 519 9232 12144 7847 7512 17116 2875 8327 11645 8346 4544 78 19913 1972 2273 17718 8952 2839 17152 7236 6713 13278 4374 15342 4649 8004 19094 897 5871 2980 17011 9106 9375 10616 4246 8027 11964 1862 4581 15410 7035 1579...
output:
511293866
result:
ok "511293866"
Test #33:
score: 0
Accepted
time: 143ms
memory: 696788kb
input:
14990 19993 5358 9633 1127 4986 10005 8215 5714 9277 5546 14406 585 1932 14048 943 6849 5275 9716 4360 5453 9538 2775 6594 8397 5708 1229 13762 6360 3989 11002 218 8325 6666 8664 14416 575 843 10903 4088 822 2129 12862 7809 1876 13115 9291 13519 1472 8776 8261 6730 9218 10004 4987 533 5377 9614 365 ...
output:
602932882
result:
ok "602932882"
Test #34:
score: 0
Accepted
time: 136ms
memory: 723528kb
input:
19998 19993 9063 10936 1720 19916 83 5631 11933 8066 2295 1066 18933 9947 2523 17476 7448 17504 2495 8493 1426 18573 5455 6929 13070 9626 4806 15193 2657 12650 7349 4150 9554 10445 7971 15484 4515 9728 2610 17389 3171 15525 4474 3713 12649 7350 9004 11866 8133 1993 18116 1883 9627 6296 13703 5543 14...
output:
123509616
result:
ok "123509616"
Test #35:
score: 0
Accepted
time: 139ms
memory: 696992kb
input:
14996 19995 12555 2442 9755 1914 13083 3916 12557 2440 8993 9823 5174 8179 5008 9989 8841 576 14421 399 8685 6312 592 2971 12026 3215 8941 6056 5508 5250 9747 4776 13708 1289 974 11333 3664 4134 14512 485 5095 11966 3031 1511 4973 10024 3533 8559 6438 6456 8287 6710 6310 6300 8697 7569 7299 7698 392...
output:
17680457
result:
ok "17680457"
Test #36:
score: 0
Accepted
time: 144ms
memory: 722128kb
input:
19998 19998 15634 4365 236 1240 18759 982 1764 18235 9142 13054 6945 5985 5222 14777 5851 6764 13235 7588 706 19293 357 8772 11227 6826 18736 1263 9983 16377 3622 7360 7151 12848 853 3742 16257 559 13948 6051 4711 12451 7548 8777 5597 14402 9643 9982 10017 5059 10709 9290 673 11812 8187 1164 7305 12...
output:
123671059
result:
ok "123671059"
Test #37:
score: 0
Accepted
time: 184ms
memory: 724116kb
input:
19997 19996 5356 14642 2997 12337 7661 8002 13502 6496 8752 4547 15451 6196 133 19865 2201 15307 4691 1086 12248 7750 5153 19656 342 5548 13958 6040 5754 1074 18924 9419 6381 13617 335 6200 13798 4102 10243 9755 6285 10501 9497 3701 9403 10595 8952 18501 1497 6394 12648 7350 2225 5184 14814 7236 114...
output:
783623704
result:
ok "783623704"
Test #38:
score: 0
Accepted
time: 158ms
memory: 723128kb
input:
19992 19991 8238 11755 3253 8902 11091 4720 15462 4531 8648 12649 7344 31 17931 2062 2419 5839 14154 7256 13071 6922 9394 3985 16008 771 15283 4710 2591 3875 16118 7077 10246 9747 6635 17439 2554 9523 15517 4476 7402 13872 6121 2591 11053 8940 2995 956 19037 6834 6758 13235 9719 7721 12272 5483 1917...
output:
143523736
result:
ok "143523736"
Test #39:
score: 0
Accepted
time: 150ms
memory: 723220kb
input:
19998 19990 5184 14815 1579 2960 17039 4710 16355 3644 5524 3095 16904 2484 1909 18090 8168 3461 16538 3483 9775 10224 8363 10637 9362 6621 15337 4662 6955 18328 1671 1836 13249 6750 1862 628 19371 1828 1505 18494 2073 11192 8807 2934 4355 15644 673 5183 14816 7701 10148 9851 346 5275 14724 1589 726...
output:
124282504
result:
ok "124282504"
Test #40:
score: 0
Accepted
time: 170ms
memory: 722940kb
input:
19990 19996 18682 1309 6175 4581 15410 3980 4840 15151 6084 485 19506 2228 13192 6799 7907 6424 13567 6329 3414 16577 9371 8779 11212 1634 623 19368 9826 7854 12137 1218 11074 8917 3663 15992 3999 1302 5309 14682 4093 16661 3330 2013 9647 10344 9217 15026 4965 8735 2436 17555 226 6547 13444 5384 167...
output:
510914706
result:
ok "510914706"
Test #41:
score: 0
Accepted
time: 155ms
memory: 723576kb
input:
19995 19996 3400 16596 7012 12204 7792 7760 9937 10059 7668 15946 4050 6071 7369 12627 7809 7642 12354 8745 15463 4533 1010 1451 18545 838 12605 7391 3877 2376 17620 1562 15935 4061 84 2825 17171 3355 2083 17913 3978 5525 14471 1384 13909 6087 184 3045 16951 1243 17058 2938 195 13345 6651 2109 14861...
output:
117651482
result:
ok "117651482"
Test #42:
score: 0
Accepted
time: 148ms
memory: 678740kb
input:
14994 19994 11042 8266 2 4778 2411 36 6056 4115 31 12900 8614 8 5113 3955 50 4593 8375 25 8771 9705 50 11140 4955 12 7214 14458 12 6274 653 6 2061 10574 9 78 14907 342 5607 10902 11 6161 11174 13 6875 6236 7 684 1058 160 12793 5095 11 13358 12300 69 10007 5568 6 1375 12207 9 4379 5193 56 949 14162 3...
output:
376765799
result:
ok "376765799"
Test #43:
score: 0
Accepted
time: 197ms
memory: 679588kb
input:
14998 19992 11326 11801 204 11681 9581 21 1370 7465 3 1448 10876 16 3406 11638 10 2500 8826 5 5658 1846 15 4147 3140 56 2905 4742 9 11053 10044 60 1778 8633 3 11833 14658 28 13900 2771 19 4439 7909 15 3707 3036 83 10501 4492 12 9919 7556 27 14325 4754 9 5079 6884 1 5635 14108 6 5633 14629 14 14586 7...
output:
441215096
result:
ok "441215096"
Test #44:
score: 0
Accepted
time: 172ms
memory: 682536kb
input:
14991 19996 9526 3131 8 13248 5428 3 1320 2550 24 7023 2159 7 5266 4406 97 9660 2019 11 7261 420 8 12819 13242 177 8940 11288 3 883 3092 6 1758 13051 26 11214 7427 7 12016 4087 6 2419 14357 16 13622 11034 1 13122 3745 9 6960 3020 16 9895 554 5 4897 6278 63 8717 12640 20 5700 3575 34 4941 7168 14 103...
output:
220242700
result:
ok "220242700"
Test #45:
score: 0
Accepted
time: 153ms
memory: 679164kb
input:
14993 19992 2931 973 41 4604 7848 3 283 6584 2 11096 7365 26 288 11163 16 5029 694 18 9994 3845 11 1130 6881 16 10935 13158 14 13427 14442 19 8343 3995 19 12175 14494 20 10333 5182 2 12708 12391 284 12813 14903 29 12518 4267 4 1707 1807 861 176 13333 31 9068 510 15 14990 13408 11 3140 14070 4 7921 1...
output:
651917145
result:
ok "651917145"
Test #46:
score: 0
Accepted
time: 211ms
memory: 681108kb
input:
14990 19991 10376 13932 17 5791 5278 1 11990 4440 13 477 998 107 12057 7872 1 9728 8910 45 2862 11954 4 631 7498 10 3883 5230 9 6050 11256 11 7134 12813 8 5448 3831 12 14771 3471 23 11890 905 18 10314 8179 3 5243 7211 16 578 12981 11 954 1475 20 7833 6408 60 11833 13792 47 5096 8271 21 11178 9195 43...
output:
425829772
result:
ok "425829772"