QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#463146 | #8732. Zečevi | Crysfly | 100 ✓ | 3956ms | 214484kb | C++17 | 3.4kb | 2024-07-04 14:27:03 | 2024-07-04 14:27:04 |
Judging History
answer
// what is matter? never mind.
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,sse4,popcnt,abm,mmx,avx,avx2")
#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(int i=(a);i>=(b);--i)
#define ll long long
typedef int iint;
#define int long long
#define ull unsigned long long
#define SZ(x) ((int)((x).size()))
#define ALL(x) (x).begin(),(x).end()
using namespace std;
inline int read()
{
char c=getchar();int x=0;bool f=0;
for(;!isdigit(c);c=getchar())f^=!(c^45);
for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
if(f)x=-x;return x;
}
#define fi first
#define se second
#define pb push_back
#define mkp make_pair
typedef pair<int,int>pii;
typedef vector<int>vi;
#define maxn 200005
#define inf 0x3f3f3f3f
bool mbe;
int n,m;
struct node{
int x,v,op;
}a[maxn];
#define N 60*maxn
iint ls[N],rs[N],rt,tot;
int sum[N],tag[N];
iint stk[N],tp;
int V;
bool med;
int newn(){
int u=(tp?stk[tp--]:++tot);
assert(u<N-5);
ls[u]=rs[u]=sum[u]=tag[u]=0;
return u;
}
void rub(int p){
stk[++tp]=p;
}
void pt(int p,int v,int len){
tag[p]+=v;
sum[p]+=v*len;
}
void down(int p,int len){
if(!tag[p])return;
if(!ls[p])ls[p]=newn();
if(!rs[p])rs[p]=newn();
pt(ls[p],tag[p],(len+1)/2),pt(rs[p],tag[p],len/2),tag[p]=0;
}
void up(int p){
sum[p]=sum[ls[p]]+sum[rs[p]];
}
void add(iint&p,int l,int r,int ql,int qr,int v){
if(!p) p=newn();
if(l>=ql && r<=qr)return pt(p,v,r-l+1);
int mid=l+r>>1; down(p,r-l+1);
if(ql<=mid) add(ls[p],l,mid,ql,qr,v);
if(qr>mid) add(rs[p],mid+1,r,ql,qr,v);
up(p);
}
int ask(iint&p,int l,int r,int qr){
if(!p||!sum[p])return 0;
if(tag[p]>0)return 1;
int mid=l+r>>1;
if(qr<=mid) return ask(ls[p],l,mid,qr);
if(sum[ls[p]]) return 1;
return ask(rs[p],mid+1,r,qr);
}
void del(iint&p,int l,int r,int &v){
if(!v || !sum[p] || !p)return;
if(sum[p]<=v){
// cout<<"DEL "<<rt<<" "<<l<<" "<<r<<" "<<sum[p]<<"\n";
v-=sum[p],sum[p]=tag[p]=0;
rub(p),p=0;
return;
}
if(l==r){
// cout<<"DEL1 "<<l<<" "<<v<<"\n";
sum[p]-=v,v=0;
return;
}
int mid=l+r>>1; down(p,r-l+1);
del(ls[p],l,mid,v);
del(rs[p],mid+1,r,v);
up(p);
if(!sum[p]) rub(p),p=0;
}
bool chk(int tim)
{
cerr<<"chk "<<tim<<"\n";
rt=tot=tp=0;
For(i,1,n+m){
if(a[i].op==0){
if(a[i].v>=tim) continue;
int L=a[i].x+a[i].v,R=a[i].x+tim-1;
// cout<<"need "<<a[i].x<<" "<<L<<" "<<R<<"\n";
add(rt,0,V,L,R,1);
}else{
// cout<<"GO "<<a[i].x<<" "<<a[i].v<<"\n";
int o=0;
if(a[i].x>0) o=ask(rt,0,V,a[i].x-1);
if(o) return 0;
int now=a[i].v;
del(rt,0,V,now);
}
}
// cout<<"OK "<<rt<<" "<<sum[rt]<<"\n";
if(sum[rt])return 0;
return 1;
}
signed main()
{
//freopen("zecevi.in.3a","r",stdin);
// freopen("qwq.out","w",stdout);
cerr<<(1.0*(&mbe-&med)/1024576.0)<<"\n";
n=read(),m=read();
int up=0;
For(i,1,n)a[i].x=read(),a[i].v=read(),a[i].op=0,up+=a[i].v;
For(i,n+1,n+m)a[i].x=read(),a[i].v=read(),a[i].op=1,up+=a[i].v;
up/=n;
// cout<<"up "<<up<<"\n";
sort(a+1,a+n+m+1,[&](node x,node y){
if(x.x!=y.x)return x.x<y.x;
return x.op<y.op;
});
V=up+inf;
int l=0,r=up,res=0;
// chk(48772599075036);return 0;
while(l<=r){
int mid=l+r>>1;
if(chk(mid))res=mid,l=mid+1;
else r=mid-1;
}
cout<<res;
return 0;
}
/*
2 3 1
1 3
4 2 3
0 1 2
*/
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 9
Accepted
Test #1:
score: 9
Accepted
time: 3796ms
memory: 110528kb
input:
1 100000 25117044 970963458 373893849 968275175 426927003 756404237 402749243 884153855 655982073 231540010 925839527 380078009 580079136 593952762 505135862 82095067 52931312 190936477 921699044 178656266 22689680 495676031 439196655 96470058 508403382 453576184 728333782 206229498 227588452 887461...
output:
48772599075036
result:
ok 1 number(s): "48772599075036"
Test #2:
score: 0
Accepted
time: 3956ms
memory: 112640kb
input:
1 100000 2033786 701332275 425793984 100641701 791989716 91816064 729205086 630057419 128219506 625052640 946256338 430845673 49961714 406789641 320023538 493235898 124624293 153525734 12609738 732965886 164381879 595730434 870380571 604015896 817352253 354163189 543418085 277237438 517916847 853100...
output:
49887362883766
result:
ok 1 number(s): "49887362883766"
Test #3:
score: 0
Accepted
time: 3791ms
memory: 110408kb
input:
1 100000 42752820 122926409 10513202 836122032 810112260 169484171 599386731 844238794 981228176 849710441 374165341 461389522 225540019 875636296 980026848 262331868 968727347 672445689 891073264 161158988 646651074 368927855 120467285 916656970 480861097 457383460 656857845 965285555 862807432 941...
output:
47874399443765
result:
ok 1 number(s): "47874399443765"
Test #4:
score: 0
Accepted
time: 3699ms
memory: 107496kb
input:
1 100000 45772116 978871680 436898166 365158248 732294552 488461892 109283264 904017928 481282469 365782765 149950749 558650411 637756555 761954186 441342826 245462952 837682335 825241583 231785990 856221029 865481036 890572033 713521646 284438736 937611078 690679712 48500295 268860937 701774950 907...
output:
47794145143247
result:
ok 1 number(s): "47794145143247"
Test #5:
score: 0
Accepted
time: 3666ms
memory: 107760kb
input:
1 100000 54417600 455585786 185157112 23259714 235040467 851577574 357897786 945899735 100775093 679820579 205023325 988165434 825564014 253769836 202188435 59892940 337396895 514922202 658461608 769509576 241359680 886440279 258711817 564489459 565017776 549386805 901984139 145266237 3641050 935060...
output:
47119066086794
result:
ok 1 number(s): "47119066086794"
Test #6:
score: 0
Accepted
time: 1454ms
memory: 57168kb
input:
1 100000 71480876 782458735 418412356 4433 418416789 7359 418424148 3577 418427725 6204 418433929 2537 418436466 6358 418442824 4124 418446948 2713 418449661 6258 418455919 6637 418462556 2331 418464887 2262 418467149 2504 418469653 3744 418473397 688 418474085 4975 418479060 2061 418481121 5928 418...
output:
1608752150
result:
ok 1 number(s): "1608752150"
Test #7:
score: 0
Accepted
time: 1454ms
memory: 55128kb
input:
1 100000 70736826 689941541 202494343 3048 202497391 2446 202499837 6318 202506155 303 202506458 5886 202512344 4048 202516392 4537 202520929 427 202521356 1944 202523300 2478 202525778 5925 202531703 1224 202532927 224 202533151 5051 202538202 6119 202544321 836 202545157 5106 202550263 3864 202554...
output:
1592473193
result:
ok 1 number(s): "1592473193"
Test #8:
score: 0
Accepted
time: 1442ms
memory: 55120kb
input:
1 100000 90679177 731208489 444799446 7049 444806495 5992 444812487 656 444813143 2762 444815905 3073 444818978 257 444819235 6057 444825292 5667 444830959 6211 444837170 450 444837620 5923 444843543 7081 444850624 2076 444852700 2823 444855523 5443 444860966 2184 444863150 6344 444869494 2041 44487...
output:
1474188594
result:
ok 1 number(s): "1474188594"
Test #9:
score: 0
Accepted
time: 1457ms
memory: 54988kb
input:
1 100000 99481748 781962846 427794638 4239 427798877 5115 427803992 4376 427808368 5084 427813452 6302 427819754 7063 427826817 6196 427833013 6369 427839382 4255 427843637 2647 427846284 4303 427850587 7261 427857848 2929 427860777 1817 427862594 7754 427870348 5113 427875461 621 427876082 3819 427...
output:
1625835386
result:
ok 1 number(s): "1625835386"
Test #10:
score: 0
Accepted
time: 1239ms
memory: 48972kb
input:
1 100000 16521427 168641806 48125403 944 48126347 1560 48127907 83 48127990 85 48128075 1008 48129083 922 48130005 438 48130443 1454 48131897 1056 48132953 492 48133445 1347 48134792 689 48135481 156 48135637 515 48136152 1665 48137817 58 48137875 732 48138607 567 48139174 687 48139861 1072 48140933...
output:
389963535
result:
ok 1 number(s): "389963535"
Subtask #2:
score: 12
Accepted
Test #11:
score: 12
Accepted
time: 67ms
memory: 44832kb
input:
100000 1 866301171 366511673 782130035 523593023 210159324 951803750 33819604 974027339 517904111 963671594 281974787 391051697 568097534 965085338 81004963 640086904 211218893 397278600 614725688 4366212 269152510 559992280 327491679 276555612 630131521 503842459 15556017 382637565 444080049 985512...
output:
1745
result:
ok 1 number(s): "1745"
Test #12:
score: 0
Accepted
time: 66ms
memory: 42828kb
input:
100000 1 602052974 747930871 526492952 570148581 533976658 194147542 178657958 99194566 225173261 577928477 516902495 724134685 601150433 924258430 567498378 534418876 488767427 577178596 272110248 850482707 76905239 32663753 295653369 667089720 95647198 469443114 260333259 658091403 516052242 82742...
output:
3011
result:
ok 1 number(s): "3011"
Test #13:
score: 0
Accepted
time: 51ms
memory: 42700kb
input:
100000 1 62539585 679422422 292493838 651257494 18409931 47903905 667787194 128774888 124839461 365507846 23418045 612484173 406280354 862649934 843234438 905245338 400001312 225717248 755168314 822417263 515758415 201237721 556110002 980912248 173338563 53323238 246379086 756633035 337266161 257609...
output:
1262
result:
ok 1 number(s): "1262"
Test #14:
score: 0
Accepted
time: 59ms
memory: 44684kb
input:
100000 1 574489065 743770763 211882181 288604464 129739889 284534337 331811875 391318315 37416063 608986445 534902036 696548051 268694357 19640591 239365234 576914400 10623890 81786245 557001779 226639658 154345580 731344529 250688026 757559211 25475054 357657388 584637384 652051354 153156878 784586...
output:
7737
result:
ok 1 number(s): "7737"
Test #15:
score: 0
Accepted
time: 63ms
memory: 42696kb
input:
100000 1 535171471 336381440 141773641 673998275 492414591 465321245 292245188 492728685 115925345 510014389 387848714 3853854 550043834 398983084 532785924 732477862 22347128 820766474 426048009 610755195 197776236 641908217 206935657 783564876 125621396 231399245 28736236 409897555 87143269 612743...
output:
9005
result:
ok 1 number(s): "9005"
Test #16:
score: 0
Accepted
time: 53ms
memory: 30544kb
input:
100000 1 933067308 728899586 933067307 281511775 933067306 46479519 933067305 629603498 933067304 513745053 933067303 195448498 933067302 839934969 933067301 749764127 933067300 177662462 933067299 311185829 933067298 67933481 933067297 103347335 933067296 298703387 933067295 868453813 933067294 616...
output:
3899
result:
ok 1 number(s): "3899"
Test #17:
score: 0
Accepted
time: 62ms
memory: 32648kb
input:
100000 1 506382737 329612248 506382736 801627680 506382735 316738091 506382734 681410533 506382733 529449205 506382732 827584154 506382731 317177712 506382730 926503010 506382729 684230820 506382728 480953186 506382727 731683737 506382726 145817323 506382725 360514181 506382724 698908723 506382723 7...
output:
2895
result:
ok 1 number(s): "2895"
Test #18:
score: 0
Accepted
time: 66ms
memory: 32460kb
input:
100000 1 877792105 98377575 877792104 179182144 877792103 161948562 877792102 152474351 877792101 542583167 877792100 142774416 877792099 396779746 877792098 957503478 877792097 669500037 877792096 969281133 877792095 565566533 877792094 425097559 877792093 174648328 877792092 18084987 877792091 422...
output:
5070
result:
ok 1 number(s): "5070"
Test #19:
score: 0
Accepted
time: 58ms
memory: 34692kb
input:
100000 1 825085252 529127478 825085251 396026798 825085250 24693573 825085249 545809975 825085248 194420230 825085247 543957886 825085246 650476290 825085245 405647119 825085244 306150957 825085243 371524357 825085242 376087124 825085241 235930314 825085240 549879890 825085239 570607548 825085238 25...
output:
6544
result:
ok 1 number(s): "6544"
Test #20:
score: 0
Accepted
time: 59ms
memory: 34640kb
input:
100000 1 977073650 470745336 977073649 122977908 977073648 753047720 977073647 251904203 977073646 121800701 977073645 280875129 977073644 144615133 977073643 144968752 977073642 697554749 977073641 39082506 977073640 764169759 977073639 729466800 977073638 405829723 977073637 945950833 977073636 45...
output:
28463
result:
ok 1 number(s): "28463"
Test #21:
score: 0
Accepted
time: 268ms
memory: 18144kb
input:
100000 1 975215810 6 975215809 9 975215808 6 975215807 12 975215806 10 975215805 9 975215804 15 975215803 15 975215802 12 975215801 20 975215800 12 975215799 22 975215798 19 975215797 20 975215796 23 975215795 25 975215794 19 975215793 27 975215792 29 975215791 30 975215790 22 975215789 30 975215788...
output:
44014
result:
ok 1 number(s): "44014"
Test #22:
score: 0
Accepted
time: 227ms
memory: 18176kb
input:
100000 1 920997099 4 920997098 6 920997097 12 920997096 7 920997095 8 920997094 13 920997093 11 920997092 14 920997091 15 920997090 20 920997089 19 920997088 18 920997087 15 920997086 24 920997085 20 920997084 23 920997083 22 920997082 25 920997081 28 920997080 28 920997079 27 920997078 29 920997077...
output:
35111
result:
ok 1 number(s): "35111"
Test #23:
score: 0
Accepted
time: 272ms
memory: 18256kb
input:
100000 1 976177978 3 976177977 11 976177976 11 976177975 8 976177974 12 976177973 12 976177972 13 976177971 18 976177970 10 976177969 11 976177968 13 976177967 17 976177966 17 976177965 17 976177964 19 976177963 24 976177962 24 976177961 23 976177960 27 976177959 23 976177958 27 976177957 25 9761779...
output:
43770
result:
ok 1 number(s): "43770"
Test #24:
score: 0
Accepted
time: 197ms
memory: 18124kb
input:
100000 1 859225454 3 859225453 3 859225452 12 859225451 12 859225450 7 859225449 10 859225448 16 859225447 17 859225446 14 859225445 15 859225444 18 859225443 13 859225442 18 859225441 18 859225440 19 859225439 26 859225438 26 859225437 25 859225436 27 859225435 25 859225434 23 859225433 31 85922543...
output:
33391
result:
ok 1 number(s): "33391"
Test #25:
score: 0
Accepted
time: 270ms
memory: 18208kb
input:
100000 1 610891269 9 610891268 12 610891267 6 610891266 8 610891265 9 610891264 10 610891263 17 610891262 13 610891261 12 610891260 15 610891259 14 610891258 17 610891257 18 610891256 19 610891255 20 610891254 19 610891253 22 610891252 26 610891251 21 610891250 22 610891249 26 610891248 27 610891247...
output:
39841
result:
ok 1 number(s): "39841"
Subtask #3:
score: 26
Accepted
Test #26:
score: 26
Accepted
time: 2ms
memory: 12072kb
input:
1000 1000 98203901 1327928 90291962 1715530 73190581 1953419 30626944 1111081 19861765 1648083 378531325 1847131 32338803 1135925 213019894 1754207 104073495 1236818 153162191 1775836 283503659 1577207 370480039 1457117 11989599 1688477 8779089 1115475 25334382 1551917 102065341 1825040 154967698 15...
output:
1011589
result:
ok 1 number(s): "1011589"
Test #27:
score: 0
Accepted
time: 0ms
memory: 14116kb
input:
330 990 373134326 4 701492560 7 746268679 7 776119421 4 895522381 4 746268655 4 805970167 4 373134330 4 716417911 8 761194024 4 626865671 4 328358235 7 14925402 7 597014925 4 582089554 8 44776126 8 104477612 4 298507489 7 835820889 4 895522405 4 656716413 4 552238806 4 313432840 8 447761191 4 298507...
output:
9
result:
ok 1 number(s): "9"
Test #28:
score: 0
Accepted
time: 2ms
memory: 12180kb
input:
330 990 611940298 4 373134344 6 313432864 4 149253747 5 343283602 6 253731346 4 238805985 5 970149264 6 89552243 4 746268681 4 492537314 4 611940310 5 238805999 4 865671657 6 970149250 4 149253761 4 626865697 4 298507491 4 343283596 5 835820905 5 761194028 4 29850769 6 44776150 4 880597026 6 6716418...
output:
9
result:
ok 1 number(s): "9"
Test #29:
score: 0
Accepted
time: 14ms
memory: 14320kb
input:
1000 1000 301268447 148470946 936559118 141508823 785790166 540015242 578859667 224889871 176466061 637491413 9490489 998352121 455152479 666386577 37725832 51483679 602037964 235495591 226213567 578127892 790576859 566555039 970586916 330226797 596431819 80912449 343462089 902326659 424623122 64254...
output:
497728657
result:
ok 1 number(s): "497728657"
Test #30:
score: 0
Accepted
time: 3ms
memory: 14164kb
input:
1000 1000 21227558 339524293 113300665 507519803 315575609 815194004 41238261 31490769 973195321 457225430 196603967 313004401 965058847 590863685 153320571 385042648 393037677 802248464 335446175 871720165 773589757 730240089 556839610 305533224 748100788 938114872 585303457 546525441 671529679 209...
output:
11753
result:
ok 1 number(s): "11753"
Test #31:
score: 0
Accepted
time: 11ms
memory: 12356kb
input:
1000 1000 211337114 553474751 102555909 666935445 299835524 52890195 472089110 163883989 230260733 968299049 314566620 534461117 770735804 446301362 342474482 859840150 980342554 552650340 629645425 503309373 723522633 636096068 727722882 135001479 589125294 553203222 84120343 113509598 248499460 60...
output:
252428485
result:
ok 1 number(s): "252428485"
Test #32:
score: 0
Accepted
time: 2ms
memory: 12160kb
input:
1000 1000 611122771 959495466 916706765 269527419 336110097 965236179 932956848 265539653 60174478 201257188 944335102 781288490 227811330 222887146 524651808 789272439 691184515 614561093 552698243 487840159 648822958 5757463 517856644 692150877 915348052 703214529 413971276 763383781 156326678 402...
output:
576359
result:
ok 1 number(s): "576359"
Test #33:
score: 0
Accepted
time: 4ms
memory: 14440kb
input:
1000 1000 217015550 202280593 638022397 918194415 332038629 258101805 412656484 505014129 813828431 340658688 707030991 330148730 331748201 148708511 5488233 920433075 326085356 310632433 32712833 21269249 25167552 408453560 901596828 641793691 287658509 498533005 529213946 979184490 782206025 21674...
output:
523048
result:
ok 1 number(s): "523048"
Test #34:
score: 0
Accepted
time: 3ms
memory: 14116kb
input:
1000 1000 52183966 228111828 257543135 614908950 314659495 547846822 141681901 334387214 756399034 447607434 919106911 364793883 426406748 718368702 999519116 467421110 434805504 265947560 802947863 196084942 103723434 114979015 746484192 569769459 989703481 344715363 851531833 717800118 612956852 7...
output:
109435
result:
ok 1 number(s): "109435"
Test #35:
score: 0
Accepted
time: 22ms
memory: 14420kb
input:
1 1000 85699469 635177406 397424475 990321093 573253650 934092320 417417315 623100595 35412931 505000054 941378306 708277837 810086552 142111546 991898627 424604577 278985265 365258620 238221494 717030199 159259717 208707366 3515039 543266049 830462866 629413859 44903503 855874855 728757506 15921864...
output:
465573072506
result:
ok 1 number(s): "465573072506"
Test #36:
score: 0
Accepted
time: 15ms
memory: 14216kb
input:
1 1000 7901158 37773167 21027258 4334 21031592 11484 21043076 17588 21060664 23208 21083872 18256 21102128 10101 21112229 34370 21146599 13732 21160331 11777 21172108 20273 21192381 15018 21207399 23165 21230564 35079 21265643 22595 21288238 18729 21306967 4642 21311609 29180 21340789 31158 21371947...
output:
81655280
result:
ok 1 number(s): "81655280"
Test #37:
score: 0
Accepted
time: 0ms
memory: 14112kb
input:
1000 1 601565709 380146496 106843611 114589719 436440725 132702235 146814923 821147393 707320329 725060235 701370283 91269767 513306674 858660646 172851986 880312764 235423890 783898238 434265476 706702981 6123927 531934452 174241542 896796185 627619019 292027001 874622894 915485730 728338717 661289...
output:
529072
result:
ok 1 number(s): "529072"
Test #38:
score: 0
Accepted
time: 2ms
memory: 16016kb
input:
1000 1 954084463 813961940 954084462 534944982 954084461 333239366 954084460 741491379 954084459 475679831 954084458 230139021 954084457 265074824 954084456 61811066 954084455 751787365 954084454 27979719 954084453 86613557 954084452 346616217 954084451 134934072 954084450 793525953 954084449 948854...
output:
41205968
result:
ok 1 number(s): "41205968"
Test #39:
score: 0
Accepted
time: 7ms
memory: 14164kb
input:
1000 1 512530104 11 512530103 5 512530102 8 512530101 6 512530100 14 512530099 11 512530098 10 512530097 9 512530096 16 512530095 19 512530094 14 512530093 13 512530092 19 512530091 19 512530090 16 512530089 25 512530088 23 512530087 23 512530086 20 512530085 25 512530084 28 512530083 26 512530082 2...
output:
958244
result:
ok 1 number(s): "958244"
Test #40:
score: 0
Accepted
time: 2ms
memory: 12072kb
input:
1000 1000 64518024 430401 39925447 458023 69125913 478039 76901443 405517 23917198 374187 88618541 359329 98888868 406933 7483302 446167 24208833 327394 103810381 434127 32198972 489826 66925362 465375 18239776 473895 38986062 337069 117485577 453385 36687921 292602 97558937 384411 105914301 373379 ...
output:
249197
result:
ok 1 number(s): "249197"
Test #41:
score: 0
Accepted
time: 0ms
memory: 12136kb
input:
1000 1000 113865526 1227912 408104437 1246334 344051165 878878 350912278 1578563 189916578 1435806 42158442 1222466 112833156 926107 282270722 1614928 244202425 924629 118214614 1182081 346744880 923736 818552 1193364 276432747 1232427 272968193 1002506 277749118 1182249 149205398 1238623 46536582 8...
output:
838217
result:
ok 1 number(s): "838217"
Test #42:
score: 0
Accepted
time: 2ms
memory: 12056kb
input:
1000 1000 98556997 1534734 613605172 2624435 572361139 2248172 489830583 1577795 282806530 1616872 32301608 2178358 604689879 2047299 271358777 2609805 110825259 1737639 92933283 1907832 477122628 1539190 109759728 2630071 466837391 2104552 596058321 2012720 463555698 2246559 473825434 1356751 61061...
output:
1330325
result:
ok 1 number(s): "1330325"
Test #43:
score: 0
Accepted
time: 0ms
memory: 14116kb
input:
1000 1000 147850971 1114794 50272223 1091607 200164858 1929625 44155810 1799735 277962963 2026517 173255602 1594883 55708666 1279044 341957483 1358008 118559151 1943192 253169029 1599708 277759217 1761512 416053070 1192944 58845962 1535658 158362500 1587124 468253366 1854588 75015120 1951804 1190711...
output:
1071053
result:
ok 1 number(s): "1071053"
Test #44:
score: 0
Accepted
time: 5ms
memory: 14112kb
input:
100 313 436568609 277902437 809501292 33063248 865167333 489021737 252755017 55001721 549850169 783725010 625029084 771890389 947080045 797296766 619215031 245939890 133185655 324270212 839002478 461462406 90524647 688358122 464050601 162463461 201648254 219031054 623721358 236951766 558156916 32614...
output:
653843538
result:
ok 1 number(s): "653843538"
Test #45:
score: 0
Accepted
time: 7ms
memory: 14160kb
input:
100 413 311629417 199409840 202773193 105836894 312548131 475264376 953843249 73351172 124741734 82215463 744515507 214938550 273493149 179273183 396094956 182134200 77994430 557912201 244257688 136916806 893693554 708375878 746414531 701668338 237147099 171674097 416854938 56094823 547129471 838939...
output:
620193396
result:
ok 1 number(s): "620193396"
Test #46:
score: 0
Accepted
time: 9ms
memory: 14116kb
input:
100 293 793724221 93073396 859964901 447082066 88874998 777534311 705307761 201874085 122124746 780136928 128114372 623580961 532725767 583241466 750385810 63814219 18963628 169893601 668058370 768696085 842090809 249682282 723458866 126920743 332301269 224696067 69013664 737358187 68341104 44194812...
output:
644543208
result:
ok 1 number(s): "644543208"
Test #47:
score: 0
Accepted
time: 4ms
memory: 14208kb
input:
10 115 928698420 664331972 758398643 491652838 494365864 80086044 915418807 116349728 144758814 374832874 286784118 583276259 315420297 448173868 232303744 184770800 567091762 634470313 350097318 85129774 417074544 336360 417410904 4 417410908 6 417410914 99 417411013 147 417411160 881 417412041 10 ...
output:
696332473
result:
ok 1 number(s): "696332473"
Test #48:
score: 0
Accepted
time: 2ms
memory: 13964kb
input:
10 137 831552083 224682882 12258712 139952042 716351504 134546407 638572775 265842921 857502447 69246343 335962619 249156534 636708222 78019504 245895314 250473383 79340053 169592798 655851034 140334838 152210754 124270 152335024 4216281 156551305 1 156551306 3366517 159917823 2 159917825 32943 1599...
output:
300128006
result:
ok 1 number(s): "300128006"
Test #49:
score: 0
Accepted
time: 10ms
memory: 16132kb
input:
100 722 834083255 45114305 101447864 11964454 123258139 43683307 214624596 32830434 986745834 3486060 491823810 14543354 605855803 17369915 843868604 46524989 425799844 14306183 143112863 48265222 131600254 38009781 996030274 38818095 264752914 44209581 484968615 48256178 900698317 45445597 95909067...
output:
48687048
result:
ok 1 number(s): "48687048"
Test #50:
score: 0
Accepted
time: 16ms
memory: 14160kb
input:
100 647 973763954 921586015 44587760 80002332 279524587 78937990 391143503 574780622 212336955 552801870 249293566 677692767 96470582 449267488 100600292 430292311 227684850 924469651 126208810 462699542 343862957 730956024 389534501 430165387 280272287 2371229 191734911 721961970 451446777 45437755...
output:
935446119
result:
ok 1 number(s): "935446119"
Test #51:
score: 0
Accepted
time: 16ms
memory: 14184kb
input:
100 678 749452329 736680664 31717680 763899108 916817622 262748712 906168743 200066826 91726392 383316630 795200963 583294054 277223486 658519490 418972628 662379954 923909918 476289045 568756335 78772906 290556603 857580105 640975146 458856867 240507353 420372076 268168912 484884716 537084550 71595...
output:
879084137
result:
ok 1 number(s): "879084137"
Test #52:
score: 0
Accepted
time: 11ms
memory: 14024kb
input:
10 778 665321056 579942257 848303726 571879044 987878241 593670363 212068916 162282909 878241548 96305236 19745118 4853075 816657009 608712285 217447493 491695196 499062011 326586858 586116900 148141048 20195430 2325087 21169215 290151 21749390 703324 22995141 387838 23177568 552714 23256064 1110292...
output:
855065235
result:
ok 1 number(s): "855065235"
Test #53:
score: 0
Accepted
time: 4ms
memory: 14160kb
input:
10 497 814774886 65487794 268395141 64583821 627522993 51326534 787369492 55517761 35284731 30404720 216516946 72563310 720643842 59760312 76873188 69949226 177690198 10465637 169537479 9171959 35407528 18188 35645170 55789 35922733 71783 36555427 49912 36626654 90425 36654287 65791 36729332 128374 ...
output:
73240865
result:
ok 1 number(s): "73240865"
Test #54:
score: 0
Accepted
time: 2ms
memory: 12128kb
input:
332 996 59880243 8 461077782 8 736526842 5 928143578 6 17964082 8 23952099 8 437125686 4 916167530 6 844311246 4 562874165 5 910179507 7 862275317 7 724550794 4 3 5 898203463 8 83832335 6 401197550 5 988023808 6 359281387 5 155688611 6 958083693 7 485029874 7 796407072 5 694610681 7 580838242 6 8622...
output:
11
result:
ok 1 number(s): "11"
Test #55:
score: 0
Accepted
time: 0ms
memory: 12188kb
input:
332 996 491017893 4 832335206 8 233532910 6 904191486 7 227544887 7 83832329 6 550898129 5 592814288 8 11976059 5 245508946 5 383233479 5 676646608 7 17964082 5 77844312 7 754490909 5 263473017 6 107784427 8 736526836 5 712574738 7 401197554 8 550898117 6 395209531 8 568862198 5 634730451 5 44311371...
output:
11
result:
ok 1 number(s): "11"
Test #56:
score: 0
Accepted
time: 2ms
memory: 12172kb
input:
320 960 647058882 6 411764728 5 75 8 117647147 4 705882485 8 823529447 8 352941315 5 411764772 5 529411810 7 117647077 6 529411852 8 823529525 6 411764786 5 823529457 7 470588283 4 764706030 7 117647093 5 58823628 4 58823556 5 294117762 8 764705992 6 176470592 8 58823588 8 109 4 705882451 7 141 6 82...
output:
9
result:
ok 1 number(s): "9"
Test #57:
score: 0
Accepted
time: 2ms
memory: 12100kb
input:
320 960 529411866 6 411764804 4 43 6 470588325 7 411764730 7 352941243 4 882352958 5 823529417 8 823529501 7 764705908 5 294117650 8 764705996 4 764705932 5 176470718 6 352941269 5 647058880 7 58823658 7 176470654 8 882353022 4 235294181 8 529411892 7 470588237 5 705882405 4 235294187 7 352941205 4 ...
output:
7
result:
ok 1 number(s): "7"
Test #58:
score: 0
Accepted
time: 0ms
memory: 12128kb
input:
320 960 411764760 6 117647165 6 411764844 5 882353028 4 176470718 6 705882373 8 882352950 5 294117758 7 294117736 6 176470606 8 67 8 705882503 4 647058942 5 235294189 5 470588365 4 588235441 6 823529437 5 764705918 5 764705952 8 58823602 8 529411858 4 58823638 5 588235423 4 470588339 5 176470648 6 5...
output:
9
result:
ok 1 number(s): "9"
Test #59:
score: 0
Accepted
time: 2ms
memory: 14196kb
input:
400 1000 666666763 4 428571502 8 380952387 5 666666739 5 29 6 523809576 4 809523886 6 571428639 6 523809650 8 571428603 4 857142865 5 142857280 8 857142857 5 47619162 6 761904851 5 809523818 5 380952399 6 619047622 4 714285824 4 666666699 5 666666665 7 666666717 5 523809550 5 380952501 6 857142973 6...
output:
8
result:
ok 1 number(s): "8"
Test #60:
score: 0
Accepted
time: 2ms
memory: 11996kb
input:
400 1000 857142951 8 380952485 5 428571456 8 285714345 6 95238201 5 190476197 4 619047726 6 809523830 7 714285792 4 809523902 6 95238219 6 63 6 333333418 6 190476245 7 142857220 8 857142945 7 476190573 6 666666795 7 714285734 7 761904855 7 190476219 5 47619070 6 380952377 4 904762018 6 904762008 6 6...
output:
11
result:
ok 1 number(s): "11"
Test #61:
score: 0
Accepted
time: 0ms
memory: 16160kb
input:
400 1000 761904865 6 571428681 8 333333432 8 857142977 7 238095272 6 857142899 6 142857228 7 619047660 5 761904755 4 476190587 4 95238161 6 809523930 8 476190537 5 95238119 6 523809632 4 142857266 5 142857180 4 95238095 4 666666749 6 47619156 8 238095316 8 47619058 8 190476319 8 285714367 5 23809530...
output:
9
result:
ok 1 number(s): "9"
Test #62:
score: 0
Accepted
time: 6ms
memory: 12116kb
input:
499 997 1 1995 2 1995 3 1995 4 1995 5 1995 6 1995 7 1995 8 1995 9 1995 10 1995 11 1995 12 1995 13 1995 14 1995 15 1995 16 1995 17 1995 18 1995 19 1995 20 1995 21 1995 22 1995 23 1995 24 1995 25 1995 26 1995 27 1995 28 1995 29 1995 30 1995 31 1995 32 1995 33 1995 34 1995 35 1995 36 1995 37 1995 38 19...
output:
2494
result:
ok 1 number(s): "2494"
Test #63:
score: 0
Accepted
time: 3ms
memory: 12084kb
input:
500 999 1 1999 2 1999 3 1999 4 1999 5 1999 6 1999 7 1999 8 1999 9 1999 10 1999 11 1999 12 1999 13 1999 14 1999 15 1999 16 1999 17 1999 18 1999 19 1999 20 1999 21 1999 22 1999 23 1999 24 1999 25 1999 26 1999 27 1999 28 1999 29 1999 30 1999 31 1999 32 1999 33 1999 34 1999 35 1999 36 1999 37 1999 38 19...
output:
2499
result:
ok 1 number(s): "2499"
Test #64:
score: 0
Accepted
time: 6ms
memory: 14132kb
input:
500 998 1 1999 2 1999 3 1999 4 1999 5 1999 6 1999 7 1999 8 1999 9 1999 10 1999 11 1999 12 1999 13 1999 14 1999 15 1999 16 1999 17 1999 18 1999 19 1999 20 1999 21 1999 22 1999 23 1999 24 1999 25 1999 26 1999 27 1999 28 1999 29 1999 30 1999 31 1999 32 1999 33 1999 34 1999 35 1999 36 1999 37 1999 38 19...
output:
2498
result:
ok 1 number(s): "2498"
Subtask #4:
score: 34
Accepted
Dependency #3:
100%
Accepted
Test #65:
score: 34
Accepted
time: 14ms
memory: 14168kb
input:
50000 50000 68045254 30127 10299918 47145 555028994 35108 335345452 49773 477064276 30071 653681268 30394 583466481 44862 38826176 41517 392602312 30023 193196028 43058 592649536 40583 400232754 38609 194181084 35408 419129559 53076 420090671 28190 664920736 27627 477286308 50316 578770380 39334 449...
output:
27113
result:
ok 1 number(s): "27113"
Test #66:
score: 0
Accepted
time: 2ms
memory: 16212kb
input:
1665 4995 832335065 8 218562804 4 212574782 4 410179508 4 814370997 4 305389123 4 667664482 7 308383134 4 434131624 7 473053743 4 335329233 4 242514892 4 838323105 4 431137609 4 158682584 4 613772280 4 251496931 8 293413083 4 808382995 4 895209294 4 871257230 7 820359039 4 131736491 8 101796403 7 75...
output:
9
result:
ok 1 number(s): "9"
Test #67:
score: 0
Accepted
time: 22ms
memory: 24852kb
input:
16665 49995 30593897 5 912417497 5 269046203 6 410018011 4 388422319 6 335632877 5 561187763 6 250149965 4 818536277 5 35392939 6 945110957 5 630473885 4 302039585 4 477804439 6 326934617 5 601379705 4 316436717 5 297840437 5 673065383 6 943311317 5 581583665 4 978104371 4 147570497 5 957708437 5 75...
output:
9
result:
ok 1 number(s): "9"
Test #68:
score: 0
Accepted
time: 330ms
memory: 65580kb
input:
50000 50000 376286561 16081591 466918453 131771558 297544364 650091671 40109883 586653882 243645277 104553947 341737953 426166034 726633349 859193760 407193960 81824530 534448672 344445836 198952889 987705714 631168208 188556323 237258670 751151391 483301486 856984992 121246062 648245756 790456495 7...
output:
199190014
result:
ok 1 number(s): "199190014"
Test #69:
score: 0
Accepted
time: 517ms
memory: 69184kb
input:
50000 50000 441544655 944833994 691151268 632288208 224658141 58543459 616452155 663516302 24484123 426716523 925488621 44202746 334572325 123595547 337140469 121759435 844759882 500888572 750457261 646694213 349972834 574982182 177576728 945455687 942884637 26365145 719279750 319260806 388027568 10...
output:
312454709
result:
ok 1 number(s): "312454709"
Test #70:
score: 0
Accepted
time: 306ms
memory: 67412kb
input:
50000 50000 229664704 973918599 373260897 438194690 625447911 313076765 50097945 979581844 880971835 374964825 994951534 642680812 585836384 111237171 666751803 796758931 799503472 458330114 140060099 892917730 548456452 978806370 264051441 420743609 21528535 472700680 917040214 915884133 931727969 ...
output:
172811491
result:
ok 1 number(s): "172811491"
Test #71:
score: 0
Accepted
time: 538ms
memory: 67308kb
input:
50000 50000 329145923 500515400 102482930 949038219 798481335 451408742 732678637 249810723 934962890 328059606 781041081 965693810 578066102 24371197 256441354 133348398 673351593 683540313 336050807 187579673 139018959 67460909 516669268 143418555 154209946 907377482 595167317 324290583 318104196 ...
output:
338058665
result:
ok 1 number(s): "338058665"
Test #72:
score: 0
Accepted
time: 1604ms
memory: 116612kb
input:
50000 50000 220200647 587462041 1367588 864466821 400349800 146966922 292092005 277444528 707999360 905019039 497186483 641683537 145008526 94269926 833612749 13356390 743702718 866006218 875122231 400003225 442419757 397012399 258483763 266055280 599410687 556966745 702623500 401962981 733107959 69...
output:
768697101
result:
ok 1 number(s): "768697101"
Test #73:
score: 0
Accepted
time: 107ms
memory: 66328kb
input:
50000 50000 801641392 978828603 500257192 713312200 704495215 55080552 913999572 686477628 957608370 473203980 259310957 576948403 567591301 695542618 472449050 192135202 866129150 145948440 156524062 815245673 721369938 401385051 599312174 651578006 324295552 588990208 327892480 138137170 893550290...
output:
7125694
result:
ok 1 number(s): "7125694"
Test #74:
score: 0
Accepted
time: 1774ms
memory: 58024kb
input:
1 50000 74952758 285187976 364798509 330083111 910849054 210082925 801745541 8315417 724476511 578401716 739805562 382946983 719495687 854455014 951170202 392357721 456718126 874521187 34975326 47868884 73769217 159200155 819292205 597322809 757889978 593005885 185649979 641590322 685801040 12089753...
output:
23160892508125
result:
ok 1 number(s): "23160892508125"
Test #75:
score: 0
Accepted
time: 673ms
memory: 32460kb
input:
1 50000 97087518 293994272 234930387 163 234930550 2614 234933164 1158 234934322 623 234934945 191 234935136 1610 234936746 2576 234939322 726 234940048 3368 234943416 5058 234948474 770 234949244 491 234949735 374 234950109 4382 234954491 4974 234959465 5810 234965275 4265 234969540 1733 234971273 ...
output:
596940249
result:
ok 1 number(s): "596940249"
Test #76:
score: 0
Accepted
time: 29ms
memory: 28548kb
input:
50000 1 228786803 250332822 367203332 868637792 13818145 216614506 322476562 17715044 367821777 931320726 221482767 980720929 8327778 716779206 348877912 927100357 613121621 310082609 471648560 826196603 398232369 968352547 651124872 933814682 743868138 999975702 660240544 184074873 72518472 8690889...
output:
54105
result:
ok 1 number(s): "54105"
Test #77:
score: 0
Accepted
time: 26ms
memory: 22224kb
input:
50000 1 935189372 929454682 935189371 475629824 935189370 997547895 935189369 829985376 935189368 480751391 935189367 455553317 935189366 662445405 935189365 26620095 935189364 566613699 935189363 196156876 935189362 72520442 935189361 136596368 935189360 518723584 935189359 639578960 935189358 7351...
output:
9317
result:
ok 1 number(s): "9317"
Test #78:
score: 0
Accepted
time: 216ms
memory: 16204kb
input:
50000 1 503842803 4 503842802 11 503842801 9 503842800 6 503842799 6 503842798 15 503842797 8 503842796 13 503842795 12 503842794 13 503842793 13 503842792 15 503842791 19 503842790 21 503842789 20 503842788 17 503842787 23 503842786 28 503842785 26 503842784 22 503842783 31 503842782 31 503842781 2...
output:
38577
result:
ok 1 number(s): "38577"
Test #79:
score: 0
Accepted
time: 20ms
memory: 16208kb
input:
50000 50000 108059522 29215 80476902 17460 21262959 24075 85054227 28786 253233680 24521 270365608 21701 264138844 32091 242446699 20996 37105865 31840 197638574 25638 56628269 26266 100109518 21140 303815845 21575 401491073 31593 17203746 22732 383167950 22402 182827019 21098 71414930 26658 1892300...
output:
16070
result:
ok 1 number(s): "16070"
Test #80:
score: 0
Accepted
time: 19ms
memory: 14124kb
input:
50000 50000 259972802 11680 83763212 11966 160564204 21914 210598506 13123 108663529 19797 38357282 16485 180807775 13111 233482517 21289 3353164 21801 120469539 16335 58104445 16200 250901912 17189 56309498 15564 220716081 15900 235627700 16514 109218786 17351 75672615 20993 188447365 12163 7668053...
output:
11504
result:
ok 1 number(s): "11504"
Test #81:
score: 0
Accepted
time: 20ms
memory: 14188kb
input:
50000 50000 706270234 58448 154479114 64121 239834001 56199 414844929 49785 373373791 61864 392282224 50405 407084034 57044 467250069 60445 353323495 49056 410220598 60592 443843499 49502 8999183 60444 11394831 34368 39941101 53507 389228625 46546 76323452 50729 107084559 40237 695657247 38946 16084...
output:
33266
result:
ok 1 number(s): "33266"
Test #82:
score: 0
Accepted
time: 17ms
memory: 14196kb
input:
50000 50000 545367914 56647 506424239 47385 710267145 54922 434095075 65863 364175114 58544 860431208 37470 834023327 45054 576503253 71615 447013629 55520 2383281 56942 594316674 46735 11657228 46107 390850197 38489 552632957 54427 881639365 70600 566796344 52761 419388997 47049 553499724 36433 417...
output:
35820
result:
ok 1 number(s): "35820"
Test #83:
score: 0
Accepted
time: 526ms
memory: 38688kb
input:
5000 32915 254642267 39001966 30894683 54271685 185216092 41107011 586353937 26194070 752546729 28987111 345536445 52630468 520025777 25744472 246925680 17860175 444299198 45144171 93994832 16961153 167280290 36500578 267503927 40944014 150627289 2935331 303345512 13454403 754259520 4319914 36188879...
output:
60782894
result:
ok 1 number(s): "60782894"
Test #84:
score: 0
Accepted
time: 339ms
memory: 26444kb
input:
5000 14736 471735699 270240463 622473873 377984977 473656689 169208197 878533143 311439091 313843373 21983390 510932961 609659544 692561870 716186082 846819409 6463555 425217977 692872822 85769817 123225107 758158545 18586255 880657634 260950517 934296295 209707669 894385065 609110407 360948089 7500...
output:
643946582
result:
ok 1 number(s): "643946582"
Test #85:
score: 0
Accepted
time: 278ms
memory: 26400kb
input:
5000 10091 548322373 805460126 596491285 737768652 513065288 466376480 382654236 691087323 816813215 352464421 702615903 488514321 97036041 622738038 71190796 83072710 454280095 354988799 109170571 274673310 976518342 355601533 117859814 834192277 303364338 441236573 622340219 291906025 535038561 96...
output:
721648378
result:
ok 1 number(s): "721648378"
Test #86:
score: 0
Accepted
time: 103ms
memory: 18268kb
input:
500 7301 868105227 272473339 200255350 186175354 597874732 54528553 929455239 214992314 610672638 279161340 79801324 9909170 832747450 291126546 173533495 75142379 606520226 106794890 240232352 11388319 245865090 163905274 158359356 178661559 202421065 103724265 25837686 64808097 332871723 300646338...
output:
302409660
result:
ok 1 number(s): "302409660"
Test #87:
score: 0
Accepted
time: 104ms
memory: 16080kb
input:
500 7892 38531062 5388553 281535007 34061459 940423890 6499013 366477603 40827705 152447437 18020168 463335993 9405045 946430035 12598579 784458274 8261159 815331798 4107383 953812675 29134515 135154365 5392356 367790441 14323804 593454539 24844258 615052722 24158130 85553694 41051122 663423300 4291...
output:
43012709
result:
ok 1 number(s): "43012709"
Test #88:
score: 0
Accepted
time: 709ms
memory: 40792kb
input:
5000 34835 293971840 23573302 961739694 77969855 393100990 66960161 261925329 557830739 279137176 392087036 83140264 98105556 701370248 280488414 873528034 17705197 339468266 598007606 687772576 134004210 515195077 451111236 451850553 642305886 124103317 136504950 290913174 266664067 633526729 36687...
output:
662852923
result:
ok 1 number(s): "662852923"
Test #89:
score: 0
Accepted
time: 685ms
memory: 40736kb
input:
5000 34961 765010971 60971372 98490108 436212428 156381561 350406692 61095646 73536595 703392322 23817771 899733245 1072233 619823014 466325374 770070629 166760046 637338715 461758471 901569504 443356564 984592005 444365707 404601223 317205343 578387979 12816909 714739019 128753243 817108344 3985051...
output:
480413235
result:
ok 1 number(s): "480413235"
Test #90:
score: 0
Accepted
time: 719ms
memory: 42760kb
input:
5000 35066 516049165 572833733 559243467 418601549 390199340 4876745 35003159 446786652 745965701 525575406 535640888 418316475 738339955 413274594 868531302 430856023 112577914 248286904 188918908 99806466 282867628 374761320 947542606 562601118 744697397 30903353 424115118 435175812 578510358 4801...
output:
583132223
result:
ok 1 number(s): "583132223"
Test #91:
score: 0
Accepted
time: 487ms
memory: 28492kb
input:
500 33355 993530216 259514442 3535337 197617070 739679301 369122514 790970954 122362395 289565284 412353840 931000687 55429772 312883790 457468225 207263082 256176273 744596977 85860311 475565074 5733378 539994005 132797095 216999192 322275855 460127319 393861948 824936400 166007563 199197362 247638...
output:
470671512
result:
ok 1 number(s): "470671512"
Test #92:
score: 0
Accepted
time: 479ms
memory: 29416kb
input:
500 30687 257167889 830153598 280767487 63094543 258682940 588992434 806729815 616419258 856085834 837249806 521381273 228845153 149283775 594902040 195030745 546860281 800138842 448187379 49844950 264274548 688974087 127509901 290393244 34116328 786537710 592963443 863585358 390690646 125840691 658...
output:
880680898
result:
ok 1 number(s): "880680898"
Test #93:
score: 0
Accepted
time: 33ms
memory: 24356kb
input:
16600 49800 857725053 6 799298554 6 672085406 8 358871206 6 747256808 4 780746636 7 539330766 4 385373936 7 946388761 4 654617691 7 149740488 5 683047903 8 445727907 7 451389862 6 275026170 7 34814970 5 898563354 6 146006017 5 798214349 4 392240559 8 415129283 6 344174232 7 562219498 4 545113182 7 2...
output:
11
result:
ok 1 number(s): "11"
Test #94:
score: 0
Accepted
time: 23ms
memory: 26388kb
input:
16600 49800 929161984 4 139139386 4 256956120 5 591492983 5 482470348 4 350197578 7 920006482 8 43368133 5 61558644 5 708105039 7 184194054 6 917958551 8 941208684 4 170219878 4 319960359 5 53125958 4 250209972 6 471989717 6 515237362 7 103722100 4 944340822 6 654015356 4 421634507 5 246595958 5 989...
output:
10
result:
ok 1 number(s): "10"
Test #95:
score: 0
Accepted
time: 26ms
memory: 24144kb
input:
16000 48000 192259625 4 26217232 7 601747665 4 568039902 6 530586584 8 978776311 6 192259663 8 123595464 8 747815104 5 314606727 8 163545632 7 42447045 6 747814968 7 6242292 7 270911280 7 825218272 8 710361822 5 384519261 8 230961264 7 72409549 5 741572829 6 404494285 5 952559008 5 191011178 8 57303...
output:
10
result:
ok 1 number(s): "10"
Test #96:
score: 0
Accepted
time: 25ms
memory: 17196kb
input:
16000 48000 960049692 4 903869939 6 409488043 8 308364532 8 250936314 5 682896214 7 744069717 5 210986264 6 802746316 7 621722647 6 44943929 5 596753977 4 37453321 8 451935035 8 79900111 5 911360585 8 746566651 7 990012274 6 571785063 7 53683032 6 980024654 6 205992512 8 275905112 8 848938603 5 7365...
output:
8
result:
ok 1 number(s): "8"
Test #97:
score: 0
Accepted
time: 7ms
memory: 22348kb
input:
16000 48000 443195890 7 454431923 7 430711526 6 513108470 8 591760201 4 410736434 4 769038501 7 790261908 8 553058598 7 59925125 5 530586632 6 689138387 8 88639306 7 940074660 8 440699030 8 561797685 7 724094643 4 314606673 7 505617836 4 555555392 7 518102198 7 369537947 4 365792758 6 133583012 5 22...
output:
9
result:
ok 1 number(s): "9"
Test #98:
score: 0
Accepted
time: 13ms
memory: 20284kb
input:
20000 50000 402597017 8 594405043 8 937062109 8 981018045 7 436563041 8 511488065 6 157842059 7 428571083 5 151848023 4 316683017 4 803196027 5 722277045 7 699300119 6 194805117 5 246753029 5 724275017 4 176823047 6 260739019 7 512487023 4 923076009 6 290709077 6 880119051 5 885114067 6 708291015 8 ...
output:
6
result:
ok 1 number(s): "6"
Test #99:
score: 0
Accepted
time: 27ms
memory: 23468kb
input:
20000 50000 744255025 8 566433113 7 812187123 7 310689023 6 76923101 8 956043127 7 561438003 6 655344121 4 352647029 8 244755025 5 165834023 5 177822117 4 160839041 7 636363027 7 560439019 5 552447129 8 873126049 6 933066051 5 828171033 4 305694065 7 469530001 7 711288057 7 80919025 7 532467107 8 43...
output:
9
result:
ok 1 number(s): "9"
Test #100:
score: 0
Accepted
time: 39ms
memory: 25388kb
input:
20000 50000 313686031 7 222777069 7 629370043 8 119880029 5 30969069 8 985014067 6 605394111 4 197802131 6 179820117 7 736263051 8 565434025 8 458541067 7 391608049 5 257742017 6 49950025 7 514485027 8 463536071 7 770229095 7 871128033 8 702297003 7 785214101 8 478521137 8 283716083 7 672327117 5 40...
output:
11
result:
ok 1 number(s): "11"
Test #101:
score: 0
Accepted
time: 359ms
memory: 16984kb
input:
24999 49997 1 99995 2 99995 3 99995 4 99995 5 99995 6 99995 7 99995 8 99995 9 99995 10 99995 11 99995 12 99995 13 99995 14 99995 15 99995 16 99995 17 99995 18 99995 19 99995 20 99995 21 99995 22 99995 23 99995 24 99995 25 99995 26 99995 27 99995 28 99995 29 99995 30 99995 31 99995 32 99995 33 99995 ...
output:
124994
result:
ok 1 number(s): "124994"
Test #102:
score: 0
Accepted
time: 361ms
memory: 16380kb
input:
25000 49999 1 99999 2 99999 3 99999 4 99999 5 99999 6 99999 7 99999 8 99999 9 99999 10 99999 11 99999 12 99999 13 99999 14 99999 15 99999 16 99999 17 99999 18 99999 19 99999 20 99999 21 99999 22 99999 23 99999 24 99999 25 99999 26 99999 27 99999 28 99999 29 99999 30 99999 31 99999 32 99999 33 99999 ...
output:
124999
result:
ok 1 number(s): "124999"
Test #103:
score: 0
Accepted
time: 372ms
memory: 14796kb
input:
25000 49998 1 99999 2 99999 3 99999 4 99999 5 99999 6 99999 7 99999 8 99999 9 99999 10 99999 11 99999 12 99999 13 99999 14 99999 15 99999 16 99999 17 99999 18 99999 19 99999 20 99999 21 99999 22 99999 23 99999 24 99999 25 99999 26 99999 27 99999 28 99999 29 99999 30 99999 31 99999 32 99999 33 99999 ...
output:
124998
result:
ok 1 number(s): "124998"
Subtask #5:
score: 19
Accepted
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Dependency #4:
100%
Accepted
Test #104:
score: 19
Accepted
time: 34ms
memory: 15608kb
input:
100000 100000 225069772 19473 370927368 24211 741836767 28413 302790343 26588 53365948 26819 651095222 19940 712587352 24895 226564065 23752 318945029 27621 368906661 20602 81283265 20097 405336787 24735 435340687 28163 582653268 19467 208782917 29199 129319664 24007 264270146 19440 300200197 20842 ...
output:
14864
result:
ok 1 number(s): "14864"
Test #105:
score: 0
Accepted
time: 56ms
memory: 32396kb
input:
33330 99990 500523311 8 269985625 4 247036829 4 898752093 7 706312353 4 776808593 4 29398461 7 165741165 4 457175623 8 659064873 4 250936641 4 130043071 8 619466985 4 739460589 7 816706447 8 760309449 4 362830673 4 383229589 7 131393017 4 101694577 4 399578693 4 997296833 4 836805375 8 246136897 4 9...
output:
9
result:
ok 1 number(s): "9"
Test #106:
score: 0
Accepted
time: 63ms
memory: 30664kb
input:
33330 99990 602067893 4 771408861 4 74396037 4 133792881 5 703912479 6 686813385 5 736310759 4 978097855 6 779958423 6 396578853 4 512072693 4 774408713 5 783408235 6 671514201 5 767209085 4 657264961 5 388329305 5 875353335 6 101394615 6 763159327 4 899952031 4 619166981 4 995346929 5 579269109 4 1...
output:
9
result:
ok 1 number(s): "9"
Test #107:
score: 0
Accepted
time: 2949ms
memory: 177680kb
input:
100000 100000 307995407 714027382 778971493 173095583 487845655 405499996 865199723 387387146 68014499 498137726 896297665 463125741 997332363 745165852 353604718 443029793 218062135 390832239 891107193 314395901 470807391 43349450 506368037 319469955 574654816 896633059 926924599 172968764 38605013...
output:
735104823
result:
ok 1 number(s): "735104823"
Test #108:
score: 0
Accepted
time: 1026ms
memory: 118340kb
input:
100000 100000 88225331 223366925 188985524 543012805 451155498 786169482 335287180 875960232 125300811 206833370 221120386 309612830 191322712 378449974 491008763 840218117 408419650 982164181 805393213 744903783 321921658 125078097 316294322 399251761 980610747 728896011 795953915 1746314 685665224...
output:
307795307
result:
ok 1 number(s): "307795307"
Test #109:
score: 0
Accepted
time: 964ms
memory: 118228kb
input:
100000 100000 263668950 278185100 337934380 304639427 761816339 149660966 2815448 589396482 23875644 160225951 970785316 649559513 257393767 638669620 882632464 250310239 231345165 773324090 666061370 4597976 873778293 941452452 103231860 64101306 632201131 302952097 947248892 83109636 566765376 256...
output:
293459358
result:
ok 1 number(s): "293459358"
Test #110:
score: 0
Accepted
time: 72ms
memory: 40416kb
input:
100000 100000 467128416 411494085 545710307 892184444 891215636 931425975 537385967 189345031 616088715 517960620 598455174 645775325 186571662 785290394 169584736 482028294 844519611 445098978 579947556 42906149 527615214 173748627 486746903 547728395 667712713 551453320 630091193 771415564 1953804...
output:
19165
result:
ok 1 number(s): "19165"
Test #111:
score: 0
Accepted
time: 138ms
memory: 89624kb
input:
100000 100000 298097461 894884863 390809989 314416108 414178025 972716581 219677199 759698006 272499704 80380964 926886761 823165659 481627510 637572277 411309765 226130630 435806221 560805497 419844987 360429537 553198876 564924598 331926015 322292143 256601662 39906484 163940539 851983213 95067227...
output:
12029
result:
ok 1 number(s): "12029"
Test #112:
score: 0
Accepted
time: 3151ms
memory: 214484kb
input:
100000 100000 764377444 478314951 543844512 544908929 983820948 408025621 527123496 600169760 82512888 313570711 149185862 678278283 392029598 181136007 169101159 27400017 758472807 466222290 161416102 390728101 545081980 904822291 252145829 523081192 965422768 854893343 560921871 798989346 22590005...
output:
759955088
result:
ok 1 number(s): "759955088"
Test #113:
score: 0
Accepted
time: 3832ms
memory: 110460kb
input:
1 100000 13707189 613247104 752462988 2107403 742316583 549567512 994628062 426595398 473155933 62305846 935291150 619311855 424108174 735413828 989961853 740988709 717162780 140508735 337248356 85595743 50866713 308710206 840917741 992660659 603165465 88798365 416770947 503757151 296960758 79254081...
output:
49306702889443
result:
ok 1 number(s): "49306702889443"
Test #114:
score: 0
Accepted
time: 1426ms
memory: 52940kb
input:
1 100000 99441592 596180599 372115920 4281 372120201 302 372120503 3571 372124074 1109 372125183 2468 372127651 3439 372131090 4513 372135603 1221 372136824 194 372137018 474 372137492 1731 372139223 4123 372143346 2465 372145811 4982 372150793 2239 372153032 4707 372157739 250 372157989 764 3721587...
output:
1218624883
result:
ok 1 number(s): "1218624883"
Test #115:
score: 0
Accepted
time: 66ms
memory: 44832kb
input:
100000 1 363262944 792803191 734741218 414639035 319644340 757717833 427425072 267308229 212411675 956879234 708646971 50431046 520363788 311245132 601212298 953390645 428296515 593995776 305562452 363228304 499395032 168866524 735079057 136809218 198477916 501613845 738894317 307307492 783779751 84...
output:
18212
result:
ok 1 number(s): "18212"
Test #116:
score: 0
Accepted
time: 66ms
memory: 32536kb
input:
100000 1 906773002 395181747 906773001 751348349 906773000 912749095 906772999 60666589 906772998 777934585 906772997 580693449 906772996 337480027 906772995 863224191 906772994 813411343 906772993 601949703 906772992 170479478 906772991 169749037 906772990 7258463 906772989 830328663 906772988 4621...
output:
14131
result:
ok 1 number(s): "14131"
Test #117:
score: 0
Accepted
time: 223ms
memory: 20268kb
input:
100000 1 633560720 8 633560719 9 633560718 6 633560717 5 633560716 15 633560715 13 633560714 15 633560713 10 633560712 13 633560711 19 633560710 14 633560709 16 633560708 22 633560707 15 633560706 21 633560705 21 633560704 23 633560703 20 633560702 26 633560701 25 633560700 25 633560699 26 633560698...
output:
33705
result:
ok 1 number(s): "33705"
Test #118:
score: 0
Accepted
time: 36ms
memory: 18232kb
input:
100000 100000 267315948 20215 185374582 18233 181700754 17340 221078084 18086 277347568 15936 454491312 19456 11226020 15403 267469375 21050 461137403 15815 515312909 14008 40765617 16774 119228842 16165 60558626 14693 300757044 19356 415688997 12459 317358401 13983 105295449 20518 25369782 20579 33...
output:
10598
result:
ok 1 number(s): "10598"
Test #119:
score: 0
Accepted
time: 33ms
memory: 17732kb
input:
100000 100000 742866310 21278 392287371 22140 444983191 22512 38849910 16984 245830800 21606 302107115 22588 684128090 26122 634851150 20915 123831669 28233 104563266 22943 202230452 27665 336573174 17113 674573442 18907 89314836 24209 274953053 28571 132671119 25146 268131282 20270 435242006 16977 ...
output:
15357
result:
ok 1 number(s): "15357"
Test #120:
score: 0
Accepted
time: 38ms
memory: 16188kb
input:
100000 100000 218209682 10446 218814696 7704 228921636 10330 244076809 8215 250811199 6568 8605950 9567 244953996 7680 103547450 5638 83040581 10112 9380061 10742 155586590 8448 7846553 9352 125088278 8648 17023581 5537 115625975 6756 40190558 7176 147003395 9820 76145542 10648 44705360 7359 2657823...
output:
5452
result:
ok 1 number(s): "5452"
Test #121:
score: 0
Accepted
time: 34ms
memory: 18572kb
input:
100000 100000 83529880 13157 74036490 10352 371381414 17591 440408993 11536 235086889 9346 13501960 14294 91744032 15568 192439514 13582 83675240 12564 377734708 16416 416319389 10750 101856501 11853 431719166 17040 332771176 16910 126168762 12670 96867674 10074 65698204 9761 405274202 10163 4218027...
output:
8908
result:
ok 1 number(s): "8908"
Test #122:
score: 0
Accepted
time: 869ms
memory: 48980kb
input:
10000 45900 98798026 397970988 392343124 58738667 815399043 398047343 804205662 472197176 373905271 390955559 342990769 483360597 982432260 501432035 471336646 70173503 573412616 77637074 262214858 353859203 464411126 172095017 248838153 165401610 939976027 271769674 532920635 207945269 124454922 19...
output:
420713925
result:
ok 1 number(s): "420713925"
Test #123:
score: 0
Accepted
time: 905ms
memory: 50928kb
input:
10000 44917 599322101 404862771 468797333 76701169 757799769 134163066 710158456 43072789 520646800 303751123 653228957 479096889 46864502 65217566 406723563 2240709 57480557 497563610 229443137 388627249 787524876 57318310 394112183 340745548 621703901 193874822 22127414 378415550 199890520 3476993...
output:
438572833
result:
ok 1 number(s): "438572833"
Test #124:
score: 0
Accepted
time: 887ms
memory: 49024kb
input:
10000 42946 637827099 176809328 27366172 294064383 640921793 172813389 943610171 24504692 772880957 303013831 403705785 254829174 710015020 231387354 740700627 469290852 315874044 52090278 503452373 256956620 318971170 128593275 358237817 202913980 901391913 498195581 377397467 478198813 590087965 4...
output:
465861416
result:
ok 1 number(s): "465861416"
Test #125:
score: 0
Accepted
time: 145ms
memory: 20252kb
input:
1000 9333 582228464 408139656 205511749 324679917 540849676 592279196 559106232 454519931 553844023 172957579 973600785 93541154 249238562 121691958 946302976 87238863 896792314 616483321 743628494 461929878 731697616 177420889 929983140 467815572 579291858 52298217 859791044 682341809 813430530 618...
output:
574815284
result:
ok 1 number(s): "574815284"
Test #126:
score: 0
Accepted
time: 207ms
memory: 22348kb
input:
1000 16054 331942726 51218005 45643590 18167638 563740277 32150013 52036961 20071419 182654976 52913686 355057556 63577872 530808025 42936693 624257980 75759404 400208856 30953033 196355669 66609170 463782280 44961996 330474244 37398842 311497838 24824540 544069078 12530038 298974457 59525983 512590...
output:
81855376
result:
ok 1 number(s): "81855376"
Test #127:
score: 0
Accepted
time: 1407ms
memory: 65352kb
input:
10000 69611 384133056 304225103 705573685 199552406 606242744 105122410 775946105 157668925 913019080 166055662 210479437 138746232 55332762 534434189 479275716 313899411 77315608 213176081 147827237 232190314 173205087 255347514 396569583 343170469 214442153 353085987 49108032 226735992 688928380 4...
output:
560454927
result:
ok 1 number(s): "560454927"
Test #128:
score: 0
Accepted
time: 1350ms
memory: 65356kb
input:
10000 69688 277180806 370404727 885586298 171782399 25951233 78638441 563695730 402779401 774855503 406689672 427988467 347576387 146855285 340408743 109926864 273444422 967986460 186189148 339228588 171309936 990434466 224132432 986863861 503251378 321145841 48424376 317484456 226164047 310697714 1...
output:
529509390
result:
ok 1 number(s): "529509390"
Test #129:
score: 0
Accepted
time: 1270ms
memory: 69460kb
input:
10000 70275 627276271 195469817 655104686 112701328 736737061 109453176 997096060 161702124 541032746 132699175 227848687 130746698 610714401 145834398 142765029 62680764 554900833 150632201 352263726 136182845 584036710 85688963 132592779 106381452 515281100 137718528 703399558 40327388 356533155 1...
output:
196071884
result:
ok 1 number(s): "196071884"
Test #130:
score: 0
Accepted
time: 918ms
memory: 42844kb
input:
1000 67435 524256942 12820750 122384909 63822060 992441566 140070586 853958589 166533006 260845438 32226582 998053203 33481793 933666188 61149865 32025070 42501734 356271058 116455503 790954005 161947701 739775935 135063787 273538863 13603107 804603925 36283315 652402932 82674713 137894816 166061615...
output:
170341301
result:
ok 1 number(s): "170341301"
Test #131:
score: 0
Accepted
time: 982ms
memory: 49008kb
input:
1000 65798 624077512 660424920 412095086 750618122 566575982 531810119 312678405 764866925 93436762 772829729 729657505 243331146 795046525 742433611 14477028 385412854 124151586 22791335 414554672 709390408 441347997 473776286 91778175 91892844 620153434 438085425 188516684 466956079 474762693 6503...
output:
788885662
result:
ok 1 number(s): "788885662"
Test #132:
score: 0
Accepted
time: 33ms
memory: 23812kb
input:
33200 99600 667727156 6 852714987 7 946925655 7 553939455 7 314376914 4 208721220 7 191613910 5 474848278 8 859401294 7 788442098 7 500509248 7 961503007 7 440091535 4 992043168 7 652487199 7 301245240 7 291306137 6 250043798 5 872713671 7 102643861 8 115715288 4 729168900 7 610803195 7 725855855 4 ...
output:
7
result:
ok 1 number(s): "7"
Test #133:
score: 0
Accepted
time: 55ms
memory: 35928kb
input:
33200 99600 302931884 7 219503637 5 265343990 4 352808120 4 802959215 4 749348289 8 952226499 5 141737662 6 114932209 5 498882839 5 666341703 6 379553350 8 567432549 6 956141912 4 670859480 5 427441765 7 485690932 5 194987182 6 81440433 6 53791648 8 794224848 6 567733738 8 10541486 8 14155696 8 4655...
output:
11
result:
ok 1 number(s): "11"
Test #134:
score: 0
Accepted
time: 49ms
memory: 32544kb
input:
32000 96000 867582022 8 74953225 6 106808270 7 608993858 4 677700874 6 17489187 6 166770716 4 71205535 7 139912531 6 332292123 8 368519343 6 148032386 4 342285739 4 925045982 5 767644534 5 221111707 4 141786318 6 326670570 7 922547614 4 145533998 4 202373457 5 571517354 8 148032336 5 936288916 8 925...
output:
8
result:
ok 1 number(s): "8"
Test #135:
score: 0
Accepted
time: 33ms
memory: 32596kb
input:
32000 96000 206121023 5 274828073 6 833853094 7 517176333 7 684571555 7 381636170 5 174266012 7 55590218 5 728294197 4 827606970 5 170518288 7 534665445 5 903809224 5 682697770 8 367270121 6 8120048 4 823234735 7 82448539 7 414740481 8 513428749 4 991879195 6 969393309 8 757650874 7 50593486 7 23547...
output:
9
result:
ok 1 number(s): "9"
Test #136:
score: 0
Accepted
time: 29ms
memory: 32460kb
input:
32000 96000 488444307 6 736414088 7 508431731 4 710180442 8 332292037 6 46221153 8 920673823 4 591504768 6 539662231 8 317926136 5 722672640 6 640224304 8 931292034 5 216739448 4 68707087 5 810117934 5 811991781 5 881323388 4 244846747 5 737038771 4 58088786 6 631479798 6 80574708 6 291692430 8 5977...
output:
9
result:
ok 1 number(s): "9"
Test #137:
score: 0
Accepted
time: 33ms
memory: 36120kb
input:
40000 100000 273863089 7 565217329 8 325837027 8 969515063 4 689655049 6 814092771 6 744627505 8 527736107 8 30484835 4 516741629 5 129435329 8 575212259 7 967516041 8 551724085 7 957521121 4 390804599 6 856071821 5 803098331 7 385807025 5 957521123 8 771114305 4 649175273 4 666666581 7 715642085 4 ...
output:
8
result:
ok 1 number(s): "8"
Test #138:
score: 0
Accepted
time: 37ms
memory: 32552kb
input:
40000 100000 512743523 7 940529567 8 63468349 5 288355753 7 165417261 4 778610507 6 696651613 6 168415851 4 362818575 7 6996559 6 697151269 8 114442751 5 847576137 7 910044851 4 435782045 5 517741033 6 698150859 4 452773631 4 690154827 7 262868605 7 475762085 8 989005357 8 64967585 5 944527559 4 679...
output:
8
result:
ok 1 number(s): "8"
Test #139:
score: 0
Accepted
time: 39ms
memory: 37012kb
input:
40000 100000 361319259 7 541229371 6 709145313 7 987506133 6 639680035 6 569715099 4 777111271 6 225887115 5 724637503 7 20989541 5 671164363 8 246876607 7 177411321 8 937031309 7 548225825 8 600199845 5 857071299 5 538730543 5 74462865 7 119440379 8 521739085 8 319340313 7 400799527 4 953523077 8 1...
output:
8
result:
ok 1 number(s): "8"
Test #140:
score: 0
Accepted
time: 800ms
memory: 21932kb
input:
49999 99997 1 199995 2 199995 3 199995 4 199995 5 199995 6 199995 7 199995 8 199995 9 199995 10 199995 11 199995 12 199995 13 199995 14 199995 15 199995 16 199995 17 199995 18 199995 19 199995 20 199995 21 199995 22 199995 23 199995 24 199995 25 199995 26 199995 27 199995 28 199995 29 199995 30 1999...
output:
249994
result:
ok 1 number(s): "249994"
Test #141:
score: 0
Accepted
time: 776ms
memory: 23960kb
input:
50000 99999 1 199999 2 199999 3 199999 4 199999 5 199999 6 199999 7 199999 8 199999 9 199999 10 199999 11 199999 12 199999 13 199999 14 199999 15 199999 16 199999 17 199999 18 199999 19 199999 20 199999 21 199999 22 199999 23 199999 24 199999 25 199999 26 199999 27 199999 28 199999 29 199999 30 1999...
output:
249999
result:
ok 1 number(s): "249999"
Test #142:
score: 0
Accepted
time: 802ms
memory: 18916kb
input:
50000 99998 1 199999 2 199999 3 199999 4 199999 5 199999 6 199999 7 199999 8 199999 9 199999 10 199999 11 199999 12 199999 13 199999 14 199999 15 199999 16 199999 17 199999 18 199999 19 199999 20 199999 21 199999 22 199999 23 199999 24 199999 25 199999 26 199999 27 199999 28 199999 29 199999 30 1999...
output:
249998
result:
ok 1 number(s): "249998"
Extra Test:
score: 0
Extra Test Passed