QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#378223 | #4272. Phone Plans | C1942huangjiaxu | 0 | 256ms | 136264kb | C++14 | 2.9kb | 2024-04-06 09:52:36 | 2024-04-06 09:52:37 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=4e5+5,inf=2e9+7;
int n,A,B,Sz[N],sz[N],fa[N],Fa[N][19],tot,ans=inf;
int dfn[N],in[N],out[N],nw,Rt,ln[N];
int rt[N],ls[N*40],rs[N*40],ct[N*40],cnt;
vector<int>e[N],w[N];
ll K,sum,va[N];
struct edge{
int x,y,z;
bool operator <(const edge a)const{return z<a.z;}
}ea[N],eb[N];
int gf(int x){
return fa[x]==x?fa[x]:fa[x]=gf(fa[x]);
}
void dfs1(int x){
for(int i=1;i<19;++i)Fa[x][i]=Fa[Fa[x][i-1]][i-1];
if(x<=n){
in[x]=out[x]=dfn[x]=++dfn[0];
return;
}
in[x]=dfn[0];
for(auto v:e[x])dfs1(v);
out[x]=dfn[0];
}
void ins(int &k,int l,int r,int x){
k=++cnt,ct[k]=1;
if(l==r)return;
int mid=l+r>>1;
if(x<=mid)ins(ls[k],l,mid,x);
else ins(rs[k],mid+1,r,x);
}
int merge(int x,int y){
if(!x||!y)return x|y;
ls[x]=merge(ls[x],ls[y]);
rs[x]=merge(rs[x],rs[y]);
ct[x]=ct[x]+ct[y];
return x;
}
int query(int k,int l,int r,int x,int y){
if(!k)return 0;
if(x<=l&&r<=y)return ct[k];
int mid=l+r>>1,res=0;
if(x<=mid)res+=query(ls[k],l,mid,x,y);
if(y>mid)res+=query(rs[k],mid+1,r,x,y);
return res;
}
void chg(int x){
int c=gf(x),u=dfn[x];
for(int i=18;~i;--i)if(Fa[x][i]&&Fa[x][i]<=nw)x=Fa[x][i];
if(x<=n)return;
sum-=query(rt[c],1,n,in[x],out[x]);
if(out[e[x][0]]>=u)va[x]-=query(rt[c],1,n,in[e[x][1]],out[e[x][1]]);
else va[x]-=query(rt[c],1,n,in[e[x][0]],out[e[x][0]]);
}
void dfs2(int x,int y){
if(x<=n){
va[Rt]-=query(rt[gf(x)],1,n,in[e[Rt][y]],out[e[Rt][y]]);
return;
}
for(auto v:e[x])dfs2(v,y);
}
void calc(int x){
if(x<=n)return;
Rt=x;
if(Sz[e[x][0]]<Sz[e[x][1]])dfs2(e[x][0],1);
else dfs2(e[x][1],0);
}
int main(){
scanf("%d%d%d%lld",&n,&A,&B,&K);
tot=n;
for(int i=1;i<=A;++i)scanf("%d%d%d",&ea[i].x,&ea[i].y,&ea[i].z);
for(int i=1;i<=B;++i)scanf("%d%d%d",&eb[i].x,&eb[i].y,&eb[i].z);
for(int i=1;i<=n;++i)Sz[i]=1,fa[i]=i;
sort(ea+1,ea+A+1);
sort(eb+1,eb+B+1);
for(int i=1;i<=A;++i){
int x=gf(ea[i].x),y=gf(ea[i].y);
if(x==y)continue;
++tot,e[tot].push_back(x),e[tot].push_back(y);
Sz[tot]=Sz[x]+Sz[y];
ln[tot]=ea[i].z;
sum+=(va[tot]=1ll*Sz[x]*Sz[y]);
fa[x]=fa[y]=Fa[x][0]=Fa[y][0]=fa[tot]=tot;
}
for(int i=tot;i;--i)if(!Fa[i][0])dfs1(i);
for(int i=1;i<=n;++i)ins(rt[i],1,n,dfn[i]);
nw=tot;
while(nw>n&&sum-va[nw]>=K){
sum-=va[nw];
calc(e[nw][0]);
calc(e[nw][1]);
--nw;
}
if(sum>=K)ans=ln[nw];
for(int i=1;i<=n;++i)fa[i]=i,sz[i]=1,w[i].emplace_back(i);
for(int i=1;i<=B;++i){
int x=gf(eb[i].x),y=gf(eb[i].y);
if(x==y)continue;
if(sz[x]>sz[y])swap(x,y);
sum+=1ll*sz[x]*sz[y];
fa[x]=y,sz[y]+=sz[x];
for(auto v:w[x])chg(v),w[y].emplace_back(v);
rt[y]=merge(rt[y],rt[x]);
while(nw>n&&sum-va[nw]>=K){
sum-=va[nw];
calc(e[nw][0]);
calc(e[nw][1]);
--nw;
}
if(sum>=K)ans=min(ans,eb[i].z+ln[nw]);
}
if(ans==inf)puts("-1");
else printf("%d\n",ans);
return 0;
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 6
Accepted
time: 0ms
memory: 44868kb
input:
6 4 4 9 1 2 1 2 3 2 1 4 3 3 4 4 5 6 40 1 5 30 2 6 20 3 6 10
output:
33
result:
ok single line: '33'
Test #2:
score: 0
Accepted
time: 0ms
memory: 38784kb
input:
1 0 0 0
output:
0
result:
ok single line: '0'
Test #3:
score: 0
Accepted
time: 0ms
memory: 38404kb
input:
2 0 0 1
output:
-1
result:
ok single line: '-1'
Test #4:
score: 0
Accepted
time: 3ms
memory: 46888kb
input:
2 10 10 1 1 1 915886339 2 2 430624192 1 1 879808770 1 2 577221915 1 1 439429731 1 2 304911826 1 1 148009333 1 2 51122687 1 1 558282772 1 2 421196385 2 1 436692145 1 2 654020563 2 2 162573477 2 2 989531779 1 1 646687051 2 2 549037477 2 2 699532275 1 1 679375858 2 1 83352965 2 1 415698228
output:
51122687
result:
ok single line: '51122687'
Test #5:
score: 0
Accepted
time: 4ms
memory: 44844kb
input:
2 10 10 1 1 1 1000000000 1 2 1000000000 2 2 1000000000 2 1 1000000000 1 2 1000000000 1 1 1000000000 1 2 1000000000 2 2 1000000000 1 2 1000000000 1 2 1000000000 2 1 1000000000 1 2 1000000000 2 1 1000000000 2 2 1000000000 1 2 1000000000 2 2 1000000000 1 1 1000000000 1 1 1000000000 2 2 1000000000 1 2 1...
output:
1000000000
result:
ok single line: '1000000000'
Test #6:
score: 0
Accepted
time: 45ms
memory: 42900kb
input:
2000 0 200000 1199833 636 1231 120395621 689 1640 497332138 1861 1980 798839749 560 1283 560726905 1332 328 431171189 1203 1764 466367210 1102 347 317109768 1462 789 761470540 350 1093 551905741 1718 1047 548650524 51 546 56733461 58 1519 744207013 826 956 943929583 1969 207 238061756 99 47 99683567...
output:
9768257
result:
ok single line: '9768257'
Test #7:
score: 0
Accepted
time: 48ms
memory: 47008kb
input:
2000 200000 0 1937051 1325 1770 628367155 105 1670 728177982 358 778 959944062 826 1691 651665248 1119 1906 382208628 1684 1232 677646622 807 265 902880211 1685 1660 405567549 1853 1982 988679307 1241 1054 385406922 862 1049 356441384 1837 673 443580113 1082 1795 738355567 1703 663 221254144 1792 84...
output:
20263921
result:
ok single line: '20263921'
Test #8:
score: 0
Accepted
time: 84ms
memory: 53752kb
input:
2000 200000 200000 1999000 1303 1065 135024256 1400 1409 157921645 1208 515 422761224 466 1398 267944161 40 1202 560552418 722 1817 773826339 1022 1534 720452215 1512 200 145291518 538 230 98848391 434 529 911575234 470 1050 103133355 1800 351 180303134 1527 1871 779519820 258 1872 279904732 1 512 4...
output:
1999
result:
ok single line: '1999'
Test #9:
score: 0
Accepted
time: 92ms
memory: 51328kb
input:
2000 200000 200000 1999000 1566 1720 828051227 411 209 634755980 293 258 80524979 1149 1694 253684780 71 597 899974207 1934 440 11614281 1846 870 794303074 800 1090 576722282 1022 1619 486756658 1135 1004 589873220 1300 326 565865513 114 341 308227260 310 134 735603010 437 291 714079414 930 1131 136...
output:
1999
result:
ok single line: '1999'
Test #10:
score: 0
Accepted
time: 84ms
memory: 50168kb
input:
2000 200000 200000 1999000 1505 1008 194848918 955 1466 251380587 306 119 329528655 1072 1067 684468438 1798 755 822161204 1475 1987 886864916 609 790 525637795 1937 1639 534864650 63 792 948290690 1282 553 998185081 1995 243 367638087 1517 982 238895274 1891 358 612397768 229 1599 453255817 200 115...
output:
1999
result:
ok single line: '1999'
Test #11:
score: 0
Accepted
time: 82ms
memory: 50220kb
input:
2000 200000 200000 1999000 888 998 519088944 896 217 366603047 963 1703 281897731 1419 1583 296352197 318 1644 449932680 1252 683 299241251 1763 1736 16908823 400 673 940814267 1864 1654 16539370 21 1360 526031095 320 1052 879613936 383 555 433309121 243 869 603865861 567 236 829646077 1057 1138 545...
output:
2000
result:
ok single line: '2000'
Test #12:
score: 0
Accepted
time: 0ms
memory: 40908kb
input:
2000 0 0 0
output:
0
result:
ok single line: '0'
Test #13:
score: 0
Accepted
time: 4ms
memory: 42564kb
input:
2000 0 0 1
output:
-1
result:
ok single line: '-1'
Test #14:
score: 0
Accepted
time: 0ms
memory: 38600kb
input:
2000 0 0 1999000
output:
-1
result:
ok single line: '-1'
Test #15:
score: 0
Accepted
time: 81ms
memory: 52596kb
input:
2000 200000 200000 0 584 721 144517612 1593 1184 19655376 572 91 267489352 441 830 206284803 326 901 399207297 1220 164 270714861 1760 1765 242123575 1341 1187 778391819 247 104 618482901 1650 876 469853007 1338 660 237312298 593 1856 254405769 477 1212 387844191 603 1896 336160240 1397 444 77343103...
output:
0
result:
ok single line: '0'
Test #16:
score: 0
Accepted
time: 86ms
memory: 52496kb
input:
2000 200000 200000 1 1961 656 558726882 677 479 191436128 1411 291 100142168 932 1506 28223846 1264 1394 780504516 1276 1479 56569386 1363 65 480245792 1598 78 760054359 78 36 593906829 1112 535 999996793 1792 953 155333434 149 239 901391869 791 1800 803139774 1856 629 626568419 1931 779 330675974 8...
output:
2823
result:
ok single line: '2823'
Test #17:
score: 0
Accepted
time: 84ms
memory: 51980kb
input:
2000 200000 200000 4 1165 1872 797718594 1169 1055 624587802 866 899 658187098 1376 1679 853872729 635 1186 401602136 1058 241 170579264 1988 1953 539060919 1695 772 816154776 1551 1453 798051114 1678 810 856500252 637 1519 373040351 1663 1237 499974912 1222 174 950339946 952 1956 666630512 1053 17 ...
output:
13422
result:
ok single line: '13422'
Test #18:
score: 0
Accepted
time: 86ms
memory: 53868kb
input:
2000 200000 200000 51 825 28 972433150 472 1380 981558124 178 1129 462887818 496 1916 874585551 1806 1093 459363528 853 1063 835229701 1473 1816 509538236 1762 139 445678501 600 826 116492230 1924 1426 768569961 1093 802 138198370 1285 101 612512942 1696 527 863059072 1729 1091 238488099 1799 1725 9...
output:
207785
result:
ok single line: '207785'
Test #19:
score: 0
Accepted
time: 85ms
memory: 53732kb
input:
2000 200000 200000 346 479 1073 12925746 1739 528 708374552 1669 1597 187841053 420 1886 665883774 264 1753 39508213 1618 1695 153537785 734 950 163927318 946 639 332538805 1151 821 988862824 981 1265 633217016 1627 199 830812032 116 579 44204899 511 403 764449881 1828 538 469036862 953 1145 6928974...
output:
1325200
result:
ok single line: '1325200'
Test #20:
score: 0
Accepted
time: 90ms
memory: 53744kb
input:
2000 200000 200000 7700 1618 867 271795108 1951 151 702948614 463 231 446592273 882 479 999691562 1160 1496 458774157 862 177 365391789 1483 1529 152692222 1086 1926 981642023 650 1846 36577190 1541 1521 287755177 1549 145 326097587 1355 1965 846861888 968 1069 919410456 557 6 666217744 499 1453 429...
output:
4833174
result:
ok single line: '4833174'
Test #21:
score: 0
Accepted
time: 88ms
memory: 56036kb
input:
2000 200000 200000 10274 427 1831 50634939 924 761 973624360 1716 77 896823723 1770 286 368244715 281 1652 693233017 782 982 856834549 1990 872 586803005 1104 545 550493462 438 75 19630828 1939 95 811185364 1691 325 517180701 1832 1560 781228281 687 1611 15723447 651 73 423147727 1750 768 923943157 ...
output:
4715135
result:
ok single line: '4715135'
Test #22:
score: 0
Accepted
time: 86ms
memory: 50164kb
input:
2000 200000 200000 353724 828 1686 612966370 1332 36 325102273 50 1233 839762664 1389 740 256158152 640 18 76640380 1324 508 966364428 1791 314 236880043 1092 1586 81535148 602 1178 352534909 640 1224 733613612 970 297 526950089 1654 1677 277859934 1583 1933 511147393 56 1854 778804499 1051 17 52473...
output:
6546895
result:
ok single line: '6546895'
Test #23:
score: 0
Accepted
time: 82ms
memory: 52716kb
input:
2000 200000 200000 1999000 1499 1526 627651931 378 1689 609556194 1326 237 371224081 98 527 251964139 1280 1750 293612965 905 1848 881495354 1870 900 902279678 1496 267 634703468 59 800 164035702 109 1934 882309468 1966 702 519776748 1020 666 951531959 385 850 241053535 1211 255 903671592 66 1285 65...
output:
34222040
result:
ok single line: '34222040'
Test #24:
score: 0
Accepted
time: 90ms
memory: 55956kb
input:
2000 200000 200000 0 1820 354 521259580 1799 1723 883151663 1892 479 590713896 748 499 454440477 1752 334 983007379 56 69 157027005 554 112 225804047 1680 600 279675368 36 1372 868160579 1988 1586 523730820 35 1704 39797544 117 1627 846004390 354 1056 280474791 1736 1676 249305541 1269 111 692287711...
output:
0
result:
ok single line: '0'
Test #25:
score: 0
Accepted
time: 82ms
memory: 53444kb
input:
2000 200000 200000 1 1787 1732 413014305 1909 217 339214620 519 1338 435678958 883 831 44937921 1912 970 736120426 1190 1219 718941669 1216 1909 109658172 1849 1869 686616094 301 965 677802187 445 724 195098678 1306 1951 299168831 1970 262 204353384 1220 1409 504375659 1713 623 754436498 1452 1620 5...
output:
2
result:
ok single line: '2'
Test #26:
score: 0
Accepted
time: 81ms
memory: 53860kb
input:
2000 200000 200000 4 402 1914 269682654 675 1436 291439604 193 370 988082031 1849 1502 691456540 883 665 492038489 28 1266 573600132 1656 352 680334585 1668 1039 911608739 157 1752 964298632 979 19 526980 1113 504 262870788 126 541 220684410 269 1031 721802318 1900 1999 328920840 1770 641 692254361 ...
output:
37
result:
ok single line: '37'
Test #27:
score: 0
Accepted
time: 85ms
memory: 53660kb
input:
2000 200000 200000 26 526 1621 483988447 1703 1932 686404766 1111 1245 624032004 1457 1671 886702864 409 957 385143382 1928 1503 977317507 1319 349 983715228 401 30 251459110 245 1355 563161269 459 1436 965861604 679 949 983070365 1692 1261 456157217 698 99 409820975 1528 1362 963977301 1295 1852 79...
output:
25
result:
ok single line: '25'
Test #28:
score: 0
Accepted
time: 82ms
memory: 53880kb
input:
2000 200000 200000 625 728 133 344090289 1062 1880 597135161 844 1495 874100306 1930 389 490213163 1783 724 571192863 1499 1894 866097805 325 687 79859122 1674 1747 563976487 1940 60 855240336 1516 1087 431861062 1314 1217 250576340 646 311 63874546 647 1552 870943884 1535 1190 223697 345 1186 65344...
output:
39
result:
ok single line: '39'
Test #29:
score: 0
Accepted
time: 86ms
memory: 52728kb
input:
2000 200000 200000 4700 1725 821 429457120 1764 490 903325799 660 1294 347283520 325 16 253789876 464 1258 168173237 80 660 57504741 1136 1316 769617858 1767 1394 287008686 1824 1206 820352296 114 330 965781020 140 223 885989447 1458 742 932496684 762 1574 655017664 1598 596 723299463 1213 1898 5236...
output:
84
result:
ok single line: '84'
Test #30:
score: 0
Accepted
time: 89ms
memory: 50352kb
input:
2000 200000 200000 88061 668 1817 402362288 1250 696 637044070 1793 1147 890609254 1839 671 427058014 1636 51 777111988 567 359 308999615 1552 1510 40834395 1566 1311 738132782 271 1975 807983143 998 82 633239353 1096 843 454384442 102 1427 218117173 329 227 915637054 685 1727 911188324 1330 1175 94...
output:
652572
result:
ok single line: '652572'
Test #31:
score: 0
Accepted
time: 78ms
memory: 51344kb
input:
2000 200000 200000 533113 1338 1754 782883635 1349 1488 592703188 1645 1448 477986692 733 1042 47 981 1720 461041447 263 452 26372078 1812 765 384744847 205 372 507702235 12 1369 191909928 288 1600 812952698 1238 762 715972252 912 1876 653427552 974 1617 941376898 43 1554 514299614 220 1772 58179883...
output:
1962115
result:
ok single line: '1962115'
Test #32:
score: 0
Accepted
time: 82ms
memory: 52552kb
input:
2000 200000 200000 1999000 713 984 491810215 23 1495 711013830 1680 304 483176300 121 1907 948073782 176 89 573161170 1928 609 583837234 736 990 511532333 1734 1850 807407784 821 1402 566288558 1818 835 317847108 1824 126 439452972 1585 467 46541223 775 1709 549038510 1487 205 239467439 1096 1794 38...
output:
31758367
result:
ok single line: '31758367'
Test #33:
score: 0
Accepted
time: 70ms
memory: 50716kb
input:
995 199991 199994 128256 177 82 677669502 416 854 677166289 543 794 364534270 680 242 8 760 186 900225249 875 563 337492994 732 766 894982532 114 483 4 259 885 8 954 157 590392390 308 566 1 37 871 633804510 606 410 916672224 125 450 6 190 582 536149589 453 3 4 116 891 3 585 875 495228925 191 718 6 4...
output:
-1
result:
ok single line: '-1'
Test #34:
score: -6
Wrong Answer
time: 69ms
memory: 50004kb
input:
996 199992 199993 124753 205 430 710291462 748 756 293873327 59 894 536099901 632 890 9 452 316 3 652 215 10 273 487 8 469 308 301806104 620 183 4 401 401 946696222 305 647 1 925 765 518528395 980 190 3 289 597 815252846 509 691 262814273 279 155 3 708 808 4 878 326 296665089 993 513 3 883 903 1 317...
output:
4086188
result:
wrong answer 1st lines differ - expected: '4319483', found: '4086188'
Subtask #2:
score: 0
Wrong Answer
Test #53:
score: 5
Accepted
time: 188ms
memory: 121832kb
input:
200000 100000 100000 7628995 23677 113459 839167193 165893 15365 669621527 26287 109671 214795757 156871 136723 522277985 9957 100463 806718116 104783 161385 156110975 184577 92225 545172629 57373 130083 980035338 167231 49597 919886451 115601 24325 717233004 99413 141311 737488449 83437 62759 76873...
output:
502149991
result:
ok single line: '502149991'
Test #54:
score: 0
Accepted
time: 115ms
memory: 129060kb
input:
200000 200000 87 2694 197233 86229 181875035 85167 196363 328068482 177795 65479 693403443 119609 181977 588691030 115815 139981 486110961 92473 20483 199129328 166989 95385 210368646 98095 54673 357307451 122543 94377 907487846 46611 80735 71787832 158893 117071 521262491 92051 104395 365725125 142...
output:
11965880
result:
ok single line: '11965880'
Test #55:
score: 0
Accepted
time: 123ms
memory: 114292kb
input:
200000 103 199999 1593 75203 150269 64 68675 175215 100 176335 11837 94 33623 63279 56 16617 86741 63 167219 52783 58 6575 134399 1 144065 114171 2 32625 99459 50 35311 152509 36 132975 12211 8 175275 107903 23 17477 21319 95 157759 66683 71 34577 78339 26 154003 26703 18 187863 90945 74 116071 1089...
output:
7037526
result:
ok single line: '7037526'
Test #56:
score: 0
Accepted
time: 0ms
memory: 34600kb
input:
1 0 0 0
output:
0
result:
ok single line: '0'
Test #57:
score: 0
Accepted
time: 0ms
memory: 38632kb
input:
1 1 0 0 1 1 1
output:
0
result:
ok single line: '0'
Test #58:
score: 0
Accepted
time: 2ms
memory: 40708kb
input:
2 0 0 1
output:
-1
result:
ok single line: '-1'
Test #59:
score: 0
Accepted
time: 77ms
memory: 49128kb
input:
2 200000 200000 1 1 1 540311820 1 1 825820034 1 1 555157427 1 1 288420080 1 1 672135630 1 1 726777321 1 1 526670467 1 1 959728057 1 1 146842949 1 1 122695951 1 1 432194433 1 1 381185144 1 1 686598677 1 1 215624542 1 1 458312135 1 1 986262083 1 1 947920916 1 1 934427659 1 1 782364899 1 1 715992893 1 ...
output:
-1
result:
ok single line: '-1'
Test #60:
score: 0
Accepted
time: 57ms
memory: 46740kb
input:
2 200000 200000 1 1 1 1000000000 1 1 1000000000 1 1 1000000000 1 1 1000000000 1 1 1000000000 1 1 1000000000 1 1 1000000000 1 1 1000000000 1 1 1000000000 1 1 1000000000 1 1 1000000000 1 1 1000000000 1 1 1000000000 1 1 1000000000 1 1 1000000000 1 1 1000000000 1 1 1000000000 1 1 1000000000 1 1 10000000...
output:
-1
result:
ok single line: '-1'
Test #61:
score: 0
Accepted
time: 132ms
memory: 113148kb
input:
200000 0 200000 352487 135712 118584 670867088 72546 31680 1279343 123412 184392 678367510 125022 192330 57001931 134050 61434 212353526 6066 95972 717546833 47726 9232 949490922 166856 33998 986508808 166254 92344 143252836 82392 100980 919436840 84316 12292 753153826 192154 134452 832321404 144418...
output:
216679869
result:
ok single line: '216679869'
Test #62:
score: 0
Accepted
time: 95ms
memory: 125296kb
input:
200000 200000 0 1089706 197033 84309 947754387 112807 60173 477333202 102607 132751 957665006 143619 102001 642146230 32419 155751 770317403 53835 4703 414754921 9463 17929 312775978 172373 41459 29632969 48451 142975 596586913 36019 180115 791609008 145487 162325 699635731 177243 94157 221311090 18...
output:
245598855
result:
ok single line: '245598855'
Test #63:
score: 0
Accepted
time: 198ms
memory: 132720kb
input:
200000 200000 200000 19999900000 86215 110793 27420223 115281 150421 94498 135039 177319 663933319 36159 42207 779673045 183713 40779 749203477 19775 65311 4733 107303 126899 734749608 156297 176907 75566437 125743 186407 98466 140359 177109 654885923 71583 37783 772116721 159971 195153 554369442 98...
output:
-1
result:
ok single line: '-1'
Test #64:
score: 0
Accepted
time: 177ms
memory: 133824kb
input:
200000 200000 200000 19999900000 85515 12697 64028 96111 81277 723665166 2725 17313 680441413 93491 175625 540828929 67585 1395 36003 67231 61263 36674 38071 156361 828146734 28859 160423 12411 145939 126471 712935428 94263 91967 539663194 63247 197497 523841579 78633 56647 13319 167061 116147 69378...
output:
-1
result:
ok single line: '-1'
Test #65:
score: 0
Accepted
time: 179ms
memory: 134456kb
input:
200000 200000 200000 19999900000 148005 59733 752041265 123653 133439 52211 145097 100735 849514916 81383 172715 82449 73561 151351 5461 89063 14693 344507089 21037 114603 83348 58421 27517 990178176 92093 52843 44132 47187 108097 654752253 125675 121519 379610893 180175 114853 432259513 101563 1539...
output:
-1
result:
ok single line: '-1'
Test #66:
score: 0
Accepted
time: 176ms
memory: 131340kb
input:
200000 200000 200000 19999900000 84373 49303 809503019 121957 178579 27747 17401 130691 81723 167037 65841 156510963 150147 91835 955602352 38921 199303 799434899 148503 143389 545115194 167915 178111 32040 157739 135137 406444987 151557 114653 959815310 183647 73983 60436 22453 173189 907941124 942...
output:
-1
result:
ok single line: '-1'
Test #67:
score: 0
Accepted
time: 24ms
memory: 105192kb
input:
200000 0 0 0
output:
0
result:
ok single line: '0'
Test #68:
score: 0
Accepted
time: 24ms
memory: 107272kb
input:
200000 0 0 1
output:
-1
result:
ok single line: '-1'
Test #69:
score: 0
Accepted
time: 12ms
memory: 104376kb
input:
200000 0 0 19999900000
output:
-1
result:
ok single line: '-1'
Test #70:
score: 0
Accepted
time: 203ms
memory: 136264kb
input:
200000 200000 200000 0 87819 103509 211262 70831 128635 830521513 113429 141129 784161896 129435 11587 889301002 44001 115103 595627949 47949 142581 707781370 131047 3629 922790958 23679 66389 332015888 129675 123163 971290575 179611 66043 669206978 97337 71783 492187074 7571 2423 622850189 38605 78...
output:
0
result:
ok single line: '0'
Test #71:
score: 0
Accepted
time: 225ms
memory: 130492kb
input:
200000 200000 200000 1 156245 167853 177174928 188863 72787 774437619 4585 19395 257360617 128879 170657 682214518 161355 176611 304747786 43047 106383 127598967 24279 82135 957118009 196215 59199 751930028 170851 67831 778264730 137919 197693 331012429 11523 16765 713111895 97017 106453 758909521 1...
output:
2038
result:
ok single line: '2038'
Test #72:
score: 0
Accepted
time: 219ms
memory: 127096kb
input:
200000 200000 200000 7 57525 173001 851535810 90143 40469 390254518 47345 90621 810622886 30795 49971 298834588 189903 46443 134186592 137675 28429 339466374 69059 184047 584089294 147913 80315 8146656 179297 104151 362297351 70649 53131 388526766 107483 143767 505780466 148763 182199 408802373 1033...
output:
15612
result:
ok single line: '15612'
Test #73:
score: 0
Accepted
time: 241ms
memory: 129932kb
input:
200000 200000 200000 46 111931 134159 889741544 149639 128081 372249571 23933 64913 441243094 110657 34439 947713738 181857 11825 495039256 180791 95409 524765235 163423 157431 391773005 97399 19671 904565768 187819 122831 911398340 57913 31101 694661062 101755 67855 888773520 130677 22999 216816765...
output:
171465
result:
ok single line: '171465'
Test #74:
score: 0
Accepted
time: 256ms
memory: 134188kb
input:
200000 200000 200000 644 117565 176843 664885033 56817 162365 734743320 54117 113661 518155584 42661 109889 910590800 184271 71485 832406650 134697 122943 821929672 165513 26247 148140143 8219 181481 86904456 123701 150771 215687547 162763 49093 804995017 68581 130605 871496281 129291 12421 81737374...
output:
3160928
result:
ok single line: '3160928'
Test #75:
score: -5
Wrong Answer
time: 218ms
memory: 129964kb
input:
200000 200000 200000 9470 171111 2867 135877098 129249 152799 427879861 44787 147563 166499191 4049 96289 733086628 121413 161723 119790707 53823 26279 736094176 53209 21459 928020229 51875 164485 617069767 34989 162955 337423730 108607 67767 141743345 117349 49929 922096240 134763 159225 820844700 ...
output:
39296589
result:
wrong answer 1st lines differ - expected: '39338620', found: '39296589'
Subtask #3:
score: 0
Wrong Answer
Test #103:
score: 6
Accepted
time: 4ms
memory: 38784kb
input:
1 0 0 0
output:
0
result:
ok single line: '0'
Test #104:
score: 0
Accepted
time: 0ms
memory: 40700kb
input:
2 0 0 1
output:
-1
result:
ok single line: '-1'
Test #105:
score: 0
Accepted
time: 41ms
memory: 51352kb
input:
2 10 200000 1 2 1 319832429 1 1 412617159 2 1 337734185 1 2 674652880 1 2 454610992 2 2 688717944 1 1 189208056 2 2 951221780 1 2 594191431 2 2 87592160 1 2 833491749 2 2 732961971 2 1 575969648 2 2 268359887 2 1 436382098 1 2 514959278 1 2 305446083 1 2 365989813 1 2 296840111 1 1 541558213 1 1 497...
output:
10104
result:
ok single line: '10104'
Test #106:
score: 0
Accepted
time: 26ms
memory: 48188kb
input:
2 10 200000 1 1 1 1000000000 1 1 1000000000 1 2 1000000000 1 2 1000000000 1 2 1000000000 1 1 1000000000 2 1 1000000000 2 2 1000000000 2 2 1000000000 2 2 1000000000 1 1 1000000000 1 2 1000000000 1 1 1000000000 2 1 1000000000 1 1 1000000000 1 1 1000000000 2 1 1000000000 1 1 1000000000 2 2 1000000000 2...
output:
1000000000
result:
ok single line: '1000000000'
Test #107:
score: 0
Accepted
time: 185ms
memory: 115600kb
input:
200000 10 200000 17900 199675 76237 290240030 50211 6922 761990536 92097 120746 607490 192856 130409 616541101 50427 80049 330957286 129588 180294 466199684 8674 110653 155297749 91380 156344 798960399 102127 40858 801752583 94673 105892 152356242 185676 6183 263664373 169026 112948 812501808 93517 ...
output:
75425485
result:
ok single line: '75425485'
Test #108:
score: 0
Accepted
time: 191ms
memory: 115628kb
input:
200000 10 200000 11791021341 90115 14234 985783971 123477 154651 628493605 123171 47179 220847663 8072 163826 30383173 174753 12792 15862638 172837 96919 880800330 92696 166466 443031361 85298 185851 999558577 23737 111350 809362300 24551 127050 920973896 121483 145215 67814677 78536 41919 475800490...
output:
949367959
result:
ok single line: '949367959'
Test #109:
score: 0
Accepted
time: 208ms
memory: 112944kb
input:
200000 0 200000 423432 117280 87297 405090778 161764 93979 279208002 169095 190396 237565477 5136 81072 251360373 177384 130645 595157997 5282 38206 898866303 150431 96891 829055730 18413 42187 599085995 75585 47004 557307885 92187 77157 349172549 63029 186638 993483250 37685 198246 538754012 119056...
output:
404806867
result:
ok single line: '404806867'
Test #110:
score: 0
Accepted
time: 15ms
memory: 108540kb
input:
200000 10 0 1583868 66186 49114 583417488 79347 122356 957296935 4161 178945 973881307 39875 85386 62804962 62164 81798 964069340 6410 188411 31431750 67426 6153 513781110 49101 116783 513947988 61043 89483 259723608 14116 90504 23294861
output:
-1
result:
ok single line: '-1'
Test #111:
score: 0
Accepted
time: 193ms
memory: 113468kb
input:
200000 10 200000 19999900000 47625 147346 8 147346 121067 9 97009 179826 2 155552 97009 1 179826 22149 3 15370 4310 5 135552 47625 7 121067 131030 10 4310 135552 6 22149 15370 4 92707 136627 90227 20274 369 174990 32793 164281 194588 56508 95231 92612 117675 125225 114617 42843 81551 39780 149173 15...
output:
199999
result:
ok single line: '199999'
Test #112:
score: 0
Accepted
time: 195ms
memory: 114988kb
input:
200000 10 200000 19999900000 45665 143462 7 22696 184210 2 38538 57388 9 184210 154285 3 125307 22696 1 149825 71332 5 143462 38538 8 154285 149825 4 57388 182077 10 71332 45665 6 163095 156887 174710 77920 77020 63954 85503 109613 119638 46319 118285 60934 66569 45264 83574 73519 101885 163357 1583...
output:
200000
result:
ok single line: '200000'
Test #113:
score: 0
Accepted
time: 192ms
memory: 115856kb
input:
200000 10 200000 19999900000 739 28876 199992 53663 1295 199998 43161 52504 200000 158247 739 199993 2816 184328 199996 52504 53663 199999 1295 2816 199997 52726 158247 199994 28876 8395 199991 184328 52726 199995 130045 124454 95456 117404 39359 188185 42676 84681 4828 105147 95150 194669 17107 579...
output:
199999
result:
ok single line: '199999'
Test #114:
score: 0
Accepted
time: 186ms
memory: 113360kb
input:
200000 10 200000 19999900000 19794 183474 199991 71973 145759 199999 167290 188987 199995 6730 167290 199996 92616 6730 199997 93098 157369 199993 145759 92616 199998 104691 71973 200000 157369 19794 199992 188987 93098 199994 4529 33398 169717 116172 158258 118532 69720 25407 140713 173220 192301 1...
output:
200000
result:
ok single line: '200000'
Test #115:
score: 0
Accepted
time: 23ms
memory: 105352kb
input:
200000 0 0 0
output:
0
result:
ok single line: '0'
Test #116:
score: 0
Accepted
time: 12ms
memory: 105104kb
input:
200000 0 0 1
output:
-1
result:
ok single line: '-1'
Test #117:
score: 0
Accepted
time: 23ms
memory: 105336kb
input:
200000 0 0 19999900000
output:
-1
result:
ok single line: '-1'
Test #118:
score: 0
Accepted
time: 191ms
memory: 117936kb
input:
200000 10 200000 0 146668 190255 646706475 71516 174249 65976309 173393 55930 434227341 38682 164404 792088710 68045 174249 105770742 190255 24008 378601596 68045 174249 584120597 68045 68045 891140070 71516 71516 121444300 24008 173393 638520585 42552 123134 440551564 172416 148702 205154389 80345 ...
output:
0
result:
ok single line: '0'
Test #119:
score: 0
Accepted
time: 191ms
memory: 120264kb
input:
200000 10 200000 1 18089 125148 634373061 26320 138377 746998187 125148 130407 287480602 136290 4926 478063834 136333 147458 29423436 26320 147458 334115471 4926 136290 505364255 18089 26320 866606210 11249 77957 605205962 136333 11249 440411926 170380 191070 819377443 150060 41355 635345633 143709 ...
output:
2407
result:
ok single line: '2407'
Test #120:
score: 0
Accepted
time: 194ms
memory: 114492kb
input:
200000 10 200000 4 131932 102405 14740950 95390 60349 599957231 62719 96049 468132040 96049 196778 435897371 147221 147221 710991146 69099 139866 753644389 130732 22961 374767514 118319 62719 793210617 14592 172623 872022637 131932 147221 588107750 133618 115753 634870732 69458 144612 651075961 8687...
output:
14977
result:
ok single line: '14977'
Test #121:
score: 0
Accepted
time: 181ms
memory: 116692kb
input:
200000 10 200000 92 26204 41682 132397613 11386 43267 432400482 26204 145442 188527020 124727 65248 170978952 26613 172005 567702196 146166 39798 679712885 146166 39798 953781917 124727 41682 826584416 146166 146166 117167249 65248 11386 787325743 764 17622 571020090 171608 112618 89050875 21593 172...
output:
473019
result:
ok single line: '473019'
Test #122:
score: -6
Wrong Answer
time: 182ms
memory: 119796kb
input:
200000 10 200000 672 151843 72188 754208507 186567 155545 192251945 72188 173580 807040666 173580 155545 413157526 143249 143249 343025568 143249 182692 983484260 182692 21150 153868493 173580 155545 648383151 151843 182692 108954433 156381 14221 612434692 8027 76055 276048757 29885 107311 354554984...
output:
3498802
result:
wrong answer 1st lines differ - expected: '3501158', found: '3498802'
Subtask #4:
score: 0
Skipped
Dependency #1:
0%