QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#500165 | #8707. Jobs | Qwerty1232# | 29 | 226ms | 61328kb | C++23 | 2.3kb | 2024-07-31 23:50:12 | 2024-07-31 23:50:14 |
Judging History
answer
#include <bits/stdc++.h>
int32_t main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(nullptr);
int n;
int64_t S;
std::cin >> n >> S;
std::vector<int> profit(n + 1), dep(n + 1);
dep[0] = -1;
for (int i = 1; i <= n; i++) {
std::cin >> profit[i] >> dep[i];
}
n++;
std::vector<std::vector<int>> gr(n);
for (int i = 1; i < n; i++) {
gr[dep[i]].push_back(i);
}
using Fuck = std::pair<std::pair<int64_t, int64_t>, std::vector<int>>;
auto cmp = [&](auto a, auto b) {
return a.first.first < b.first.first;
};
std::vector<std::set<Fuck>> data(n);
auto merge = [&](auto &a, auto &b) {
if (a.size() < b.size()) {
a.swap(b);
}
a.merge(b);
b.clear();
};
for (int i = n - 1; i > 0; i--) {
auto &set = data[i];
if (profit[i] >= 0) {
data[i].insert({{0, profit[i]}, gr[i]});
} else {
for (int v : gr[i]) {
merge(set, data[v]);
}
int64_t sum = profit[i], min = profit[i];
while (sum < 0 && set.size()) {
auto p1 = set.extract(std::prev(set.end())).value();
auto &[p, vc] = p1;
auto &[a, b] = p;
min = std::min(min, sum + a);
sum += b;
for (int v : vc) {
merge(set, data[v]);
}
}
if (sum < 0) {
continue;
} else {
int id = data.size();
data.push_back({{{min, sum}, {id}}});
data[i].swap(data[id]);
}
}
}
int64_t sum = S;
{
std::set<Fuck> set;
for (int v : gr[0]) {
merge(set, data[v]);
}
while (set.size()) {
auto p1 = set.extract(std::prev(set.end())).value();
auto &[p, vc] = p1;
auto &[a, b] = p;
if (sum + a < 0) {
break;
}
sum += b;
for (int v : vc) {
merge(set, data[v]);
}
}
}
std::cout << sum - S << "\n";
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 11
Accepted
time: 165ms
memory: 53868kb
input:
299955 1000000000000000000 -2 0 10 1 -9 2 14 3 -11 4 17 5 -21 6 22 7 -22 8 23 9 -41 10 -89 10 49 11 99 12 -120 14 -23 8 130 15 24 16 -51 13 55 19 -144 20 -24 18 -30 18 -54 13 64 24 -105 14 145 21 -60 20 -183 25 61 28 -334 30 340 31 111 26 -135 33 -184 33 191 35 -231 17 -505 27 -570 32 -257 25 238 37...
output:
551168
result:
ok single line: '551168'
Test #2:
score: 11
Accepted
time: 226ms
memory: 57788kb
input:
299932 1000000000000000000 -26 0 -38 0 -521 0 -567 0 -569 0 -235 0 -294 0 -134 0 144 8 -177 0 -458 0 -9675 9 296 7 -15 0 34 1 -21349 9 -15643 9 -280 0 -445 15 -13253 13 -7497 15 -12328 15 -3131 15 7498 21 -172566 24 -14287 13 -24726 13 -1 0 -12603 13 -14221 13 -401 0 -4105 13 -2872 15 -1264 9 -5095 ...
output:
797403
result:
ok single line: '797403'
Test #3:
score: 11
Accepted
time: 208ms
memory: 58364kb
input:
299978 1000000000000000000 -319087 0 -397343 0 -746276 0 -123466 0 -27323 0 -462189 0 -44293 0 -157047 0 -492663 0 -471747 0 -214986 0 -276045 0 -134544 0 -245003 0 -564286 0 -100579 0 -128044 0 -725767 0 -317957 0 -515861 0 -209544 0 -152961 0 -275236 0 -499829 0 -609630 0 -439399 0 -61718 0 -80829...
output:
822051
result:
ok single line: '822051'
Test #4:
score: 11
Accepted
time: 108ms
memory: 52484kb
input:
295612 1000000000000000000 -59435628 0 -94130 0 98375 2 -101252 3 -376825783 3 376834010 5 59435737 1 110079 4 -107471 8 -142894643 8 123353 9 -125578 11 -205705873 11 142895079 10 205719702 13 128238 12 -563917506 16 563929915 17 -129566 16 139278 19 -134538 20 -146413129 20 145442 21 -150271 23 15...
output:
963990158
result:
ok single line: '963990158'
Test #5:
score: 11
Accepted
time: 66ms
memory: 55464kb
input:
294609 1000000000000000000 -14859 0 -6241 0 28010 1 -35056 3 -18753 3 29895 5 37233 4 -45266 7 15101 2 46739 8 -42054 7 -47262 10 -47937 10 44830 11 59665 13 48681 12 -49712 15 53835 17 -61975 15 67471 19 -66656 20 -73226 20 78369 21 80156 22 -92090 24 97049 25 -95094 26 -85272 24 100554 27 89857 28...
output:
931886923
result:
ok single line: '931886923'
Test #6:
score: 0
Wrong Answer
time: 88ms
memory: 39316kb
input:
189644 1000000000000000000 -98837 0 119840 1 -99489 2 -76401 0 128492 3 116250 4 -96744 6 -99996 5 133521 8 -99952 5 135918 10 -99998 9 -99991 11 112238 12 -585552 14 -123819 14 601536 15 165067 16 143777 13 -1401938 18 114098 7 -99847 21 -846458 17 -552575 18 141499 22 589263 24 -99993 25 -152653 1...
output:
552691379
result:
wrong answer 1st lines differ - expected: '552691392', found: '552691379'
Subtask #2:
score: 14
Accepted
Test #14:
score: 14
Accepted
time: 0ms
memory: 3828kb
input:
17 5 -3 0 4 1 -4 2 9 3 -5 4 13 5 -6 6 8 7 -23 8 28 9 -26 10 31 11 -28 12 33 13 -39 14 41 15 -7 16
output:
16
result:
ok single line: '16'
Test #15:
score: 14
Accepted
time: 0ms
memory: 3760kb
input:
17 1 -14 0 21 1 -15 2 16 3 -22 4 29 5 -32 6 34 7 -33 8 35 9 -10 10 -1 0 6 12 -3 13 5 14 -16 15 22 16
output:
7
result:
ok single line: '7'
Test #16:
score: 14
Accepted
time: 0ms
memory: 3608kb
input:
17 4 -4 0 12 1 -5 0 8 3 -13 0 17 5 -38 6 39 7 -3 8 -6 0 12 10 -29 11 35 12 -32 13 39 14 -24 0 31 16
output:
42
result:
ok single line: '42'
Test #17:
score: 14
Accepted
time: 1ms
memory: 4020kb
input:
1998 100000 -119974094 0 120949782 1 -148267915 2 149258545 3 -353200332 4 353781482 5 -409351160 0 410180396 7 -405293412 0 405638769 9 -491561775 0 492142804 11 -38208552 0 38786890 13 -188326000 0 188960234 15 -294174444 16 294530806 17 -430597876 18 431035538 19 -487343715 20 487438668 21 -17231...
output:
33581034
result:
ok single line: '33581034'
Test #18:
score: 14
Accepted
time: 1ms
memory: 3836kb
input:
1996 100000 -59755 0 151138 1 -174993 2 255152 3 -257624 4 322787 5 -293552 6 392535 7 -350940 8 418275 9 -487611 10 515476 11 -507579 12 556319 13 -549422 14 556127 15 -584293 16 638017 17 -613793 18 628801 19 -653479 20 704157 21 -695266 22 732277 23 -727516 24 792824 25 -781086 26 819574 27 -8098...
output:
23781881
result:
ok single line: '23781881'
Test #19:
score: 14
Accepted
time: 1ms
memory: 4056kb
input:
1996 83074 -104912 0 157516 1 -226832 2 244272 3 -236577 4 251249 5 -345494 6 411376 7 -527443 8 582958 9 -583787 10 665523 11 -681920 12 727305 13 -730788 14 757169 15 -844569 16 893388 17 -871493 18 916618 19 -1019572 20 1118628 21 -1135127 22 1163326 23 -1294857 24 1367717 25 -1345986 26 1391230 ...
output:
48888408
result:
ok single line: '48888408'
Test #20:
score: 14
Accepted
time: 1ms
memory: 3848kb
input:
1997 392026 -368613 0 553533 1 -8120957 2 8333895 3 -7985911 4 3312802 5 4435825 6 18517 7 -1014196 8 -10212556 9 11612664 10 -13466519 11 14039962 12 -21043407 13 21174643 14 -21449184 15 22266444 16 -31562006 17 31769754 18 -33458430 19 33563104 20 -34071074 21 34188004 22 -34242437 23 34307017 24...
output:
423307544
result:
ok single line: '423307544'
Test #21:
score: 14
Accepted
time: 1ms
memory: 3820kb
input:
1998 3670 -4263584 0 4318213 1 -4766861 2 4793818 3 -6021755 4 6028915 5 -10981412 6 11043466 7 -14917467 8 14928380 9 -18108504 10 18125244 11 -23575827 12 23586895 13 -24056708 14 24132173 15 -25452036 16 25510395 17 -36702348 18 36770088 19 -37159186 20 37165482 21 -38084372 22 38124010 23 -40075...
output:
30157547
result:
ok single line: '30157547'
Test #22:
score: 14
Accepted
time: 1ms
memory: 3820kb
input:
1996 100000 -47319305 0 47364706 1 -13725945 0 13780218 3 -24704817 4 24745187 5 -44323181 0 44421117 7 -5595173 0 5676261 9 -16802773 10 16822863 11 -8972006 0 8976861 13 -4882300 0 4967180 15 -19353494 16 19362861 17 -7345443 0 7410858 19 -21922402 20 21943524 21 -28082838 22 28092936 23 -41738649...
output:
28784257
result:
ok single line: '28784257'
Test #23:
score: 14
Accepted
time: 1ms
memory: 3824kb
input:
1996 954331 -246525934 0 246824973 1 -171768374 0 171931727 3 -277027442 4 277822284 5 -309469868 6 309597847 7 -285885388 8 -122289714 9 408353344 10 -449147475 11 449304397 12 -99137909 0 99891216 14 -388030661 15 388769528 16 -441565178 17 441709887 18 -53104970 0 53516386 20 -153117624 21 153153...
output:
39368059
result:
ok single line: '39368059'
Test #24:
score: 14
Accepted
time: 1ms
memory: 3768kb
input:
1996 1 -1 0 934596 1 -245994 2 838558 3 -1023435 4 1505077 5 -1253667 6 1510233 7 -1269836 8 1613725 9 -1505401 10 2178612 11 -2036205 12 2410454 13 -4326153 14 4947830 15 -4326154 16 4839162 17 -4352027 18 5026619 19 -4422789 20 4570760 21 -4868075 22 5163827 23 -5607853 24 6199786 25 -6221258 26 6...
output:
3656716
result:
ok single line: '3656716'
Test #25:
score: 14
Accepted
time: 1ms
memory: 3772kb
input:
1997 1 -1 0 4128 1 -3993 2 74560 3 -4107 4 29412 5 -124282 6 167990 7 -266635 8 285731 9 -296541 10 359960 11 -345943 12 403009 13 -559702 14 590908 15 -645298 16 667991 17 -713997 18 770876 19 -724771 20 761259 21 -745145 22 841278 23 -1132098 24 1209778 25 -1149601 26 1169460 27 -1207652 28 124597...
output:
1976688
result:
ok single line: '1976688'
Test #26:
score: 14
Accepted
time: 1ms
memory: 4052kb
input:
1997 221858 -906800 0 1458469 1 -3490423 2 4305248 3 -7528333 4 8000537 5 -7885388 6 7958703 7 -11393926 8 11980747 9 -11747944 10 12721208 11 -17195863 12 17436265 13 -19104428 14 19963703 15 -19221213 16 19790185 17 -26786612 18 27186963 19 -30098944 20 30428098 21 -30159706 22 30725701 23 -345052...
output:
471142643
result:
ok single line: '471142643'
Test #27:
score: 14
Accepted
time: 1ms
memory: 3988kb
input:
1996 849690 -28008524 0 28806149 1 -60092337 2 60377234 3 -86664447 4 86839975 5 -88838841 6 89792065 7 -118219083 8 118579228 9 -130374280 10 130705881 11 -184972834 12 185236973 13 -213002399 14 213944112 15 -225039106 16 225182999 17 -225237975 18 225413754 19 -234633304 20 234637320 21 -25407696...
output:
361576027
result:
ok single line: '361576027'
Test #28:
score: 14
Accepted
time: 1ms
memory: 3816kb
input:
1997 119135 -152044487 0 152804173 1 -397670939 2 397750796 3 -376672967 0 376746022 5 -417762437 6 418515035 7 -34613749 0 34835024 9 -414368835 0 414736822 11 -376229751 0 376495945 13 -384945031 14 385225811 15 -12089459 0 12451971 17 -389844127 18 390409800 19 -273473837 0 274006345 21 -15884699...
output:
27348525
result:
ok single line: '27348525'
Test #29:
score: 14
Accepted
time: 0ms
memory: 3848kb
input:
1998 942452 -17200029 0 17682105 1 -157988703 2 158288198 3 -4465812 0 4520447 5 -83969677 6 84083777 7 -377563619 8 378402838 9 -179102286 0 179287702 11 -182471742 12 182476796 13 -306751887 14 307033334 15 -459185361 16 460089539 17 -264044243 0 264411886 19 -299850633 20 300594894 21 -181708015 ...
output:
451229996
result:
ok single line: '451229996'
Test #30:
score: 14
Accepted
time: 1ms
memory: 3756kb
input:
1997 111 -71 0 70 1 0 2 0 3 -44 4 -61 5 26570 6 -108 7 19586 8 -109 9 77880 10 -110 11 8653 12 -111 13 84092 14 -39918 15 99150 16 -59706 17 95315 18 -128192 19 215712 20 -130737 21 132166 22 -250104 23 349032 24 -254356 25 304569 26 -273875 27 339811 28 -336187 29 355943 30 -404056 31 495501 32 -38...
output:
7053779
result:
ok single line: '7053779'
Test #31:
score: 14
Accepted
time: 1ms
memory: 4040kb
input:
1998 23414 -21438 0 65346 1 -21835 2 97920 3 -23231 4 61068 5 -173492 6 259764 7 -298330 8 340444 9 -314229 10 392678 11 -337064 12 411806 13 -377880 14 439107 15 -407467 16 481499 17 -473066 18 481956 19 -653829 20 706334 21 -1121383 22 1176305 23 -1143687 24 1168817 25 -1282829 26 1291310 27 -1289...
output:
42402445
result:
ok single line: '42402445'
Test #32:
score: 14
Accepted
time: 1ms
memory: 3860kb
input:
1996 82712 -316962 0 348266 1 -656551 2 664343 3 -1202654 4 1206638 5 -2231912 6 2292459 7 -3208507 8 3265411 9 -3283532 10 3290943 11 -3296785 12 3322367 13 -3355692 14 3432232 15 -3603791 16 3664502 17 -3791800 18 3846615 19 -4202013 20 4282980 21 -4239315 22 4286812 23 -4585108 24 4683584 25 -464...
output:
49210123
result:
ok single line: '49210123'
Test #33:
score: 14
Accepted
time: 1ms
memory: 3840kb
input:
1996 412723 -1285799 0 -2785143 1 -1915618 2 -31151 3 -10385 4 -352 5 -834 6 -271 7 -56 8 2286147 9 -1990814 10 -3346 11 -267118 12 -8046 13 -1982 14 -11516 15 -1886 16 5486951 17 -5461283 18 -14404 19 -8792 20 -2625 21 -1260 22 -50 23 -7 24 -5 25 -4 26 -2 27 -5 28 -1 29 6722984 30 -14074029 31 1421...
output:
274648629
result:
ok single line: '274648629'
Test #34:
score: 14
Accepted
time: 1ms
memory: 3824kb
input:
1996 96055 -163124760 0 163196597 1 -439679475 0 440015968 3 -330108552 0 330659538 5 -133814317 0 134036406 7 -361200860 0 361857023 9 -448386315 10 448562742 11 -305879265 0 306771045 13 -21948420 0 22559969 15 -444868398 0 445604686 17 -79688092 0 80526514 19 -161275407 20 162273868 21 -378895805...
output:
217568388
result:
ok single line: '217568388'
Test #35:
score: 14
Accepted
time: 1ms
memory: 3760kb
input:
1998 53059 -17596215 0 17635693 1 -24626608 2 24636115 3 -42169815 4 42235610 5 -48165922 6 48208633 7 -5034181 0 5043935 9 -44483459 10 44555839 11 -9484773 0 9498470 13 -17554127 14 17624124 15 -18632954 16 18643094 17 -11271715 0 11354481 19 -26953622 20 26963318 21 -27911140 0 28010094 23 -33163...
output:
47280019
result:
ok single line: '47280019'
Test #36:
score: 14
Accepted
time: 1ms
memory: 3756kb
input:
1998 100000 -36651 0 79063 1 -66318 2 116300 3 -94671 4 192399 5 -96166 6 121962 7 -99408 8 192332 9 -99527 10 165939 11 -99979 12 162744 13 -99990 14 178653 15 -99995 16 153909 17 -99997 18 102347 19 -99999 20 118015 21 -100000 22 185649 23 -546732 24 547012 25 -120651 26 -200831 27 276570 28 -2039...
output:
33334487
result:
ok single line: '33334487'
Test #37:
score: 14
Accepted
time: 1ms
memory: 3712kb
input:
1998 2750 -2674 0 939050 1 -2698 2 188682 3 -2750 4 349736 5 -76242 6 769422 7 -196140 8 736133 9 -223700 10 677360 11 -464369 12 1046139 13 -954432 14 1062023 15 -2825470 16 3729410 17 -3055569 18 3526003 19 -5955115 20 6192412 21 -8330959 22 8467897 23 -8435464 24 8650112 25 -8500021 26 8610167 27...
output:
62813522
result:
ok single line: '62813522'
Test #38:
score: 14
Accepted
time: 1ms
memory: 4068kb
input:
1996 9484 -482266 0 571044 1 -644059 2 734857 3 -1903590 4 1913094 5 -1969178 6 2030836 7 -2700941 8 2787436 9 -2758519 10 2857182 11 -2817204 12 2902534 13 -3223663 14 3271392 15 -3228009 16 3290047 17 -3937562 18 4026698 19 -3942339 20 3957812 21 -4035116 22 4101986 23 -4362539 24 4395213 25 -4416...
output:
10779086
result:
ok single line: '10779086'
Test #39:
score: 14
Accepted
time: 0ms
memory: 3856kb
input:
1996 43507 -43499 0 74123 1 -4468514 2 4560077 3 -7686298 4 7774199 5 -10115287 6 10210356 7 -15544964 8 15576507 9 -15914328 10 15990423 11 -16194873 12 16267151 13 -17397927 14 17456031 15 -17668924 16 17741741 17 -19882595 18 19960608 19 -21749798 20 21831533 21 -22366924 22 22432174 23 -26775628...
output:
9707042
result:
ok single line: '9707042'
Test #40:
score: 14
Accepted
time: 1ms
memory: 3804kb
input:
1998 16132 -27815063 0 27845919 1 -16124 0 70139 3 -543295 4 564956 5 -43991673 0 44070836 7 -861535 0 892306 9 -27107826 10 27120048 11 -29224292 12 29297130 13 -27370277 0 27442809 15 -38643375 16 38698533 17 -33817752 0 33905960 19 -1485102 0 1495381 21 -41707228 0 41800507 23 -30740171 0 3077709...
output:
6188757
result:
ok single line: '6188757'
Test #41:
score: 14
Accepted
time: 0ms
memory: 3840kb
input:
1991 35671 -22386 0 40467 1 -193576 2 204855 3 -291681 4 353201 5 -353949 6 362997 7 -367838 8 422419 9 -438001 10 530583 11 -473090 12 556111 13 -557456 14 649915 15 -628847 16 711329 17 -738620 18 792063 19 -834325 20 868739 21 -872848 22 963283 23 -896848 24 969140 25 -1001626 26 1073886 27 -1079...
output:
46098536
result:
ok single line: '46098536'
Subtask #3:
score: 15
Accepted
Test #42:
score: 15
Accepted
time: 106ms
memory: 60656kb
input:
300000 0 -1677 0 1678 1 -3010 2 3011 3 -8141 4 8142 5 -11233 6 11234 7 -14400 8 14401 9 -17045 10 17046 11 -19521 12 19522 13 -23178 14 23179 15 -26907 16 26908 17 -28884 18 28885 19 -30742 20 30743 21 -35957 22 35958 23 -38436 24 38437 25 -39739 26 39740 27 -42432 28 42433 29 -47866 30 47867 31 -48...
output:
150000
result:
ok single line: '150000'
Test #43:
score: 15
Accepted
time: 135ms
memory: 59768kb
input:
300000 0 -2707 0 2708 1 -35703 2 35704 3 -87028 4 87029 5 -90666 6 90667 7 -144441 8 144442 9 -13210 0 13211 11 -54700 12 54701 13 -65742 14 65743 15 -118284 16 118285 17 -128694 18 128695 19 -7111 0 7112 21 -57902 22 57903 23 -79725 24 79726 25 -110281 26 110282 27 -124571 28 124572 29 -18852 0 188...
output:
150000
result:
ok single line: '150000'
Test #44:
score: 15
Accepted
time: 112ms
memory: 55532kb
input:
300000 0 -62936 0 62937 1 -137762 0 137763 3 -73582 0 73583 5 -66183 0 66184 7 -75047 0 75048 9 -43684 0 43685 11 -2721 0 2722 13 -111595 0 111596 15 -61005 0 61006 17 -85734 0 85735 19 -87099 0 87100 21 -140862 0 140863 23 -12218 0 12219 25 -68482 0 68483 27 -40203 0 40204 29 -34323 0 34324 31 -374...
output:
150000
result:
ok single line: '150000'
Test #45:
score: 15
Accepted
time: 68ms
memory: 55728kb
input:
299994 8 -3 0 11 1 -9 2 15 3 -21 4 25 5 -23 6 33 7 -33 8 40 9 -37 10 44 11 -45 12 48 13 -52 14 60 15 -61 16 65 17 -63 18 66 19 -66 20 69 21 -70 22 75 23 -74 24 77 25 -78 26 88 27 -84 28 92 29 -97 30 106 31 -102 32 104 33 -108 34 112 35 -110 36 116 37 -116 38 121 39 -119 40 127 41 -125 42 131 43 -136...
output:
546593
result:
ok single line: '546593'
Test #46:
score: 15
Accepted
time: 64ms
memory: 60308kb
input:
299982 3 -1 0 4 1 -13 2 18 3 -17 4 22 5 -23 6 32 7 -37 8 39 9 -45 10 53 11 -47 12 49 13 -66 14 69 15 -73 16 81 17 -86 18 94 19 -122 20 126 21 -132 22 140 23 -139 24 145 25 -160 26 169 27 -163 28 167 29 -174 30 184 31 -184 32 190 33 -208 34 212 35 -215 36 216 37 -228 38 234 39 -237 40 243 41 -258 42 ...
output:
80601
result:
ok single line: '80601'
Test #47:
score: 15
Accepted
time: 69ms
memory: 50684kb
input:
299990 2 -23 0 31 1 -41 2 42 3 -58 4 59 5 -111 6 116 7 -160 8 162 9 -228 10 237 11 -263 12 272 13 -274 14 281 15 -280 16 285 17 -301 18 309 19 -373 20 377 21 -389 22 396 23 -412 24 421 25 -492 26 494 27 -526 28 527 29 -552 30 555 31 -557 32 559 33 -586 34 590 35 -665 36 668 37 -754 38 758 39 -806 40...
output:
316743
result:
ok single line: '316743'
Test #48:
score: 15
Accepted
time: 39ms
memory: 30640kb
input:
149994 26541 -439675 0 463550 1 -860082 2 861744 3 -2380011 4 2406491 5 -2513061 6 2529487 7 -2659949 8 2689497 9 -4255225 10 4273734 11 -4437937 12 4445358 13 -4557620 14 4561451 15 -8289638 16 8301552 17 -10171357 18 10177628 19 -10807126 20 10832987 21 -11615970 22 11642203 23 -12144344 24 121671...
output:
328128683
result:
ok single line: '328128683'
Test #49:
score: 15
Accepted
time: 109ms
memory: 52756kb
input:
299992 10401 -562387282 0 562396503 1 -726656747 2 726657432 3 -897911244 0 897924839 5 -372769882 0 372769956 7 -847289191 8 847302716 9 -385403954 0 385412618 11 -724364491 12 724375939 13 -714343972 0 714361026 15 -57383227 0 57384838 17 -677425239 18 677436619 19 -84798684 0 84799922 21 -4079996...
output:
989551522
result:
ok single line: '989551522'
Test #50:
score: 15
Accepted
time: 108ms
memory: 61080kb
input:
299996 2325 -14446016 0 14446501 1 -77526933 2 77534181 3 -81726390 4 81739095 5 -147061782 6 147072239 7 -189940393 8 189952226 9 -195690126 10 195692100 11 -382050781 12 382051641 13 -399122179 14 399134670 15 -402431158 16 402439800 17 -446803982 18 446809172 19 -506091259 20 506095653 21 -537286...
output:
923414642
result:
ok single line: '923414642'
Test #51:
score: 15
Accepted
time: 63ms
memory: 58776kb
input:
299714 4 -1 0 11 1 -2 2 9 3 -4 4 9 5 -25 6 26 7 -26 8 36 9 -27 10 37 11 -46 12 48 13 -49 14 52 15 -51 16 52 17 -52 18 61 19 -55 20 64 21 -59 22 64 23 -60 24 65 25 -80 26 88 27 -63 28 -15 29 -2 30 -1 31 14 32 -5 33 -1 34 -2 35 -6 36 16 37 -16 38 88 39 -85 40 92 41 -94 42 101 43 -108 44 112 45 -109 46...
output:
467395
result:
ok single line: '467395'
Test #52:
score: 15
Accepted
time: 56ms
memory: 57796kb
input:
299991 4 -3 0 11 1 -18 2 24 3 -27 4 28 5 -30 6 33 7 -40 8 50 9 -61 10 65 11 -72 12 79 13 -85 14 86 15 -96 16 97 17 -98 18 108 19 -100 20 103 21 -150 22 154 23 -156 24 164 25 -157 26 165 27 -160 28 163 29 -171 30 181 31 -173 32 178 33 -208 34 214 35 -215 36 217 37 -223 38 231 39 -238 40 240 41 -239 4...
output:
239860
result:
ok single line: '239860'
Test #53:
score: 15
Accepted
time: 71ms
memory: 58484kb
input:
294992 5085 -72774 0 74763 1 -76113 2 86739 3 -93763 4 97157 5 -124339 6 137283 7 -174838 8 176244 9 -199049 10 204611 11 -215064 12 216402 13 -316677 14 324228 15 -361389 16 367426 17 -371429 18 383740 19 -405831 20 406000 21 -411010 22 417755 23 -422257 24 429482 25 -528128 26 538487 27 -599037 28...
output:
365896849
result:
ok single line: '365896849'
Test #54:
score: 15
Accepted
time: 64ms
memory: 58468kb
input:
299995 100000 -100231 0 100236 1 -100248 2 100256 3 -100345 4 100351 5 -100373 6 100379 7 -100774 8 100779 9 -100831 10 100840 11 -100970 12 100974 13 -101191 14 101196 15 -101499 16 101500 17 -102059 18 102062 19 -102549 20 102556 21 -102899 22 102905 23 -102980 24 102984 25 -103113 26 103120 27 -1...
output:
57084
result:
ok single line: '57084'
Test #55:
score: 15
Accepted
time: 44ms
memory: 30236kb
input:
149988 1 -687907470 0 687930584 1 -417118419 0 417143769 3 -676593922 4 676619412 5 -50271258 0 50293214 7 -393243855 0 393267175 9 -732502071 0 732520398 11 -568914480 0 568928416 13 -713251602 14 713273415 15 -392353315 0 392377048 17 -139174068 0 139199229 19 -360621458 20 360638263 21 -628726188...
output:
189881793
result:
ok single line: '189881793'
Test #56:
score: 15
Accepted
time: 100ms
memory: 54904kb
input:
299997 6 -38292 0 38302 1 -38470 2 38476 3 -62961 4 62967 5 -74680 6 74690 7 -86773 8 86779 9 -92384 10 92386 11 -123954 12 123964 13 -141010 14 141020 15 -148004 16 148010 17 -173352 18 173354 19 -210885 20 210887 21 -214275 22 214280 23 -225243 24 225250 25 -254936 26 254938 27 -260210 28 260220 2...
output:
550922
result:
ok single line: '550922'
Test #57:
score: 15
Accepted
time: 57ms
memory: 58660kb
input:
294994 100000 -53267 0 61130 1 -79222 2 85873 3 -107915 4 115455 5 -112228 6 113910 7 -112584 8 115824 9 -113297 10 118841 11 -119314 12 128608 13 -120801 14 125670 15 -124029 16 126797 17 -128464 18 130068 19 -131571 20 134871 21 -137885 22 145738 23 -143626 24 149662 25 -167958 26 180727 27 -16801...
output:
274262574
result:
ok single line: '274262574'
Test #58:
score: 15
Accepted
time: 61ms
memory: 57592kb
input:
299997 10 -6 0 16 1 -8 2 15 3 -10 4 13 5 -19 6 28 7 -61 8 66 9 -64 10 70 11 -72 12 76 13 -76 14 81 15 -100 16 101 17 -105 18 114 19 -106 20 108 21 -111 22 112 23 -120 24 126 25 -126 26 133 27 -178 28 179 29 -184 30 185 31 -193 32 195 33 -196 34 206 35 -212 36 222 37 -218 38 219 39 -230 40 238 41 -25...
output:
175947
result:
ok single line: '175947'
Test #59:
score: 15
Accepted
time: 72ms
memory: 54656kb
input:
299990 9 -5 0 8 1 -48 2 52 3 -54 4 57 5 -103 6 110 7 -140 8 143 9 -160 10 165 11 -174 12 184 13 -237 14 244 15 -241 16 250 17 -272 18 277 19 -277 20 280 21 -308 22 318 23 -325 24 327 25 -353 26 357 27 -406 28 413 29 -415 30 424 31 -459 32 464 33 -461 34 466 35 -504 36 510 37 -511 38 521 39 -539 40 5...
output:
550792
result:
ok single line: '550792'
Test #60:
score: 15
Accepted
time: 87ms
memory: 57368kb
input:
299994 100000 -100506 0 100515 1 -100660 2 100663 3 -100987 4 100992 5 -101132 6 101137 7 -101141 8 101145 9 -101392 10 101402 11 -101396 12 101404 13 -101603 14 101604 15 -102437 16 102447 17 -102691 18 102696 19 -102993 20 102994 21 -103046 22 103054 23 -103164 24 103169 25 -103417 26 103420 27 -1...
output:
687401
result:
ok single line: '687401'
Test #61:
score: 15
Accepted
time: 140ms
memory: 57672kb
input:
299996 12662 -764150505 0 764154355 1 -164899282 0 164908249 3 -77774672 0 77785067 5 -927590971 6 927601220 7 -753611407 0 753623252 9 -527093349 0 527098815 11 -730535110 0 730546714 13 -230253570 0 230261838 15 -823670420 0 823681950 17 -343004826 0 343013016 19 -429083625 0 429087224 21 -1124625...
output:
984311051
result:
ok single line: '984311051'
Test #62:
score: 15
Accepted
time: 119ms
memory: 60052kb
input:
294996 4464 -122392220 0 122399223 1 -123842459 2 123842731 3 -141572179 4 141574986 5 -149670765 6 149678268 7 -202488152 8 202488272 9 -286825212 10 286826478 11 -300314838 12 300323274 13 -333301791 14 333312598 15 -334098186 16 334107636 17 -409469632 18 409470208 19 -507956579 20 507964975 21 -...
output:
968055496
result:
ok single line: '968055496'
Test #63:
score: 15
Accepted
time: 51ms
memory: 59376kb
input:
294994 100000 -14187 0 16465 1 -65648 2 73985 3 -94121 4 106271 5 -98539 6 105943 7 -99663 8 110632 9 -99984 10 103563 11 -99996 12 111846 13 -99998 14 106428 15 -100000 16 111738 17 -107125 18 119496 19 -111071 20 123668 21 -111772 22 112969 23 -117209 24 120950 25 -119423 26 125010 27 -128516 28 1...
output:
196146846
result:
ok single line: '196146846'
Test #64:
score: 15
Accepted
time: 48ms
memory: 36932kb
input:
199974 27673 -24895 0 43456 1 -26158 2 66281 3 -26914 4 27129 5 -27057 6 28853 7 -27572 8 69471 9 -27643 10 47878 11 -141377 12 185522 13 -216702 14 226344 15 -111419 16 -36939 17 -22123 18 -28943 19 -24286 20 -10606 21 -3899 22 -1372 23 -1299 24 -344 25 -1230 26 -8 27 -31 28 -15 29 -5 30 -3 31 0 32...
output:
359945585
result:
ok single line: '359945585'
Test #65:
score: 15
Accepted
time: 56ms
memory: 61044kb
input:
299996 9 -9 0 13 1 -11 2 18 3 -24 4 26 5 -32 6 41 7 -41 8 44 9 -45 10 53 11 -48 12 58 13 -72 14 77 15 -73 16 82 17 -99 18 104 19 -172 20 174 21 -198 22 204 23 -202 24 204 25 -318 26 321 27 -325 28 332 29 -374 30 375 31 -382 32 385 33 -425 34 430 35 -529 36 536 37 -532 38 533 39 -535 40 538 41 -571 4...
output:
3417
result:
ok single line: '3417'
Test #66:
score: 15
Accepted
time: 50ms
memory: 38500kb
input:
199992 7203 -2802987 0 2827233 1 -2982480 2 3025553 3 -3683773 4 3709952 5 -6512883 6 6537851 7 -6572011 8 6583130 9 -7317439 10 7340712 11 -7551088 12 7554988 13 -8414839 14 8426746 15 -8523367 16 8566059 17 -10049326 18 10069521 19 -12317740 20 12361011 21 -12354236 22 12392109 23 -12643120 24 126...
output:
559452499
result:
ok single line: '559452499'
Test #67:
score: 15
Accepted
time: 128ms
memory: 57388kb
input:
299992 9 -80493 0 80498 1 -654008 0 654014 3 -225957 0 225965 5 -233411 6 233417 7 -598943 8 598953 9 -327426 0 327435 11 -523498 12 523507 13 -806945 0 806946 15 -179018 0 179022 17 -182989 18 182991 19 -177944 0 177945 21 -263325 0 263332 23 -793262 24 793265 25 -71500 0 71504 27 -271791 0 271797 ...
output:
824530
result:
ok single line: '824530'
Test #68:
score: 15
Accepted
time: 109ms
memory: 59836kb
input:
294988 100000 -827500 0 838015 1 -8263400 2 8264075 3 -30995602 4 30999821 5 -48186747 6 48197718 7 -54458919 8 54467402 9 -62635677 10 62648045 11 -66319610 12 66326129 13 -124271079 14 124279776 15 -152444203 16 152445201 17 -195712741 18 195714045 19 -197291872 20 197293060 21 -234457004 22 23446...
output:
824075760
result:
ok single line: '824075760'
Test #69:
score: 15
Accepted
time: 69ms
memory: 59276kb
input:
294990 7540 -2879 0 7324 1 -3311 2 11283 3 -3518 4 4853 5 -3757 6 9124 7 -4104 8 10814 9 -5190 10 6462 11 -5905 12 11335 13 -7396 14 11129 15 -7533 16 20192 17 -7539 18 18425 19 -7540 20 9505 21 -15894 22 27156 23 -18304 24 31061 25 -28643 26 32431 27 -31885 28 38141 29 -32483 30 37014 31 -32534 32 ...
output:
40925630
result:
ok single line: '40925630'
Test #70:
score: 15
Accepted
time: 69ms
memory: 61328kb
input:
299990 1 -6 0 9 1 -17 2 21 3 -30 4 34 5 -41 6 42 7 -49 8 56 9 -60 10 68 11 -62 12 69 13 -68 14 77 15 -89 16 93 17 -96 18 101 19 -97 20 102 21 -100 22 110 23 -101 24 106 25 -102 26 108 27 -109 28 116 29 -111 30 114 31 -112 32 119 33 -115 34 121 35 -131 36 135 37 -132 38 137 39 -133 40 136 41 -136 42 ...
output:
696933
result:
ok single line: '696933'
Test #71:
score: 15
Accepted
time: 58ms
memory: 60344kb
input:
299990 1 -23 0 27 1 -44 2 54 3 -92 4 95 5 -122 6 126 7 -148 8 153 9 -198 10 199 11 -213 12 218 13 -215 14 217 15 -221 16 227 17 -225 18 228 19 -235 20 240 21 -320 22 321 23 -354 24 358 25 -360 26 370 27 -397 28 406 29 -404 30 408 31 -418 32 420 33 -429 34 434 35 -435 36 440 37 -436 38 440 39 -453 40...
output:
130652
result:
ok single line: '130652'
Test #72:
score: 15
Accepted
time: 93ms
memory: 58624kb
input:
299991 100000 -100123 0 100126 1 -100870 2 100877 3 -101026 4 101032 5 -101725 6 101728 7 -101784 8 101785 9 -101951 10 101959 11 -102230 12 102234 13 -102257 14 102258 15 -102318 16 102322 17 -102459 18 102463 19 -102492 20 102495 21 -103137 22 103144 23 -104103 24 104109 25 -104321 26 104328 27 -1...
output:
662809
result:
ok single line: '662809'
Test #73:
score: 15
Accepted
time: 91ms
memory: 58600kb
input:
299990 100000 -704356 0 704364 1 -315264 0 315274 3 -569639 0 569642 5 -830919 6 830922 7 -916530 8 916538 9 -481124 0 481126 11 -350625 0 350629 13 -451461 14 451463 15 -747898 0 747899 17 -127099 0 127105 19 -370813 20 370822 21 -770906 22 770910 23 -809096 24 809106 25 -875612 26 875620 27 -89659...
output:
48160
result:
ok single line: '48160'
Test #74:
score: 15
Accepted
time: 109ms
memory: 60012kb
input:
299988 8 -15304 0 15306 1 -53300 2 53307 3 -60332 4 60342 5 -68205 6 68209 7 -104960 8 104967 9 -134298 10 134304 11 -155442 12 155449 13 -159853 14 159854 15 -169647 16 169656 17 -173988 18 173993 19 -214391 20 214392 21 -289728 22 289732 23 -312901 24 312904 25 -337616 26 337617 27 -365767 28 3657...
output:
440048
result:
ok single line: '440048'
Test #75:
score: 15
Accepted
time: 85ms
memory: 60040kb
input:
299997 4143 -5607 0 5703 1 -17978 2 23331 3 -26405 4 36982 5 -38661 6 42045 7 -100340 8 104723 9 -120161 10 124408 11 -130559 12 133017 13 -139548 14 144402 15 -263527 16 264427 17 -275295 18 286250 19 -303234 20 315915 21 -402288 22 403614 23 -419063 24 426431 25 -436072 26 441968 27 -444446 28 447...
output:
987793871
result:
ok single line: '987793871'
Subtask #4:
score: 0
Wrong Answer
Dependency #2:
100%
Accepted
Test #76:
score: 29
Accepted
time: 0ms
memory: 3552kb
input:
6 1 3 0 -3 1 -5 0 2 1 6 3 -4 5
output:
6
result:
ok single line: '6'
Test #77:
score: 29
Accepted
time: 1ms
memory: 3824kb
input:
1992 100000 -123091 0 -30281 0 -21906 2 171526 1 -164573 4 78303 3 -539585 6 170968 5 -178934 6 -508341 8 -475191 8 518159 11 636961 7 -1375943 12 -1134601 13 -310451 4 243776 9 -261962 17 331531 18 1201616 15 -1488800 19 519773 10 -1589229 12 -1624437 22 1636816 23 -604851 13 -2491287 20 338512 16 ...
output:
29871319
result:
ok single line: '29871319'
Test #78:
score: 29
Accepted
time: 1ms
memory: 3812kb
input:
1995 100000 -100015 0 -100035 0 -100004 0 -100023 0 100023 1 -100324 5 -100105 5 -43606 0 100107 7 100013 3 -100079 10 100031 4 -100207 12 -100219 10 -102221 9 100224 14 -100359 5 -100113 10 -100242 10 -101073 16 100038 2 -101171 9 -100687 21 -100054 21 -100779 16 101080 20 -100081 5 100365 17 -1004...
output:
2706
result:
ok single line: '2706'
Test #79:
score: 29
Accepted
time: 1ms
memory: 3736kb
input:
1995 100000 -100874 0 -100123 0 -100279 0 -100025 0 -100033 0 -100128 0 -100352 0 100030 4 -100054 0 -100789 0 -100164 0 -100023 0 -100082 0 -100088 0 -100414 0 100883 1 -100106 0 -100132 0 -100210 0 -104174 16 -100573 0 -100043 0 -103937 8 -100089 0 100091 14 100039 5 -100198 0 -100039 0 100046 28 ...
output:
241
result:
ok single line: '241'
Test #80:
score: 29
Accepted
time: 1ms
memory: 3960kb
input:
1991 7 -1255 0 -2528 0 -822 0 -388 0 -1441 0 -2254 0 -3839 0 -782 0 -2530 0 -1586 0 -844 0 -2370 0 -756 0 -1171 0 -3768 0 -1563 0 -2452 0 -1475 0 -4270 0 -2079 0 -599 0 -2220 0 -2065 0 -139 0 1596 10 -1211 0 -4231 0 -3256 0 -348 0 -2600 0 -2036 0 -2011 0 -3473 0 -2426 0 -614 0 -1640 0 -2614 0 -1797 ...
output:
4143
result:
ok single line: '4143'
Test #81:
score: 29
Accepted
time: 1ms
memory: 3752kb
input:
1994 98229 -25011 0 -28801007 0 28812436 2 31607 1 -98668 4 175546 5 -125883 6 135777 7 -10384621 4 -12045979 6 -187727 8 10448416 9 -46915950 8 47004608 13 206079 11 12137635 10 -17969925 15 18052237 17 -202812 15 284861 19 -10901049 20 10987634 21 -279111 20 373407 23 -37466576 24 37553653 25 -301...
output:
14506418
result:
ok single line: '14506418'
Test #82:
score: 29
Accepted
time: 1ms
memory: 3744kb
input:
1994 4 -1 0 -5 0 2 1 11 2 -13 4 15 5 -17 6 23 7 -10 4 -19 6 22 10 -29 11 38 12 -26 11 -41 13 -33 13 14 9 46 15 -48 18 30 14 35 16 55 19 -44 18 46 23 -55 22 64 25 -62 22 66 27 -70 28 74 29 -68 28 -79 30 75 31 88 32 -83 30 88 35 -97 36 98 37 -98 38 -93 36 -62 40 106 39 -1 41 -99 38 -15 41 23 45 9 43 -...
output:
5191
result:
ok single line: '5191'
Test #83:
score: 0
Wrong Answer
time: 1ms
memory: 4036kb
input:
1933 100000 -17223 0 17227 1 -69253 2 -89374 2 69262 3 89381 4 -100011 6 100017 7 -100007 5 -100075 8 -100012 6 100015 9 100016 11 -100042 12 -100044 8 100046 14 -100021 13 100026 17 100047 15 -100083 19 -100051 16 100087 20 -100096 22 -100045 19 100059 21 100052 24 100085 10 -100061 25 -100354 27 -...
output:
1179
result:
wrong answer 1st lines differ - expected: '1181', found: '1179'
Subtask #5:
score: 0
Skipped
Dependency #1:
0%