QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#66019 | #2372. Level Up | gyh20# | AC ✓ | 389ms | 5568kb | C++14 | 1.2kb | 2022-12-05 20:44:34 | 2022-12-05 20:44:37 |
Judging History
answer
#include<bits/stdc++.h>
#define re register
using namespace std;
inline int read(){
re int t=0;re char v=getchar();
while(v<'0')v=getchar();
while(v>='0')t=(t<<3)+(t<<1)+v-48,v=getchar();
return t;
}
const int M=998244353;
inline void add(re int &x,re int y){(x+=y)>=M?x-=M:x;}
inline int Mod(re int x){return x>=M?x-M:x;}
inline int ksm(re int x,re int y){
re int s=1;
while(y){
if(y&1)s=1ll*s*x%M;
x=1ll*x*x%M,y>>=1;
}
return s;
}
int n,A[502],B[502],C[502],D[502];
long long f[502][502];
int main(){
memset(f,0x3f,sizeof(f));
n=read();int x=read(),y=read();f[x][y]=0;
for(re int i=1;i<=n;++i)A[i]=read(),B[i]=read(),C[i]=read(),D[i]=read();
for(re int i=1;i<=n;++i)
for(re int j=i+1;j<=n;++j)
if(A[i]>A[j])
swap(A[i],A[j]),swap(B[i],B[j]),swap(C[i],C[j]),swap(D[i],D[j]);
for(re int i=1;i<=n;++i){
int a=A[i],b=B[i],c=C[i],d=D[i];
for(re int j=0;j<=500;++j)
for(re int k=0;k<=500;++k){
re int o=min(j,a),o1=min(a-o,k);
if(j)f[j-o][k-o1]=min(f[j-o][k-o1],f[j][k]+b);
f[j][max(0,k-c)]=min(f[j][max(0,k-c)],f[j][k]+d);
}
}
if(f[0][0]<=1e14)printf("%lld",f[0][0]);
else puts("-1");
}
详细
Test #1:
score: 100
Accepted
time: 2ms
memory: 5432kb
input:
2 100 100 100 100 10 10 101 11 100 10
output:
110
result:
ok single line: '110'
Test #2:
score: 0
Accepted
time: 6ms
memory: 5352kb
input:
4 20 20 40 1000 20 20 6 6 5 5 10 10 1 1 10 10 1 1
output:
40
result:
ok single line: '40'
Test #3:
score: 0
Accepted
time: 4ms
memory: 5244kb
input:
2 20 5 10 10 5 5 10 10 5 5
output:
-1
result:
ok single line: '-1'
Test #4:
score: 0
Accepted
time: 7ms
memory: 5452kb
input:
5 10 10 7 6 4 2 4 4 2 2 2 4 1 1 4 4 2 2 9 9 6 7
output:
18
result:
ok single line: '18'
Test #5:
score: 0
Accepted
time: 37ms
memory: 5564kb
input:
50 500 500 31 8085460 27 5738750 35 6396250 28 3088390 104 11849007 54 8299872 16 3941084 11 1308473 2 12078306 1 8983355 3 8771257 2 6535023 6 2314939 4 398722 23 3498723 20 1276781 28 33264266 22 23291943 56 1421421 39 250597 23 365902 18 126347 18 15795320 14 11247902 23 3967562 20 1366149 2 7872...
output:
503438008
result:
ok single line: '503438008'
Test #6:
score: 0
Accepted
time: 33ms
memory: 5232kb
input:
50 500 500 73 27992737 69 18966262 21 2870967 16 1499764 30 2712586 24 807302 30 1571151 26 113014 12 17479242 7 12548202 2 2286652 1 533975 13 14175983 8 10573252 21 7374424 15 5296944 57 29367840 47 19760798 10 13627280 6 8169670 4 4188791 3 3571616 20 8484804 15 5875175 27 6620836 24 4831810 19 2...
output:
-1
result:
ok single line: '-1'
Test #7:
score: 0
Accepted
time: 40ms
memory: 5436kb
input:
50 500 500 125 5775299 58 3365838 19 20966097 16 16455254 3 8175325 2 3774116 14 1810284 7 666925 32 12841964 27 6052477 26 19519657 19 11326243 29 15179842 20 10880328 14 9371765 9 3920657 12 14875979 7 9101766 35 6433974 31 3421907 32 20076916 28 14119683 58 27381454 40 21965293 66 1093309 50 2519...
output:
456861222
result:
ok single line: '456861222'
Test #8:
score: 0
Accepted
time: 36ms
memory: 5260kb
input:
50 500 500 4 36070724 2 23405844 17 4428195 14 2509383 107 623983 71 235420 2 5124303 1 3066811 13 13762619 9 8576532 41 3042402 30 1922350 12 2970591 8 1351117 13 27079049 9 14142125 47 6460779 31 3717668 18 4804043 16 3011099 13 21721708 10 14115483 15 4381799 12 2234054 12 20857786 6 13749784 31 ...
output:
-1
result:
ok single line: '-1'
Test #9:
score: 0
Accepted
time: 37ms
memory: 5168kb
input:
50 500 500 29 8157077 22 6834969 22 10779152 17 8089449 13 12475353 7 9499995 24 4947542 18 3113575 15 28966516 10 26860818 15 3669592 10 2410844 19 1581966 13 873580 34 3624484 23 2301817 20 5857684 13 3802891 79 12260290 55 8690963 2 20506072 1 14313138 10 16693870 6 12525361 4 12304285 2 9009008 ...
output:
-1
result:
ok single line: '-1'
Test #10:
score: 0
Accepted
time: 35ms
memory: 5284kb
input:
50 500 500 10 13125176 5 10950314 22 391307 17 93349 6 11134314 3 9901997 86 2506509 47 583620 31 33492575 22 19188248 5 9294450 2 6624413 13 9191218 9 5952305 18 20417049 14 16990734 7 8518768 5 5443659 58 9065094 40 5731479 33 4079849 28 2835309 23 4136272 19 2881115 73 8521363 45 5677299 20 14685...
output:
-1
result:
ok single line: '-1'
Test #11:
score: 0
Accepted
time: 38ms
memory: 5312kb
input:
50 500 500 21 907501 14 152402 21 14305876 14 11319714 5 4374773 2 1339359 25 1355048 15 309013 16 20124832 9 15085593 4 1726659 1 655876 7 4402003 4 1580209 2 17836457 1 12859512 20 11236784 12 5994527 23 2094453 14 876274 45 32687503 35 29267853 8 8112090 5 3450612 38 18277158 23 13599862 18 60293...
output:
-1
result:
ok single line: '-1'
Test #12:
score: 0
Accepted
time: 37ms
memory: 5452kb
input:
50 500 500 19 1499348 14 196621 12 3969429 8 2549579 28 798411 22 105398 7 5651536 3 4170863 10 38283434 4 27203407 19 5289417 16 3417738 7 14538102 3 10440044 2 20594635 1 15008095 8 16371992 3 10441843 4 10027177 1 8937809 11 2295112 5 1573470 53 10390911 32 9123967 16 25222050 13 18444862 23 1729...
output:
318359714
result:
ok single line: '318359714'
Test #13:
score: 0
Accepted
time: 40ms
memory: 5236kb
input:
50 500 500 2 3362597 1 2168621 35 20168051 27 17376136 10 16598106 6 11929765 16 11388655 12 6868031 76 7701803 59 6027465 28 567320 25 294717 74 12467614 58 7507871 6 5007251 3 3080130 7 4966620 5 2603575 12 1386066 8 408567 16 2972847 11 1714914 5 18231072 3 16510180 11 3788307 7 2299737 3 2648170...
output:
-1
result:
ok single line: '-1'
Test #14:
score: 0
Accepted
time: 40ms
memory: 5308kb
input:
50 500 500 16 6264153 11 2984836 35 16777358 28 10022976 5 37796454 1 33072910 42 10768782 32 5866512 10 812368 7 431190 2 6040610 1 2939003 6 26612609 3 15754779 2 1156421 1 435311 8 2671955 5 1212704 17 15304152 12 9176524 5 12470655 1 6147177 8 10186327 4 5192235 8 11059255 4 6055397 48 20100901 ...
output:
520015627
result:
ok single line: '520015627'
Test #15:
score: 0
Accepted
time: 41ms
memory: 5308kb
input:
50 500 500 10 9413879 8 5501501 13 3912729 10 1417628 2 1982439 1 245571 12 24595777 9 18692510 13 10393773 10 6867489 22 6054271 19 3265011 6 14227986 3 8808848 71 2142731 44 361903 20 2860631 18 726021 4 16424654 2 11605645 3 10556242 1 6900513 6 29193071 3 28945801 13 23250932 10 16263176 16 7832...
output:
435555747
result:
ok single line: '435555747'
Test #16:
score: 0
Accepted
time: 37ms
memory: 5224kb
input:
50 500 500 46 10918174 31 7372996 18 18305374 14 16154287 26 5739668 19 3150261 15 494426 10 117061 12 12738066 9 8460939 24 6749831 19 4011436 50 3432002 32 1796147 12 14648889 6 10833901 53 1228224 41 262349 12 2140143 9 812104 5 13662034 1 8845980 4 2516825 1 1193933 11 25852350 6 18027500 6 2627...
output:
-1
result:
ok single line: '-1'
Test #17:
score: 0
Accepted
time: 42ms
memory: 5228kb
input:
50 500 500 20 852738 16 493348 6 7797720 4 4134521 5 3036793 2 2729209 2 22391392 1 16604275 10 29632556 6 29114025 13 1903016 8 977329 41 16636084 32 8790233 43 7431099 33 3966608 14 9164487 9 4709317 18 6611892 14 3418255 12 494817 7 111888 12 8315189 7 4344041 5 9928577 2 5539864 58 29429649 46 2...
output:
-1
result:
ok single line: '-1'
Test #18:
score: 0
Accepted
time: 37ms
memory: 5236kb
input:
50 500 500 4 15394595 2 11049103 45 2578167 26 2490929 13 4256573 10 2827892 7 8104984 4 5408724 7 11559073 5 9196123 38 10796987 25 8365109 56 4272831 44 2999754 18 10925875 13 9076442 28 3133566 19 2538894 3 9855494 1 8320230 3 13701004 2 10874128 27 6400126 18 4772736 9 72640729 6 25016470 27 129...
output:
-1
result:
ok single line: '-1'
Test #19:
score: 0
Accepted
time: 40ms
memory: 5184kb
input:
50 500 500 9 11156728 3 10200152 31 3700086 19 1728387 20 4956240 12 2588371 40 25211830 30 16302875 9 7057581 3 6374690 20 9651666 11 8147459 2 12956327 1 11497531 23 1408624 15 753775 21 841818 13 178982 74 7496528 36 6663969 14 10821323 6 9420814 5 7871991 2 6843404 13 9200149 6 7995332 5 8955250...
output:
-1
result:
ok single line: '-1'
Test #20:
score: 0
Accepted
time: 36ms
memory: 5228kb
input:
50 500 500 15 35460260 11 23559770 3 6562103 1 3158072 37 2246396 36 1642120 35 3975283 30 2664946 4 945071 2 682822 45 29540435 41 18254889 23 12895802 19 7947316 30 21126179 27 13161736 10 39875154 8 24156077 19 274161 15 67071 18 26335732 14 16274688 14 7389631 11 4013767 2 2963257 1 1788857 6 16...
output:
-1
result:
ok single line: '-1'
Test #21:
score: 0
Accepted
time: 40ms
memory: 5312kb
input:
50 500 500 18 34707066 10 22938205 9 3859907 5 1821190 29 1933037 22 506322 55 23185822 34 18716422 4 4446453 2 2251943 22 15178147 13 13365908 7 19350276 3 14856573 43 5680442 28 4771319 23 7966583 17 6017266 24 55249398 18 27074988 5 2376218 2 543247 6 60905679 2 30531604 10 5607923 6 3695543 59 1...
output:
-1
result:
ok single line: '-1'
Test #22:
score: 0
Accepted
time: 40ms
memory: 5256kb
input:
50 500 500 10 5150004 6 4080540 15 3313450 8 2457669 43 12432365 20 11147052 46 16371598 21 13440805 60 439494 30 245918 23 11026107 15 9006799 10 7523081 7 6155797 16 35719897 10 23296892 24 3692164 15 3217098 2 261477 1 100179 52 44796989 25 25396381 4 697550 2 429616 16 16872888 9 14330131 34 314...
output:
-1
result:
ok single line: '-1'
Test #23:
score: 0
Accepted
time: 33ms
memory: 5288kb
input:
50 500 500 13 13103325 9 12745634 11 11131301 7 8748665 17 239670 13 142670 6 17204020 4 16581004 13 16106661 9 15060327 16 1921825 11 844614 3 7613349 1 4567381 3 4367432 1 3263828 14 9254392 10 6326679 6 5610495 3 4039051 47 39711369 40 26888682 13 7597397 7 4191206 22 1510240 14 809453 27 1502243...
output:
-1
result:
ok single line: '-1'
Test #24:
score: 0
Accepted
time: 40ms
memory: 5316kb
input:
50 500 500 7 1267715 2 607673 70 37902005 49 24839523 32 9048394 21 4720019 20 11155439 12 6079314 2 1215752 1 375063 18 12550849 10 6387457 21 370744 13 354633 17 30100342 10 16917766 42 8588769 27 3722491 16 14702461 10 7472845 14 14982867 9 10550596 8 13874255 3 7426697 34 9286404 24 5145074 12 1...
output:
-1
result:
ok single line: '-1'
Test #25:
score: 0
Accepted
time: 79ms
memory: 5420kb
input:
100 500 500 17 4025653 14 3778748 3 2347585 2 1834794 4 7191460 3 5352528 2 6908858 1 5298394 28 1079233 21 623155 19 31673701 16 22951289 32 17578133 25 13628677 13 87233 11 35426 24 2910370 20 2679983 4 20019809 3 15014128 20 22857611 17 18551451 12 10526981 11 7939156 11 841401 10 610367 8 424019...
output:
417225396
result:
ok single line: '417225396'
Test #26:
score: 0
Accepted
time: 77ms
memory: 5140kb
input:
100 500 500 4 6502776 2 4393554 8 1773518 5 1154179 6 6269515 4 4085004 6 7695490 4 5221101 9 1348699 6 744422 7 3594654 4 2160426 2 4235782 1 2715791 16 4653612 14 2776618 32 940653 21 293123 2 11399912 1 7175699 6 19253270 4 14831211 4 276613 2 24530 4 815361 2 286668 4 641021 3 155541 2 6066578 1...
output:
-1
result:
ok single line: '-1'
Test #27:
score: 0
Accepted
time: 81ms
memory: 5408kb
input:
100 500 500 20 6859707 17 5048758 7 2608538 4 2166679 9 5844601 6 4384349 5 9369485 3 7392399 26 9880316 24 8094186 8 8063680 5 5892250 4 1831561 1 1382628 8 842665 6 672625 15 8668466 13 6294895 22 16596043 19 11178259 5 2197151 2 1666390 7 492251 4 406026 3 3973507 1 2728251 5 2182653 2 1665666 13...
output:
393507190
result:
ok single line: '393507190'
Test #28:
score: 0
Accepted
time: 73ms
memory: 5168kb
input:
100 500 500 12 8788320 9 5552901 32 6811823 17 4462380 14 641375 10 194652 2 2785894 1 1722815 11 13261233 8 9854116 13 1200374 10 699378 7 453115 4 82853 11 1238921 8 742265 3 963693 1 489943 6 4537210 3 3671974 12 645276 9 229035 3 8506494 1 5300847 7 10508247 4 5991433 9 2926585 6 2276475 7 34388...
output:
-1
result:
ok single line: '-1'
Test #29:
score: 0
Accepted
time: 79ms
memory: 5248kb
input:
100 500 500 3 9751541 2 9474100 8 848977 6 242142 31 12528316 21 10271902 10 941507 8 356150 30 2199740 21 1231616 21 24328767 14 16570548 2 2045411 1 1223320 15 1094284 10 663942 8 12539893 6 10691532 6 12040006 4 10194789 17 4737854 11 3562949 12 20105801 8 14377410 4 3477463 2 2684568 11 1123271 ...
output:
-1
result:
ok single line: '-1'
Test #30:
score: 0
Accepted
time: 74ms
memory: 5256kb
input:
100 500 500 2 1426113 1 1251926 6 8887746 3 6355308 5 735201 3 603140 6 7816767 4 6193945 7 3959775 4 2982667 23 150150 17 124358 23 13006846 17 11970417 2 935596 1 781047 14 1341114 8 1178303 12 4680929 6 3363414 8 11887753 5 9419946 2 2444781 1 2235911 12 2449111 6 2280879 8 344105 5 229980 41 667...
output:
-1
result:
ok single line: '-1'
Test #31:
score: 0
Accepted
time: 79ms
memory: 5412kb
input:
100 500 500 18 4819880 14 4150670 7 3674644 5 2941236 8 1290921 6 802364 20 1343543 15 944308 2 1881663 1 1394268 22 3545834 15 2279188 6 433950 4 289245 13 2580910 9 1613831 7 256885 5 128477 4 15804189 1 12672966 4 3558823 2 2551167 3 8665570 1 8034357 10 5000104 7 4608286 6 3138570 4 1916593 16 1...
output:
490947140
result:
ok single line: '490947140'
Test #32:
score: 0
Accepted
time: 78ms
memory: 5404kb
input:
100 500 500 69 722960 35 104854 2 4403080 1 3512869 18 3619344 15 3294841 4 700847 2 91696 7 2373693 5 1916903 7 1483354 5 695554 12 1735723 9 1129594 5 5325488 2 4684988 5 244943 3 57261 6 8560081 5 5898567 6 39329 4 25677 4 748219 2 122969 2 2458018 1 1976881 3 3409402 2 3107514 6 2821702 4 263300...
output:
419950900
result:
ok single line: '419950900'
Test #33:
score: 0
Accepted
time: 78ms
memory: 5180kb
input:
100 500 500 4 2040402 3 1602858 8 1366092 6 955864 24 7751798 15 6065618 9 2420396 7 1873375 3 8383763 1 7015851 14 7585345 9 6029169 32 5305608 24 4312729 3 4047906 2 3693078 8 5697535 6 4721448 16 700210 10 444813 6 4093264 4 3963061 16 1995286 10 1586596 7 7056733 5 5337984 10 1007096 7 662108 8 ...
output:
-1
result:
ok single line: '-1'
Test #34:
score: 0
Accepted
time: 78ms
memory: 5220kb
input:
100 500 500 4 13068481 3 10791740 2 6450522 1 6305675 5 460213 3 172888 5 1444504 3 686755 2 4401579 1 3086491 8 871847 6 353428 22 93479 16 28972 5 19860327 3 15549884 19 2891592 13 2164815 4 3770460 2 2771949 6 5605128 4 4944902 18 637245 12 277377 6 5996627 5 5690701 2 10477711 1 10170212 7 49083...
output:
-1
result:
ok single line: '-1'
Test #35:
score: 0
Accepted
time: 74ms
memory: 5304kb
input:
100 500 500 17 4816704 14 3651825 7 1570659 4 717462 6 3476049 4 2142927 5 5817689 3 5480000 6 11230581 4 10515692 2 1387841 1 662065 11 4293848 7 3368206 3 6138747 1 5615540 4 1190262 3 477956 21 5763449 17 5401400 18 7744559 14 6455942 7 1051946 4 426510 3 401049 1 123586 9 6030192 6 5578106 8 129...
output:
427822779
result:
ok single line: '427822779'
Test #36:
score: 0
Accepted
time: 74ms
memory: 5252kb
input:
100 500 500 3 2190486 1 1822949 18 1956698 13 1506091 29 4536586 17 3677010 27 4431931 17 3656664 12 1479563 10 1206298 7 216755 4 145105 14 1513703 11 1349464 13 601824 10 264807 2 7411849 1 6341105 21 2299009 15 1893796 3 1359800 1 972324 8 9137821 7 7867502 4 4212876 2 3231978 3 7258956 1 6040759...
output:
-1
result:
ok single line: '-1'
Test #37:
score: 0
Accepted
time: 75ms
memory: 5472kb
input:
100 500 500 5 189807 4 75020 2 4396811 1 2970951 9 3028182 7 1873025 10 6589800 8 3875699 4 4489932 2 3075566 5 2022828 3 1036532 2 22035541 1 20755286 18 1931417 13 1014220 5 1025048 3 539836 6 3637161 4 2316611 6 965666 4 351901 3 4095026 2 2528737 10 6065952 8 3618389 11 9797021 9 6658682 6 28671...
output:
465148015
result:
ok single line: '465148015'
Test #38:
score: 0
Accepted
time: 79ms
memory: 5452kb
input:
100 500 500 4 1092030 3 747100 17 15856994 11 14193046 14 1260716 9 864950 3 1758611 2 1596937 23 7567357 17 5532368 16 4191908 10 3595514 22 2256789 14 2176741 4 10532293 3 7167435 23 6081012 16 4974077 8 13804625 6 11896516 22 10784423 15 8192231 19 384915 11 94984 16 443360 10 169682 3 130759 2 1...
output:
488134876
result:
ok single line: '488134876'
Test #39:
score: 0
Accepted
time: 74ms
memory: 5180kb
input:
100 500 500 3 1822837 1 1487050 5 258731 4 79327 23 20338809 20 11424763 5 2804843 4 2347895 6 7469135 5 5411698 6 3030915 4 2413768 9 17491178 7 10997933 3 905184 2 466271 15 22178939 11 13408132 25 5068684 22 3846616 11 6795949 8 4681756 16 3276626 12 2510629 4 6055621 2 4638505 5 53247 4 1223 2 1...
output:
-1
result:
ok single line: '-1'
Test #40:
score: 0
Accepted
time: 73ms
memory: 5368kb
input:
100 500 500 49 13237826 43 10401559 6 16084721 3 11621611 9 1324271 5 1145140 8 540959 4 294713 3 2155798 2 1566598 23 24147403 18 19140872 15 9488745 12 7718009 8 11556763 4 9624476 23 2986971 18 2029055 8 6124663 3 4564775 27 17010536 21 13946271 55 2503786 43 1669634 4 2217028 2 1598177 9 818832 ...
output:
386568160
result:
ok single line: '386568160'
Test #41:
score: 0
Accepted
time: 78ms
memory: 5568kb
input:
100 500 500 13 3361688 11 3041782 28 379725 19 113626 3 9512087 1 9260726 20 3125994 15 2730636 18 902936 15 545761 21 384129 16 152717 6 5736579 4 4462024 4 2121796 3 1582766 9 123706 7 102333 6 10311001 4 10177661 4 739736 2 439639 6 1442264 4 1041797 4 4217335 3 3578039 11 9280428 9 7876987 2 157...
output:
452159796
result:
ok single line: '452159796'
Test #42:
score: 0
Accepted
time: 77ms
memory: 5468kb
input:
100 500 500 5 8012117 2 5820281 15 5296119 13 3261474 6 5494410 3 3397619 9 2141716 4 1431769 7 4110447 4 2501811 4 991600 2 780315 3 8541707 1 7183958 10 236106 6 168357 36 2922422 29 1739054 19 3797085 15 2417315 25 10015909 20 8427120 9 653855 5 361403 7 881890 3 549510 29 8347919 24 6874434 20 8...
output:
410976961
result:
ok single line: '410976961'
Test #43:
score: 0
Accepted
time: 74ms
memory: 5420kb
input:
100 500 500 6 24631051 5 20928374 6 13731353 5 11603443 14 1320427 10 443840 4 8431395 2 5065061 5 289233 4 126275 9 5991577 7 4077994 5 4179675 4 2496909 17 2621350 12 960552 7 4755363 5 3246425 4 2592942 3 878679 5 4952077 3 3424159 23 4386321 18 2714533 6 12761533 5 8440901 2 2386669 1 862090 4 1...
output:
468196585
result:
ok single line: '468196585'
Test #44:
score: 0
Accepted
time: 73ms
memory: 5504kb
input:
100 500 500 18 10627379 14 10261244 2 1085599 1 485999 21 553288 14 81216 7 3952921 4 3032851 8 9965553 5 8725553 13 3304324 11 2362911 21 1936518 14 1130952 7 6434138 4 4911692 10 5854186 8 4120386 14 1032251 11 350272 10 2785620 8 2006208 3 5145689 1 3914267 33 17599461 22 17291728 8 2485934 5 174...
output:
453421474
result:
ok single line: '453421474'
Test #45:
score: 0
Accepted
time: 221ms
memory: 5244kb
input:
300 500 500 2 573234 1 429938 3 2680198 2 2127136 4 4478973 3 3840539 4 1419427 3 1088585 3 2083238 1 1595749 2 1650803 1 1289481 2 1056203 1 825108 5 2982202 4 2543352 3 1779789 2 1424209 5 2356005 3 1802115 10 490770 8 330301 2 3363787 1 3023408 4 1602038 3 1271350 6 3329904 5 3021763 5 1230818 3 ...
output:
-1
result:
ok single line: '-1'
Test #46:
score: 0
Accepted
time: 226ms
memory: 5248kb
input:
300 500 500 3 9212969 2 8124788 3 1073516 2 928863 8 2133540 6 1751011 2 1992822 1 1641344 4 1237885 3 1086098 11 1368218 8 1184864 2 4175337 1 3954184 8 1631527 7 1360129 2 68960 1 36292 2 1998360 1 1650018 11 93393 8 73022 12 537967 9 367770 2 4616597 1 4188496 2 6792379 1 4988363 4 12207334 3 906...
output:
-1
result:
ok single line: '-1'
Test #47:
score: 0
Accepted
time: 230ms
memory: 5216kb
input:
300 500 500 2 1184014 1 1041204 4 2334846 3 1980545 2 1576937 1 1407272 3 2168417 2 1859494 2 3811643 1 3144199 5 6256861 3 4560578 3 1310000 1 1194777 3 4661692 2 3312582 9 1044740 8 901199 4 684952 2 548001 3 609183 2 423702 2 2553772 1 2134589 5 1393062 4 1298142 4 1534326 2 1381837 5 2017076 3 1...
output:
-1
result:
ok single line: '-1'
Test #48:
score: 0
Accepted
time: 221ms
memory: 5496kb
input:
300 500 500 2 3350569 1 2893473 3 53866 2 31849 3 2224820 2 1829607 2 1446675 1 1202107 3 2814554 2 2377175 2 175444 1 98350 2 1789032 1 1484726 2 2318823 1 2079375 4 39098 3 18041 4 1970115 3 1741912 7 792053 6 546247 3 4916027 2 4012030 4 4010372 3 3204395 2 436229 1 327205 3 6372209 2 5595622 2 2...
output:
471273948
result:
ok single line: '471273948'
Test #49:
score: 0
Accepted
time: 221ms
memory: 5352kb
input:
300 500 500 2 2993341 1 2492403 5 476861 3 429139 8 4675409 6 3507045 5 1003975 4 829083 5 1230879 3 1042247 2 1201096 1 998633 4 248433 2 212761 4 1215456 3 1024136 3 2148114 1 1752894 2 1716539 1 1412423 4 3062014 2 2527384 2 863699 1 755641 2 607049 1 515842 2 5353500 1 3949879 2 632955 1 542137 ...
output:
502909382
result:
ok single line: '502909382'
Test #50:
score: 0
Accepted
time: 238ms
memory: 5304kb
input:
300 500 500 4 4900671 2 3646000 3 1481887 2 1264627 3 1333088 2 1073871 2 6412065 1 5511042 5 928439 4 695105 3 944821 2 699795 6 3339892 4 2380664 3 140233 2 77766 6 47637 4 20820 3 196166 2 175610 2 1155833 1 864347 11 962487 8 714329 2 4313908 1 3161793 2 570312 1 497716 8 285828 6 229022 2 80668...
output:
477252224
result:
ok single line: '477252224'
Test #51:
score: 0
Accepted
time: 228ms
memory: 5312kb
input:
300 500 500 4 350935 3 343198 2 276456 1 229803 2 2342466 1 2118367 2 28231 1 11922 6 465807 4 435583 6 631783 4 547659 8 604282 6 493573 4 523831 3 458846 3 1495438 2 1409036 2 1787430 1 1575923 5 2244422 3 1962802 2 305940 1 238652 5 631462 3 543038 2 237806 1 219939 2 4162852 1 3611202 7 6327038 ...
output:
-1
result:
ok single line: '-1'
Test #52:
score: 0
Accepted
time: 222ms
memory: 5432kb
input:
300 500 500 4 2054896 2 1805154 4 1847195 3 1641938 3 120653 2 89705 2 1093685 1 815270 2 528287 1 372282 3 912782 2 667899 3 4028501 2 3924504 2 35822 1 23047 3 796170 1 601327 6 41378 4 37754 3 6015938 2 5069913 3 9887605 2 6562524 5 3214631 3 3033904 10 1533296 8 1337180 3 6533233 2 5332622 2 136...
output:
487247864
result:
ok single line: '487247864'
Test #53:
score: 0
Accepted
time: 223ms
memory: 5236kb
input:
300 500 500 2 325266 1 253596 3 1391657 2 1219981 2 69894 1 46288 2 2709627 1 2505154 3 1899226 1 1816743 3 1511218 1 1313525 8 1176749 6 1056355 2 2518187 1 2278616 5 786698 3 659124 2 932218 1 744786 3 1755138 2 1698548 4 1331029 3 1181455 2 839469 1 692223 2 1089668 1 905393 2 2236285 1 2017834 2...
output:
-1
result:
ok single line: '-1'
Test #54:
score: 0
Accepted
time: 227ms
memory: 5508kb
input:
300 500 500 3 1890766 2 1469507 5 192446 3 126073 2 309021 1 225342 2 8017892 1 5368958 3 1175935 1 916719 4 2203000 3 1949941 5 543496 3 401897 3 690620 2 531538 2 581264 1 430290 3 2530947 2 2417414 3 5252442 1 3960789 4 911168 2 689814 6 2056240 4 1615081 9 357303 7 261245 4 4270903 2 3568187 4 3...
output:
406875484
result:
ok single line: '406875484'
Test #55:
score: 0
Accepted
time: 226ms
memory: 5420kb
input:
300 500 500 4 115425 3 64952 5 64257 4 37203 3 114625 2 54429 2 277811 1 169207 2 1630845 1 1385302 3 2053609 2 1973284 5 6127747 4 5004234 4 5123836 3 4501863 8 2956287 6 2509540 6 735096 4 584456 7 2317418 5 2114654 13 952952 9 847967 4 1016792 3 902094 2 3206583 1 2751881 5 3199954 3 2676118 5 61...
output:
470204774
result:
ok single line: '470204774'
Test #56:
score: 0
Accepted
time: 229ms
memory: 5472kb
input:
300 500 500 2 2176540 1 1832243 3 1286044 2 1077591 5 2962617 4 2598961 3 4793021 1 3968651 2 2030720 1 1655962 3 1435706 2 1136083 6 3566284 4 3100578 2 602352 1 458999 3 1046744 2 856323 2 1016445 1 747323 2 3794156 1 3171601 9 1855827 7 1501896 3 960708 1 712284 7 1276790 5 1043454 4 919395 3 675...
output:
485148304
result:
ok single line: '485148304'
Test #57:
score: 0
Accepted
time: 225ms
memory: 5500kb
input:
300 500 500 2 2384942 1 1892686 2 1064026 1 839716 2 7568086 1 6745707 6 826872 5 622888 2 1587073 1 1193851 5 364050 3 268208 3 1590451 2 1206565 3 266798 2 209678 6 2481616 4 1974085 13 3525205 11 3030090 4 2375591 3 1890511 2 3019646 1 2406857 2 887712 1 677960 3 339432 2 240898 3 3891012 2 34097...
output:
447065665
result:
ok single line: '447065665'
Test #58:
score: 0
Accepted
time: 222ms
memory: 5368kb
input:
300 500 500 3 1361947 1 1152086 3 506268 2 447748 4 145381 2 98742 2 217910 1 150916 4 601097 3 543962 2 1715438 1 1497784 6 1976938 5 1752150 3 1254976 1 1010795 12 375450 11 344826 4 6159776 3 5351653 2 173806 1 111690 4 3423753 3 2965702 8 1381201 6 1179420 2 2131482 1 1871305 4 3445319 3 2966903...
output:
428119607
result:
ok single line: '428119607'
Test #59:
score: 0
Accepted
time: 227ms
memory: 5496kb
input:
300 500 500 2 484664 1 364598 2 3665316 1 3245351 2 3700350 1 3402141 5 1140026 3 896763 7 3396189 5 2500156 5 1188125 3 948900 3 1309308 2 1094416 2 928012 1 787248 3 3405645 1 2513913 4 2069432 2 1710621 2 883094 1 718249 5 3356417 3 2411878 3 2407834 2 1958010 5 734643 3 650635 3 172877 2 112557 ...
output:
415932668
result:
ok single line: '415932668'
Test #60:
score: 0
Accepted
time: 226ms
memory: 5500kb
input:
300 500 500 7 189823 4 134076 2 442169 1 405779 3 116878 2 76806 7 3958247 4 3360035 2 989817 1 823673 2 240158 1 178579 4 392196 2 339165 2 1246504 1 1032835 4 169224 3 112996 4 375360 2 312697 4 1506178 2 1265199 3 483491 2 418771 2 2146941 1 2024216 5 3637812 3 3037183 3 2821869 2 2231578 2 13223...
output:
450026900
result:
ok single line: '450026900'
Test #61:
score: 0
Accepted
time: 389ms
memory: 5400kb
input:
500 500 500 2 1287930 1 1177579 3 1021900 2 951198 2 584264 1 536127 2 56702 1 14665 2 538980 1 462527 2 1773295 1 1633097 2 282661 1 208648 4 788163 3 727040 3 830513 2 771199 2 2099390 1 1934772 3 1534432 2 1381630 5 40576 3 9643 2 18143 1 3293 3 238871 2 178218 3 199469 2 137477 2 1328514 1 12229...
output:
476103045
result:
ok single line: '476103045'
Test #62:
score: 0
Accepted
time: 374ms
memory: 5564kb
input:
500 500 500 2 96346 1 54899 2 1550873 1 1447117 2 62939 1 40400 2 136397 1 81469 4 233931 3 162566 2 2894922 1 2563560 2 28412 1 15904 2 402144 1 322291 2 539785 1 462519 6 905432 4 750951 4 1580493 3 1485068 2 625595 1 515118 2 516152 1 443575 4 1454992 3 1313317 2 64558 1 41820 3 179466 2 119174 2...
output:
478935410
result:
ok single line: '478935410'
Test #63:
score: 0
Accepted
time: 374ms
memory: 5508kb
input:
500 500 500 3 4719493 2 3961484 3 536864 1 435285 2 4558145 1 3806268 3 66414 2 46640 2 72384 1 60123 3 2507849 2 2183164 5 2435998 3 2050486 2 1092734 1 959138 2 601653 1 471523 2 240334 1 204787 2 25858 1 5657 2 1361307 1 1214700 2 841573 1 751495 2 1333319 1 1187695 3 651054 2 565074 3 754325 2 6...
output:
479590303
result:
ok single line: '479590303'
Test #64:
score: 0
Accepted
time: 389ms
memory: 5216kb
input:
500 500 500 2 1807129 1 1716596 2 273115 1 247330 2 1103539 1 1014344 2 2104360 1 1913257 2 1934760 1 1762265 2 71322 1 59829 4 255143 3 226822 3 249108 2 200622 4 129221 3 109621 4 127326 3 106939 3 1352042 1 1240706 4 42252 3 33713 2 1362966 1 1245842 2 51764 1 46107 3 2229695 2 2009879 2 1017633 ...
output:
-1
result:
ok single line: '-1'
Test #65:
score: 0
Accepted
time: 373ms
memory: 5568kb
input:
500 500 500 2 771521 1 700425 2 418331 1 326003 3 1403315 2 1287022 2 929311 1 818657 2 3434649 1 2726649 3 239588 1 191727 2 798183 1 717802 2 666108 1 571038 3 773803 2 705121 4 1510558 3 1356701 3 2924674 2 2383414 4 700180 2 631736 4 177200 3 129330 2 2398069 1 2141543 2 172990 1 121711 2 228350...
output:
453118404
result:
ok single line: '453118404'
Test #66:
score: 0
Accepted
time: 373ms
memory: 5236kb
input:
500 500 500 3 918589 2 806854 2 578702 1 514922 3 500268 2 439859 2 91688 1 75653 4 1410575 2 1209437 5 4419242 3 3591510 3 1437808 2 1285655 2 1477530 1 1313768 3 863908 2 800678 2 816856 1 763804 3 434810 2 365817 2 1950401 1 1867043 2 3761175 1 3315226 2 141636 1 126667 2 91901 1 75753 3 2048756 ...
output:
-1
result:
ok single line: '-1'
Test #67:
score: 0
Accepted
time: 370ms
memory: 5172kb
input:
500 500 500 3 113115 2 79552 2 116451 1 85396 2 138044 1 100384 2 171545 1 134441 4 661989 3 540709 4 1547763 2 1446323 6 924538 4 792659 3 230889 2 186509 2 2248450 1 2029006 4 2352033 3 2189204 2 412370 1 341004 2 1301650 1 1169597 2 423298 1 355561 2 1527987 1 1350584 2 325481 1 285016 2 2384115 ...
output:
-1
result:
ok single line: '-1'
Test #68:
score: 0
Accepted
time: 370ms
memory: 5468kb
input:
500 500 500 2 507178 1 440969 2 1695893 1 1451050 3 711208 2 610363 6 39723 4 22675 2 63378 1 37063 2 521259 1 454331 4 3908597 2 3302002 4 627524 3 532928 3 1608771 2 1315686 2 21286 1 3702 2 1274938 1 1038003 10 2070937 7 1696009 2 1256920 1 1029615 2 571120 1 507919 5 174600 3 157753 2 271065 1 2...
output:
446587210
result:
ok single line: '446587210'
Test #69:
score: 0
Accepted
time: 382ms
memory: 5216kb
input:
500 500 500 2 55944 1 32630 2 590369 1 515088 3 3123641 2 2807282 2 1036902 1 935473 2 772601 1 704051 3 4728819 2 3989261 3 889246 2 785817 2 4616446 1 3957211 2 436771 1 358954 4 599149 2 516141 6 1610174 4 1546629 2 2353833 1 2156792 2 1817912 1 1626393 2 224724 1 171789 4 2234651 2 2046629 2 579...
output:
-1
result:
ok single line: '-1'
Test #70:
score: 0
Accepted
time: 374ms
memory: 5564kb
input:
500 500 500 6 2632351 4 2551676 4 1313552 3 1126428 2 15751 1 15216 3 94312 2 50337 2 2104093 1 1970790 2 1953471 1 1751178 2 585619 1 530359 2 1171655 1 989372 2 1283713 1 1085284 2 1222925 1 1043250 2 3171167 1 3078374 4 859903 3 741255 2 1142519 1 939648 2 29288 1 22492 2 282901 1 244632 2 190962...
output:
445757319
result:
ok single line: '445757319'
Test #71:
score: 0
Accepted
time: 373ms
memory: 5400kb
input:
500 500 500 2 3309147 1 2896584 2 782267 1 616624 2 504157 1 416914 2 221573 1 164880 2 1406261 1 1079513 2 2401834 1 2190149 3 1296155 2 1062821 2 135927 1 94812 2 3764910 1 3360430 2 604608 1 482966 2 1883001 1 1635263 2 2880916 1 2410317 2 270792 1 240549 4 1488352 3 1123184 2 202713 1 143952 3 1...
output:
434804368
result:
ok single line: '434804368'
Test #72:
score: 0
Accepted
time: 374ms
memory: 5564kb
input:
500 500 500 3 1775815 2 1424568 2 2419667 1 2088229 2 203128 1 130228 2 468711 1 368627 2 535753 1 485338 2 1025657 1 971881 4 2000771 2 1730035 2 1224829 1 1138377 2 292632 1 169411 2 925233 1 888389 2 1602546 1 1343036 2 338660 1 206498 2 565120 1 508437 2 197211 1 123280 2 354160 1 232091 3 28927...
output:
436451716
result:
ok single line: '436451716'
Test #73:
score: 0
Accepted
time: 368ms
memory: 5420kb
input:
500 500 500 2 1363161 1 1254282 2 1707155 1 1575347 2 774613 1 700023 2 185759 1 151162 3 3067008 2 2652137 2 196066 1 162465 3 762579 2 694013 2 340074 1 271395 2 51307 1 21593 3 173420 2 142003 2 138189 1 120449 2 1213537 1 1093558 3 3162433 2 2967506 10 923194 8 800382 2 1909027 1 1793521 2 29806...
output:
192601712
result:
ok single line: '192601712'
Test #74:
score: 0
Accepted
time: 370ms
memory: 5396kb
input:
500 500 500 2 119652 1 106291 2 412505 1 369688 5 4170102 3 3575632 2 413640 1 370536 2 1532874 1 1388219 4 617015 2 574973 3 3134753 1 3037980 2 316579 1 282247 3 449491 2 399809 4 1108031 2 1030221 2 688594 1 622052 4 629075 3 583508 5 1482795 3 1337673 3 114199 1 96689 2 471853 1 435994 2 211234 ...
output:
206517715
result:
ok single line: '206517715'
Test #75:
score: 0
Accepted
time: 4ms
memory: 5420kb
input:
1 10 10 100 100 50 50
output:
100
result:
ok single line: '100'
Test #76:
score: 0
Accepted
time: 367ms
memory: 5476kb
input:
500 500 500 3 1634375 2 1384348 3 1231887 2 1062209 7 662996 5 614759 6 1338663 5 1118955 2 1444725 1 1245942 2 1216316 1 1056075 2 6244 1 2214 2 864390 1 788061 6 615446 5 513792 2 2190473 1 1949087 5 341170 4 266211 2 174569 1 139490 5 565777 4 463003 2 2457543 1 2156958 2 3520021 1 2949323 5 1848...
output:
195596643
result:
ok single line: '195596643'
Test #77:
score: 0
Accepted
time: 362ms
memory: 5408kb
input:
500 500 500 2 99239 1 85440 2 85536 1 75777 3 501482 2 421690 8 1522017 7 1230907 3 1896490 2 1698143 3 60253 2 57615 3 698768 1 556957 2 2427044 1 2269868 2 297262 1 270792 5 2598949 4 2450373 3 468815 2 414501 2 289643 1 256633 3 441164 2 396561 4 279067 2 227511 2 2954210 1 2748396 2 234218 1 179...
output:
194230873
result:
ok single line: '194230873'
Test #78:
score: 0
Accepted
time: 371ms
memory: 5472kb
input:
500 500 500 3 442411 2 406914 4 395921 3 352954 3 929955 1 820188 2 327056 1 276074 2 1141936 1 1034691 6 479 4 430 2 231135 1 144097 2 1062401 1 948095 2 179283 1 114817 2 805998 1 738966 2 649600 1 572603 2 1026003 1 914189 6 1471083 5 1340212 3 617766 2 561966 2 713383 1 667571 2 410759 1 372920 ...
output:
186726780
result:
ok single line: '186726780'
Test #79:
score: 0
Accepted
time: 368ms
memory: 5420kb
input:
500 500 500 2 1840306 1 1707810 2 925871 1 849640 2 158370 1 123749 2 102828 1 80599 4 2935538 3 2505931 2 2479943 1 2126330 2 918160 1 836478 2 890982 1 814706 9 261382 8 232768 3 251850 2 227011 5 846204 4 783671 2 2965937 1 2553845 3 2976714 1 2555642 2 106971 1 85157 2 1911226 1 1776288 2 127468...
output:
182956669
result:
ok single line: '182956669'
Test #80:
score: 0
Accepted
time: 370ms
memory: 5372kb
input:
500 500 500 5 513968 4 433070 3 1199676 1 1015229 4 2212001 2 2028138 3 1162307 1 952020 4 1135670 2 914471 2 2804436 1 2675409 4 688924 3 612613 3 4048784 2 3881883 2 2986914 1 2842248 2 3512486 1 3122335 3 412056 2 356793 2 936890 1 796144 5 472268 4 418026 3 1941385 2 1864292 2 494663 1 424406 3 ...
output:
189870038
result:
ok single line: '189870038'
Test #81:
score: 0
Accepted
time: 372ms
memory: 5472kb
input:
500 500 500 2 1570646 1 1388666 2 2527500 1 2210616 2 940578 1 768875 2 356247 1 295879 4 424104 2 332249 3 200933 2 160909 5 729304 3 633455 2 1158187 1 1050340 2 31257 1 15074 3 307261 2 243415 6 671560 5 538274 2 1745209 1 1598684 6 1672955 4 1534276 2 1750523 1 1625061 2 750318 1 645279 3 284735...
output:
197570849
result:
ok single line: '197570849'
Test #82:
score: 0
Accepted
time: 371ms
memory: 5312kb
input:
500 500 500 6 1554925 4 1374759 3 1343963 2 1169104 3 503560 2 462423 5 1816856 4 1523883 6 2213472 4 1870075 2 419235 1 396767 3 29541 2 23737 2 1379890 1 1205333 4 2379045 2 2125390 7 12774 6 8012 2 296982 1 280961 6 977821 5 918114 4 756204 3 722288 3 225100 2 190771 2 1953758 1 1570133 5 956915 ...
output:
175907872
result:
ok single line: '175907872'
Test #83:
score: 0
Accepted
time: 363ms
memory: 5424kb
input:
500 500 500 4 200830 3 152182 2 3588719 1 2845133 2 1891888 1 1664211 6 7739502 4 5273617 10 320203 7 248559 8 360986 5 276450 2 3686263 1 2961798 2 3860309 1 2976747 6 93175 4 50243 2 655157 1 592082 5 182164 3 128406 4 703110 2 666265 2 332102 1 252695 2 622399 1 546255 5 305254 3 229054 4 242057 ...
output:
183670157
result:
ok single line: '183670157'
Test #84:
score: 0
Accepted
time: 373ms
memory: 5408kb
input:
500 500 500 4 2909341 2 2387153 4 1230545 2 1167163 2 711735 1 655622 3 145425 2 118571 6 233141 5 186288 2 737410 1 694928 4 592267 3 544359 4 504778 3 478121 2 746502 1 699933 3 1706778 2 1667375 2 482003 1 451237 3 915428 2 851643 3 670301 2 632201 2 459074 1 434235 5 1485049 3 1434153 3 609887 2...
output:
184486067
result:
ok single line: '184486067'
Test #85:
score: 0
Accepted
time: 369ms
memory: 5420kb
input:
500 500 500 2 101897 1 67399 3 282936 1 263007 2 184972 1 180256 3 275330 2 253200 6 67022 4 39742 4 79144 3 49747 2 1834473 1 1619304 3 554364 1 462710 2 888939 1 829831 2 327622 1 286081 3 1548711 2 1381354 3 372275 2 300549 2 2541624 1 2306071 2 755949 1 668397 2 2649326 1 2558263 7 2240364 5 200...
output:
186066839
result:
ok single line: '186066839'
Test #86:
score: 0
Accepted
time: 305ms
memory: 5424kb
input:
500 500 500 493 721641673 490 134696593 495 614309909 490 533517025 493 731076678 480 393674928 497 802020436 489 187724069 497 959333797 480 400531805 495 693308672 487 259481217 499 620280320 482 296980809 491 602066103 487 92931937 492 447206496 484 2002355 496 676050843 483 578989357 494 9478956...
output:
132515195
result:
ok single line: '132515195'
Test #87:
score: 0
Accepted
time: 365ms
memory: 5424kb
input:
500 500 500 496 912221951 144 815242337 498 662864741 42 554124012 498 462860684 410 280871632 493 115259763 110 44608193 493 919568072 206 743427466 499 534115168 19 139072659 492 888726567 103 267847163 492 279952253 413 64086321 497 976809663 128 950151281 496 744632589 248 171977466 497 76133906...
output:
87202620
result:
ok single line: '87202620'
Test #88:
score: 0
Accepted
time: 374ms
memory: 5408kb
input:
500 500 500 14 895043237 7 689358691 17 827216213 9 640575601 18 853172416 1 97129264 17 739411394 2 203660384 12 854920852 3 307231627 15 315627582 10 155182740 19 932178198 8 570912311 19 661520536 2 563589942 12 978039425 6 377892404 18 286157654 2 40195130 19 31082716 4 30669108 15 664688754 10 ...
output:
8275693859
result:
ok single line: '8275693859'
Test #89:
score: 0
Accepted
time: 377ms
memory: 5240kb
input:
500 500 500 2 657465544 1 516032341 2 827492810 1 661228189 2 950896798 1 339649399 2 325247097 1 60123159 2 96363710 1 59774864 2 726735313 1 525145078 2 769425971 1 338055754 2 940677592 1 377180193 2 983306791 1 394000554 2 618647301 1 133282455 2 532323385 1 146731461 2 580392596 1 178267404 2 9...
output:
-1
result:
ok single line: '-1'
Test #90:
score: 0
Accepted
time: 377ms
memory: 5560kb
input:
500 500 500 3 100349847 2 47864921 3 477043197 2 271353525 3 863738837 2 840719888 3 607141715 2 490779741 3 942815586 2 260498781 3 152491641 2 139643603 3 757980669 2 32369173 3 493374102 2 179364548 3 287804098 2 270603565 3 553561941 2 447802068 3 690853104 2 640066552 3 428450538 2 172066213 3 ...
output:
130927808886
result:
ok single line: '130927808886'