QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#208371 | #7077. Sheep Village | ucup-team1004 | AC ✓ | 52ms | 35932kb | C++14 | 2.5kb | 2023-10-09 15:03:03 | 2023-10-09 15:03:03 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
template<typename T>
ostream& operator << (ostream &out,const vector<T>&x){
if(x.empty())return out<<"[]";
out<<'['<<x[0];
for(int len=x.size(),i=1;i<len;i++)out<<','<<x[i];
return out<<']';
}
template<typename T>
vector<T> ary(const T *a,int l,int r){
return vector<T>{a+l,a+1+r};
}
template<typename T>
void debug(T x){
cerr<<x<<'\n';
}
template<typename T,typename ...S>
void debug(T x,S ...y){
cerr<<x<<' ',debug(y...);
}
const int N=1e5+10,M=N*2,V=N*2;
int n,m,k,a[V];
int kk=1,head[N];
struct edges{
int to,w,nex;
}edge[M*2];
void add(int u,int v,int w){
edge[++kk]={v,w,head[u]},head[u]=kk;
edge[++kk]={u,w,head[v]},head[v]=kk;
}
int dft,top,dfn[N],low[N],stk[N],nex[N];
vector<pair<int,int> >to[V];
void adde(int u,int v,int w){
// debug(u,v,w);
to[u].push_back({v,w}),to[v].push_back({u,w});
}
void tarjan(int u,int las=0){
dfn[u]=low[u]=++dft,stk[++top]=u;
for(int i=head[u];i;i=edge[i].nex){
if(!(i^las^1))continue;
int v=edge[i].to,w=edge[i].w;
if(!dfn[v]){
tarjan(v,i);
if(low[v]<low[u])low[u]=low[v],nex[u]=w;
if(low[v]>dfn[u]){
for(adde(u,v,w);stk[top--]^v;);
}else if(low[v]==dfn[u]){
adde(++m,u,w);
do adde(m,stk[top],nex[stk[top]]);while(stk[top--]^v);
}
}else if(dfn[v]<low[u])low[u]=dfn[v],nex[u]=w;
}
// debug("tarjan",u,nex[8]);
}
#define v e.first
#define w e.second
ll ans;
void dfs1(int u,int fa=0){
for(auto e:to[u])if(v^fa){
dfs1(v,u);
a[u]+=a[v];
if(u<=n&&v<=n)ans+=1ll*w*abs(a[v]);
}
}
int cnt,b[V],val[V];
ll c[V];
void dfs2(int u,int fa=0){
for(auto e:to[u])if(v^fa){
dfs2(v,u);
}
if(u>n){
cnt=0;
for(auto e:to[u]){
// debug(v);
if(v^fa)b[cnt]=a[v],val[cnt++]=w;
else b[cnt]=-a[u],val[cnt++]=w;
}
// debug(ary(b,0,cnt-1),ary(val,0,cnt-1));
auto calc=[&](int x){
c[0]=x;
for(int i=0;i+1<cnt;i++)c[i+1]=c[i]+b[i];
ll sum=0;
for(int i=0;i<cnt;i++)sum+=abs(c[i])*val[i];
return sum;
};
int l=-n,r=n,ml,mr;
for(;l+5<r;){
ml=(l+l+r)/3,mr=(l+r+r)/3;
if(calc(ml)>calc(mr))l=ml;
else r=mr;
}
ll res=calc(l);
for(;++l<=r;)res=min(res,calc(l));
// debug("res",res);
ans+=res;
}
}
#undef v
#undef w
int main(){
scanf("%d%d%d",&n,&m,&k);
for(int i=1,x;i<=k;i++)scanf("%d",&x),a[x]++;
for(int i=1,x;i<=k;i++)scanf("%d",&x),a[x]--;
// debug(ary(a,1,n));
for(int u,v,w;m--;){
scanf("%d%d%d",&u,&v,&w),add(u,v,w);
}
m=n,tarjan(1);
dfs1(1),dfs2(1);
cout<<ans<<endl;
return 0;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 16112kb
input:
5 8 4 2 2 3 3 4 4 5 5 1 2 1 2 1 1 1 3 1 3 1 1 1 4 1 4 1 1 1 5 1 5 1 1
output:
8
result:
ok single line: '8'
Test #2:
score: 0
Accepted
time: 2ms
memory: 12068kb
input:
5 5 3 1 3 3 5 2 4 1 2 3 2 3 1 3 4 1 4 5 4 5 1 1
output:
3
result:
ok single line: '3'
Test #3:
score: 0
Accepted
time: 0ms
memory: 12008kb
input:
5 5 3 1 3 5 5 2 4 1 2 2 2 3 1 3 4 2 4 5 2 5 1 3
output:
4
result:
ok single line: '4'
Test #4:
score: 0
Accepted
time: 0ms
memory: 13864kb
input:
3 2 2 1 2 2 3 1 2 1 2 3 2
output:
3
result:
ok single line: '3'
Test #5:
score: 0
Accepted
time: 0ms
memory: 12584kb
input:
10000 10099 5000 7587 9412 8274 6930 9225 635 2594 2668 8553 1318 676 4231 4050 7706 4727 3819 6583 7533 448 9343 7694 5948 201 7634 881 3670 2765 4213 2400 9326 5949 6751 8077 5341 5087 1944 5935 653 8601 2430 1999 7680 3482 9395 6766 6279 1297 8605 2766 3868 5236 3701 772 3912 8699 5064 9580 381 2...
output:
1490733617
result:
ok single line: '1490733617'
Test #6:
score: 0
Accepted
time: 2ms
memory: 16488kb
input:
10000 10099 5000 7888 6791 7163 5118 3904 4396 646 2505 1351 5400 1153 8173 8284 8109 6509 3989 6442 7374 703 3199 1137 2148 993 4013 4820 9050 7184 245 3513 4688 6717 5842 6604 4204 1932 7040 444 7428 5864 5187 5820 5909 9741 5633 8276 464 1612 9923 494 1655 3354 9528 8969 3828 609 370 2617 5459 54...
output:
1594717269
result:
ok single line: '1594717269'
Test #7:
score: 0
Accepted
time: 6ms
memory: 16704kb
input:
9888 10656 5000 9334 7313 6268 977 9201 6781 7246 3626 6871 5009 6889 9597 6098 3944 7585 4096 1760 7343 6910 7548 6450 4428 8701 525 5808 3124 9198 1477 1555 6355 5781 7593 9097 1896 3561 4306 7605 2214 8568 6541 8556 7765 5088 2267 3033 7438 9335 3282 7322 8995 2116 7482 2848 628 5476 6481 4179 42...
output:
3887649502
result:
ok single line: '3887649502'
Test #8:
score: 0
Accepted
time: 2ms
memory: 12060kb
input:
1000 1093 5000 836 921 174 72 155 80 701 387 53 737 700 846 879 695 346 723 497 783 155 434 632 203 468 936 828 592 361 970 538 520 703 7 28 688 186 268 700 530 272 181 501 21 132 98 602 248 284 87 196 883 924 388 296 998 721 347 686 815 542 293 924 121 42 965 378 176 152 555 611 38 158 867 642 976 ...
output:
199900533
result:
ok single line: '199900533'
Test #9:
score: 0
Accepted
time: 0ms
memory: 16792kb
input:
9999 10811 5000 4042 7720 8411 6764 6454 2190 4760 9091 161 6850 875 936 1099 3638 3596 984 8301 8649 4347 9485 3802 9413 2884 4709 8124 9136 4243 9246 4062 910 5963 6560 6032 1658 8401 1849 872 6338 3827 3342 3835 4868 2585 7822 5233 4040 2786 7667 2662 8410 9929 8635 9923 7082 5212 7218 2025 9022 ...
output:
2845095940
result:
ok single line: '2845095940'
Test #10:
score: 0
Accepted
time: 6ms
memory: 16600kb
input:
10000 11103 5000 4692 1594 7856 3219 9985 4248 4909 2573 6294 8956 7328 4636 726 2338 4186 8616 2204 398 9292 5807 7715 1750 15 3808 7726 1508 5694 3792 1489 9925 9222 2278 1574 3772 1565 7454 9498 6671 9064 953 6093 7577 6819 3162 3749 5015 8893 5883 556 7323 4393 791 1469 5820 3902 9629 2459 9892 ...
output:
610741889
result:
ok single line: '610741889'
Test #11:
score: 0
Accepted
time: 9ms
memory: 14868kb
input:
10000 19998 5000 8297 1587 4215 7085 908 9006 4440 8162 2344 2913 9286 148 1341 6311 3505 1903 7164 9789 155 2499 7851 2871 3598 6886 9794 971 2964 1584 3904 9828 1197 6509 8711 4160 8956 4383 4012 6434 4666 4505 520 8801 2002 1973 7594 8391 5476 1519 4018 7123 4531 8488 8631 392 4086 5700 6322 4043...
output:
455600216
result:
ok single line: '455600216'
Test #12:
score: 0
Accepted
time: 9ms
memory: 18108kb
input:
10000 19998 5000 5606 537 1556 628 1946 7240 2292 2308 6724 1637 7588 1004 189 1745 1224 3320 9762 3651 2469 3720 3493 2628 6008 5072 8522 3732 3775 9849 5034 3923 5886 6142 6675 6936 4044 9808 3126 5662 2403 7331 568 658 5076 8479 4146 5798 128 2751 881 3649 1808 8197 870 6333 5614 1508 8951 3543 9...
output:
16201328316
result:
ok single line: '16201328316'
Test #13:
score: 0
Accepted
time: 38ms
memory: 19908kb
input:
97298 99482 1 42026 4701 67953 45322 3925 96767 28922 34681 19168 39948 32837 63047 48061 9465 96903 54029 83697 55989 90082 58424 39213 59753 25284 25759 10425 17976 41051 24975 86600 30316 77614 25130 52544 47722 36539 11940 32382 73669 39411 40164 7523 60395 39599 99385 459 55586 84318 30692 5983...
output:
4547503
result:
ok single line: '4547503'
Test #14:
score: 0
Accepted
time: 39ms
memory: 21040kb
input:
89014 95706 5 21674 19885 35949 32378 52712 78390 77453 10908 79673 8392 51357 4700 32554 47380 73694 79642 19154 68307 89263 11718 53554 76231 86665 50901 11733 42504 74977 81067 49240 82394 34289 1035 3913 17710 81623 71754 92617 40532 26940 1224 48988 69548 44958 27706 20133 22019 9821 16464 1614...
output:
50148586
result:
ok single line: '50148586'
Test #15:
score: 0
Accepted
time: 30ms
memory: 18736kb
input:
83216 91096 10 78924 51625 9909 44797 48061 26280 31470 49360 44991 29878 12425 28022 35709 74141 67317 28043 55048 69930 29811 82397 1845 58231 45765 9194 34149 23533 32821 19265 23465 48921 31920 38385 53493 78976 4650 851 20797 12076 73044 74208 63651 47791 13365 22492 8618 71752 27461 44925 2894...
output:
717822288
result:
ok single line: '717822288'
Test #16:
score: 0
Accepted
time: 43ms
memory: 21020kb
input:
98812 106223 20 1260 43030 43352 58754 82627 39520 89882 4439 90624 11044 42044 12627 17634 2815 75451 34401 74721 95193 18327 21166 17337 66560 39370 1380 44437 22092 4658 2838 83218 42421 63284 74650 58437 62484 95745 56295 38292 78950 39729 13455 34212 34647 52874 73294 44240 82351 52086 16934 41...
output:
615934531
result:
ok single line: '615934531'
Test #17:
score: 0
Accepted
time: 30ms
memory: 26560kb
input:
93001 95618 50 11910 88560 90528 69036 82819 17686 51318 36128 90029 24933 37698 29033 15369 24300 64244 85662 6604 5303 30065 52215 87122 78920 86048 89698 13296 82207 64154 9796 58485 14444 24044 21426 12370 80962 22004 54720 10041 60498 28741 24809 57065 59514 3297 4844 72421 34825 11076 51426 28...
output:
511876785
result:
ok single line: '511876785'
Test #18:
score: 0
Accepted
time: 32ms
memory: 23500kb
input:
92144 96032 100 35547 9470 84517 49343 34969 84350 34808 77951 54996 31845 41129 56823 32592 53360 17777 63703 80394 36000 84959 64865 49073 79431 83553 22554 42759 14590 16687 47181 54228 61730 32305 5815 56419 38994 65251 52460 17108 8531 69512 68369 27320 51004 11284 66432 22072 15498 80689 58839...
output:
1320653725
result:
ok single line: '1320653725'
Test #19:
score: 0
Accepted
time: 37ms
memory: 21368kb
input:
92509 98698 200 73769 47116 91650 89645 26340 74259 38314 54207 85639 337 12848 86272 63194 57055 31737 5514 78589 16226 38579 11316 50368 60830 23477 55405 2081 83505 58168 67823 3080 51124 70239 76234 75964 23351 37729 36606 56734 83563 70297 57763 76038 7582 49008 33365 79284 66621 16188 47034 57...
output:
669216937
result:
ok single line: '669216937'
Test #20:
score: 0
Accepted
time: 32ms
memory: 21156kb
input:
91383 98145 500 88219 40569 32145 469 87021 48754 18682 57128 68488 59303 1070 63205 48770 39815 28674 53608 82553 11414 74752 2292 1607 77368 83696 21357 81017 11906 9542 59390 70156 86582 77962 7860 20588 6515 63293 77801 72562 48050 20028 78421 25985 45996 12954 72214 26838 11051 74321 89935 3485...
output:
1565362507
result:
ok single line: '1565362507'
Test #21:
score: 0
Accepted
time: 38ms
memory: 21596kb
input:
81074 87013 1000 13702 15551 59968 55797 20456 69598 66186 53467 52423 38928 39740 59586 14518 79549 11049 66675 79886 45403 64056 38864 7828 23394 6681 16414 14886 44219 74723 9275 41622 79356 16092 35605 5957 2297 31757 33066 60 65769 26098 51500 73568 17348 58721 40617 4632 70102 27639 328 54709 ...
output:
5248124974
result:
ok single line: '5248124974'
Test #22:
score: 0
Accepted
time: 31ms
memory: 24364kb
input:
92147 99612 2000 60936 40291 90321 11400 2896 28292 35788 75518 17073 89695 3897 37412 85734 92147 63240 44308 19883 84457 24299 56370 65014 84965 42599 72759 21735 48963 11690 78395 83959 44704 14921 72165 79414 56575 6888 35799 75798 64099 16205 49892 38475 29152 46418 57901 39724 17924 863 10850 ...
output:
20532131562
result:
ok single line: '20532131562'
Test #23:
score: 0
Accepted
time: 36ms
memory: 22640kb
input:
92707 99268 5000 54981 91818 21302 8475 84264 54369 39215 36912 3117 605 84349 1195 61902 61063 50378 84073 22661 83594 55372 72886 1769 64798 33529 31449 74764 6852 45139 17453 86803 42977 85952 53501 36857 14295 89696 77471 53717 71731 35411 57199 50317 24057 65738 8830 64890 4535 91852 83444 3708...
output:
14165332205
result:
ok single line: '14165332205'
Test #24:
score: 0
Accepted
time: 38ms
memory: 25676kb
input:
99966 109908 10000 16322 73429 24276 35920 26342 1846 34612 96977 85588 39088 5966 43372 53034 30882 22067 25772 64734 43744 4730 9994 93025 44747 30530 65445 78282 34702 12279 68202 51910 81559 11368 43898 39908 2346 99024 24687 33172 23857 11980 98010 3100 50274 95165 29617 94420 88551 34907 36528...
output:
73541990298
result:
ok single line: '73541990298'
Test #25:
score: 0
Accepted
time: 44ms
memory: 22380kb
input:
99556 109569 20000 56402 27546 75310 40565 54419 80704 9778 45380 43511 13742 96948 14167 30016 34465 23497 2341 77671 16202 27695 7312 54067 30177 99472 78731 30420 48667 74324 95377 11050 22384 78154 18851 70355 9822 21160 79502 37556 43048 55494 91844 27032 67699 18219 23278 37751 31696 53136 505...
output:
40974517762
result:
ok single line: '40974517762'
Test #26:
score: 0
Accepted
time: 35ms
memory: 30584kb
input:
98433 108255 50000 35524 23307 42864 15485 38658 88975 23250 73837 9629 58945 37616 25978 80617 98299 17941 8772 39628 59167 77087 21976 81155 50430 7217 85796 77875 63664 93095 62619 1681 26903 42086 58522 36912 85162 9359 49674 60466 94407 42838 79925 66660 22529 27711 78387 81597 33322 4530 19178...
output:
259830572846
result:
ok single line: '259830572846'
Test #27:
score: 0
Accepted
time: 45ms
memory: 29896kb
input:
99996 110033 100000 71950 34351 9712 86257 23432 91740 92999 27126 22492 94100 87787 239 56164 48989 97625 20065 69395 86045 12300 28811 24011 80269 90874 26909 49736 54800 26282 77470 54828 76986 58039 59474 20117 23078 43007 17024 53890 64875 67925 77114 27230 84883 83004 46484 61356 76363 35481 8...
output:
1297145718942
result:
ok single line: '1297145718942'
Test #28:
score: 0
Accepted
time: 33ms
memory: 24832kb
input:
99977 109787 10000 66408 56610 58707 12366 32827 42201 50718 76452 47142 40752 82410 2172 28662 5730 33932 36911 55541 33209 89356 45651 86321 404 56057 63282 46332 76064 92386 77873 38996 23471 26624 16817 40017 97542 82307 25550 60279 53527 95995 73407 10423 81424 74304 47851 31388 57014 41625 959...
output:
79138677034
result:
ok single line: '79138677034'
Test #29:
score: 0
Accepted
time: 40ms
memory: 23752kb
input:
99983 110099 20000 95658 20884 26978 99276 96639 45160 20669 29274 43664 8493 74836 46147 79323 51874 9490 80284 78045 29839 10403 95585 35495 78242 77460 13291 1466 2756 33008 63487 8632 4536 38035 24931 53823 28348 56488 49176 89787 2923 43417 32060 27293 67912 61543 15700 56436 15715 72143 5088 9...
output:
92786063383
result:
ok single line: '92786063383'
Test #30:
score: 0
Accepted
time: 35ms
memory: 21736kb
input:
99668 109417 50000 5173 57906 88527 55863 59092 93249 77977 56291 89588 88914 81407 82666 65025 12562 73074 59424 29721 2595 58329 17350 12133 49034 47011 25726 86103 90629 43779 90300 65523 8746 18947 9400 35187 85022 19697 76814 1284 3282 53301 2749 57148 337 70193 11109 79135 74181 40331 32105 76...
output:
21888291686
result:
ok single line: '21888291686'
Test #31:
score: 0
Accepted
time: 52ms
memory: 25988kb
input:
99640 109601 100000 42475 33811 69281 18059 93552 76624 75168 1268 29824 94373 38180 31942 89025 99269 81333 66734 84123 55895 98957 66068 53483 39236 420 96188 17467 24107 13501 4127 97696 93374 65279 35455 82803 37114 55644 7838 91185 60083 19077 24896 3467 40397 61324 93892 91167 39924 496 62255 ...
output:
282041064334
result:
ok single line: '282041064334'
Test #32:
score: 0
Accepted
time: 44ms
memory: 23912kb
input:
95354 103070 10000 70017 9178 73612 31542 57357 84133 18139 66781 34700 6205 32091 90534 76828 20924 88278 64323 11681 45006 76447 60553 67428 27513 15028 25559 71028 22094 2882 38270 13581 79594 86084 21369 39677 50578 58045 78162 15010 87683 21584 67007 52770 44770 49042 87005 94781 65597 83185 42...
output:
17495895220
result:
ok single line: '17495895220'
Test #33:
score: 0
Accepted
time: 42ms
memory: 24608kb
input:
99512 109491 20000 48113 20946 71319 43625 98995 66315 36115 30161 73408 43454 19964 73383 35038 86639 43046 33474 50110 18609 46405 48006 56691 77512 60240 98722 53030 20359 68761 68586 28732 12724 42270 32933 94182 69367 72947 52768 48056 49271 59214 60913 91834 20396 16722 11964 20602 23246 42604...
output:
46463693104
result:
ok single line: '46463693104'
Test #34:
score: 0
Accepted
time: 42ms
memory: 22556kb
input:
99588 104214 50000 92086 47971 22567 95376 34961 9783 77938 69447 49798 83164 44031 18820 20631 58927 87329 13466 24368 63255 3049 10178 88923 3352 22329 55841 39243 27930 58297 1908 39284 31399 58462 51731 92341 92459 63418 4434 59499 32537 93474 46094 38719 92933 62028 96185 98159 46624 63377 6876...
output:
21204397603
result:
ok single line: '21204397603'
Test #35:
score: 0
Accepted
time: 42ms
memory: 25348kb
input:
97743 104943 100000 6689 245 78650 3006 74172 88177 49202 16883 73713 80522 15938 91288 34352 38935 85385 51610 13619 35752 49974 64991 64584 78358 96356 42781 66846 7594 78767 57486 15431 34617 43716 6289 67948 92049 5374 90009 68477 82354 38474 75313 38550 66603 86647 97392 96856 44078 95734 80861...
output:
84486399983
result:
ok single line: '84486399983'
Test #36:
score: 0
Accepted
time: 41ms
memory: 23628kb
input:
95350 103967 10000 6777 65592 15988 48191 3425 8661 47413 23959 51070 18381 46580 45249 36317 13110 29907 75547 29910 91919 78350 3356 31804 37053 4813 52518 38115 67552 84859 39514 60355 94154 40784 28253 62702 81682 84887 20905 32715 3652 93860 17915 38119 10554 32243 65282 35442 36977 33976 77822...
output:
85586013771
result:
ok single line: '85586013771'
Test #37:
score: 0
Accepted
time: 39ms
memory: 20816kb
input:
93152 101204 20000 39491 78693 14233 27048 46717 39748 67789 62623 54748 88580 610 60984 21331 31659 27027 5072 56617 61967 83282 48601 66616 15997 53795 16217 70671 82867 69215 56936 38641 39813 22355 84662 60020 31420 42814 71266 11939 48274 4630 83588 45277 90647 46436 30180 50771 19887 27459 108...
output:
81006311609
result:
ok single line: '81006311609'
Test #38:
score: 0
Accepted
time: 37ms
memory: 23036kb
input:
93663 102475 50000 83960 18580 39731 31894 64310 44964 60696 56370 71660 7355 74874 83529 68952 69707 62309 33160 5029 23208 12605 18123 11695 18857 23039 82202 27428 72137 39211 77466 60196 7014 76135 54476 74530 28146 48366 12739 67722 86691 32932 41645 71328 37304 50362 15501 70933 73025 37406 10...
output:
34075370122
result:
ok single line: '34075370122'
Test #39:
score: 0
Accepted
time: 50ms
memory: 23108kb
input:
97096 105977 100000 30994 36522 26237 60111 37575 31986 40812 5879 75175 15913 59361 15438 65686 96973 53433 69402 53545 82748 21212 21965 77492 35970 7400 18644 71396 16423 95804 82353 5014 66638 5398 79851 7782 94928 32078 21385 72081 80279 21136 26179 17019 35067 49414 12873 38857 9640 79076 9066...
output:
92673368415
result:
ok single line: '92673368415'
Test #40:
score: 0
Accepted
time: 35ms
memory: 19636kb
input:
96544 97906 10000 44107 36307 32409 71632 48245 31190 90561 942 56807 69196 86640 92226 71350 24501 36247 75026 89388 56515 90809 86653 83461 33788 89997 53170 94933 73148 19807 92150 74399 785 93615 56130 51999 25085 59440 84227 69442 2840 77067 2841 2665 15276 67226 50744 78602 30231 47373 79338 8...
output:
6023002370
result:
ok single line: '6023002370'
Test #41:
score: 0
Accepted
time: 33ms
memory: 21040kb
input:
90021 92444 20000 48746 2431 23132 31250 71459 51715 51295 64525 43762 25387 5884 38424 9344 48968 85040 75362 36593 2572 36919 45826 64426 63055 55344 75772 36462 19761 16456 22971 56824 85336 83833 21333 2254 74156 56832 44961 60489 46678 76665 49073 70621 32866 4391 89505 25099 82022 78380 71789 ...
output:
8866333940
result:
ok single line: '8866333940'
Test #42:
score: 0
Accepted
time: 43ms
memory: 25492kb
input:
99596 105422 50000 36801 29070 19732 37747 11331 17838 10279 98167 30184 30488 15030 8026 3615 57914 46821 7412 9238 13992 62258 76888 63996 82573 16488 3250 63716 11506 42837 63114 39308 37151 57401 69392 89523 14957 22273 93457 98912 60403 3577 1781 4184 98258 52434 96143 26643 8078 25752 92991 12...
output:
33439749769
result:
ok single line: '33439749769'
Test #43:
score: 0
Accepted
time: 34ms
memory: 21048kb
input:
86613 88156 100000 154 1266 3643 20871 46838 28810 16525 79900 40527 26620 49367 5056 440 74278 7788 48491 21979 65942 8640 58826 62994 44083 24772 59160 47480 17309 58384 51025 71602 40192 34656 34317 57834 50973 67186 13551 44429 12575 82303 21035 11090 63140 5366 78501 14351 43711 62769 37050 352...
output:
22334956061
result:
ok single line: '22334956061'
Test #44:
score: 0
Accepted
time: 37ms
memory: 22312kb
input:
90194 93091 10000 58227 20657 71785 76937 33680 67052 33064 7729 43365 62249 79174 10423 32877 65293 51752 8835 64445 13044 49304 58442 18346 24450 53662 73430 56173 65804 35328 53017 16729 6683 45822 60994 51250 24222 4667 60119 38771 28852 84296 74388 10205 25111 397 58541 63420 4348 75786 59554 1...
output:
6875862941
result:
ok single line: '6875862941'
Test #45:
score: 0
Accepted
time: 30ms
memory: 23100kb
input:
82894 84540 20000 2786 55758 42274 9925 14830 27751 48569 16274 66295 33765 7727 33467 41274 5868 68109 76343 26616 31047 52158 54867 18705 15375 53736 4155 79356 56205 18567 52662 39913 39158 62787 22734 58411 24443 64654 74288 13001 23761 80843 7042 45180 49927 392 71379 16181 61310 10337 53696 51...
output:
8800428238
result:
ok single line: '8800428238'
Test #46:
score: 0
Accepted
time: 39ms
memory: 21636kb
input:
95957 100123 50000 70039 91545 61028 1017 33495 64628 51232 57813 52553 85066 65569 72547 55576 85437 70384 50307 73139 66999 89278 80372 51641 1426 78849 94845 79093 92669 8225 32140 41734 52286 53921 62061 5611 34097 71646 57217 94521 51797 64345 37308 62394 2934 30225 18742 76509 22243 26148 7189...
output:
10019701824
result:
ok single line: '10019701824'
Test #47:
score: 0
Accepted
time: 42ms
memory: 26252kb
input:
98988 99454 100000 68880 93843 9426 25768 8721 95539 71688 44282 57033 50693 77433 83387 23440 55969 56645 8326 82925 6391 37198 39869 18878 10268 2145 51313 12012 69739 81751 23166 79800 74960 31961 35180 66991 84208 47044 57115 66264 54351 33598 78840 93208 77441 12120 65490 4865 70618 25218 31410...
output:
35495792084
result:
ok single line: '35495792084'
Test #48:
score: 0
Accepted
time: 33ms
memory: 24152kb
input:
92019 92623 10000 83694 69029 41122 84642 72134 16213 50114 31919 15777 20754 31254 50232 5074 19721 8771 17613 3978 18595 78285 70442 27307 36667 24549 34102 56138 44578 15083 33740 49121 20006 32445 31435 282 54557 86087 57029 34985 51147 65650 39822 8525 36439 25290 73466 81711 48012 30979 52780 ...
output:
8986478919
result:
ok single line: '8986478919'
Test #49:
score: 0
Accepted
time: 33ms
memory: 23108kb
input:
96942 97077 20000 84380 6148 62519 76824 88801 51558 68456 93584 17701 60973 94741 70074 49982 43027 38418 45783 29152 85549 77813 50084 85279 66541 31928 72679 46347 10670 61936 11635 71010 50041 46976 9480 34938 69645 85036 80511 52180 1223 95340 42735 51122 53152 15578 56193 75454 23626 75834 205...
output:
27960121473
result:
ok single line: '27960121473'
Test #50:
score: 0
Accepted
time: 33ms
memory: 20460kb
input:
94039 94064 50000 59638 5004 5498 31993 45287 12697 73392 72360 72720 82961 15135 46766 26332 70852 87436 19296 66105 14869 68437 32890 82741 87443 48032 90230 43621 26697 17721 61498 58549 91893 26330 34032 87963 88127 62317 12836 51252 81994 80726 82188 2329 69933 28645 87339 44162 31757 50720 295...
output:
91747570973
result:
ok single line: '91747570973'
Test #51:
score: 0
Accepted
time: 46ms
memory: 21132kb
input:
93502 93698 100000 58642 59536 34323 88366 87422 48481 3698 68132 57346 71390 9862 68105 56607 70868 27955 38539 2749 68873 9209 25554 9687 88390 59284 23183 74716 80351 14436 35895 8792 39435 33426 24092 40005 24924 13183 92102 90397 21002 24697 15834 4469 39060 15567 63568 37966 43962 14796 10310 ...
output:
47906790124
result:
ok single line: '47906790124'
Test #52:
score: 0
Accepted
time: 30ms
memory: 24560kb
input:
97003 97049 10000 81077 89617 44614 69938 23190 35785 16408 75518 54883 41781 7461 50615 80561 29440 26880 36443 20866 10428 11384 80909 34886 1149 58231 67939 63620 11528 8761 71310 5787 44237 36780 61589 25438 31424 61587 52390 94511 51268 35246 35057 86681 72325 80352 61724 79863 49632 32310 2196...
output:
32711823353
result:
ok single line: '32711823353'
Test #53:
score: 0
Accepted
time: 36ms
memory: 29732kb
input:
93618 93624 20000 86266 91621 78393 28669 30526 47617 88518 48976 23690 2811 75478 73076 51174 80395 67408 48002 81775 72196 58932 80192 34545 68348 44842 74532 76266 91524 59676 69462 24211 58033 7760 93146 71061 65337 46941 17491 50260 37555 1498 70716 86601 23488 92633 57220 63215 29404 50097 886...
output:
109795615805
result:
ok single line: '109795615805'
Test #54:
score: 0
Accepted
time: 27ms
memory: 23600kb
input:
74858 74867 50000 36940 17463 56552 41222 28001 66137 2727 28990 38723 16829 2229 64982 54238 17746 73824 22473 48776 58256 49462 8624 3578 282 43427 34443 35343 47990 27482 4109 54854 12379 45662 42706 69288 69289 1953 74740 59010 291 40808 7556 38953 55425 37266 27940 73397 49491 37010 73266 70242...
output:
98271465907
result:
ok single line: '98271465907'
Test #55:
score: 0
Accepted
time: 22ms
memory: 25752kb
input:
69833 69841 100000 43951 68422 58734 61263 17180 8511 40492 53862 66161 32302 55096 41680 6957 23053 23793 37661 54008 29831 44133 8832 64509 26299 16697 35246 8331 22796 53359 43230 25252 55264 31336 4160 36848 25502 34921 40811 66322 14197 2762 15491 37786 4877 24114 31897 64064 20631 46490 22316 ...
output:
150317241149
result:
ok single line: '150317241149'
Test #56:
score: 0
Accepted
time: 45ms
memory: 33324kb
input:
98402 98404 100000 17958 68981 7293 76643 80587 88004 88078 2126 97565 48231 10449 28533 97074 17673 94407 43811 70062 24866 59048 7939 2665 28503 25981 52911 28542 953 93973 13611 80601 34103 14673 24244 54262 18287 68558 37626 41020 9563 22586 19592 54168 40277 3840 59663 11726 13640 14057 19678 2...
output:
312814007943
result:
ok single line: '312814007943'
Test #57:
score: 0
Accepted
time: 38ms
memory: 31300kb
input:
85304 85305 100000 16123 44528 74098 37488 29184 64865 25981 46971 59167 38211 62436 52738 6519 22108 27969 34050 22730 77891 60297 31407 5793 26213 15566 65566 2142 59553 69307 10473 6505 36348 77868 8422 68676 13303 69939 48144 68135 54676 31532 79773 13980 83372 80458 83758 65564 8860 64063 28282...
output:
354260573474
result:
ok single line: '354260573474'
Test #58:
score: 0
Accepted
time: 34ms
memory: 34300kb
input:
96685 96685 100000 52944 62821 17587 74161 43406 94266 38133 7206 29326 50472 81540 74974 12271 27361 96172 4461 96671 58791 20933 85167 11929 22082 82133 1417 88617 24470 40902 93449 36156 25392 28753 72500 34460 44254 6247 92423 51052 64904 16787 68473 90384 84106 30827 69146 175 1673 36963 81019 ...
output:
274523996392
result:
ok single line: '274523996392'
Test #59:
score: 0
Accepted
time: 40ms
memory: 34252kb
input:
96430 96430 100000 7788 59647 94564 16939 68128 53553 74026 52861 8222 82773 70973 53169 68225 84171 25263 67406 58703 40721 18091 62531 49826 87988 52313 60166 48712 34869 18719 49603 30660 45862 6796 84568 36405 93814 19839 24384 55931 49536 60623 59281 63917 55497 49103 2466 82250 7103 35997 5350...
output:
554893159586
result:
ok single line: '554893159586'
Test #60:
score: 0
Accepted
time: 29ms
memory: 35040kb
input:
100000 99999 100000 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 5...
output:
500000000000000
result:
ok single line: '500000000000000'
Test #61:
score: 0
Accepted
time: 35ms
memory: 35932kb
input:
100000 100000 100000 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 ...
output:
250000000000000
result:
ok single line: '250000000000000'