QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#810326 | #8582. 점프 게임 | ucup-team004 | 100 ✓ | 552ms | 51632kb | C++23 | 5.9kb | 2024-12-11 21:08:57 | 2024-12-11 21:08:59 |
Judging History
answer
#include <bits/stdc++.h>
using i64 = long long;
using u64 = unsigned long long;
using u32 = unsigned;
using u128 = unsigned __int128;
template<class Info, class Tag>
struct LazySegmentTree {
int n;
std::vector<Info> info;
std::vector<Tag> tag;
LazySegmentTree() : n(0) {}
LazySegmentTree(int n_, Info v_ = Info()) {
init(n_, v_);
}
template<class T>
LazySegmentTree(std::vector<T> init_) {
init(init_);
}
void init(int n_, Info v_ = Info()) {
init(std::vector(n_, v_));
}
template<class T>
void init(std::vector<T> init_) {
n = init_.size();
info.assign(4 << std::__lg(n), Info());
tag.assign(4 << std::__lg(n), Tag());
std::function<void(int, int, int)> build = [&](int p, int l, int r) {
if (r - l == 1) {
info[p] = init_[l];
return;
}
int m = (l + r) / 2;
build(2 * p, l, m);
build(2 * p + 1, m, r);
pull(p);
};
build(1, 0, n);
}
void pull(int p) {
info[p] = info[2 * p] + info[2 * p + 1];
}
void apply(int p, const Tag &v) {
info[p].apply(v);
tag[p].apply(v);
}
void push(int p) {
apply(2 * p, tag[p]);
apply(2 * p + 1, tag[p]);
tag[p] = Tag();
}
void modify(int p, int l, int r, int x, const Info &v) {
if (r - l == 1) {
info[p] = v;
return;
}
int m = (l + r) / 2;
push(p);
if (x < m) {
modify(2 * p, l, m, x, v);
} else {
modify(2 * p + 1, m, r, x, v);
}
pull(p);
}
void modify(int p, const Info &v) {
modify(1, 0, n, p, v);
}
Info rangeQuery(int p, int l, int r, int x, int y) {
if (l >= y || r <= x) {
return Info();
}
if (l >= x && r <= y) {
return info[p];
}
int m = (l + r) / 2;
push(p);
return rangeQuery(2 * p, l, m, x, y) + rangeQuery(2 * p + 1, m, r, x, y);
}
Info rangeQuery(int l, int r) {
return rangeQuery(1, 0, n, l, r);
}
void rangeApply(int p, int l, int r, int x, int y, const Tag &v) {
if (l >= y || r <= x) {
return;
}
if (l >= x && r <= y) {
apply(p, v);
return;
}
int m = (l + r) / 2;
push(p);
rangeApply(2 * p, l, m, x, y, v);
rangeApply(2 * p + 1, m, r, x, y, v);
pull(p);
}
void rangeApply(int l, int r, const Tag &v) {
return rangeApply(1, 0, n, l, r, v);
}
template<class F>
int findFirst(int p, int l, int r, int x, int y, F &&pred) {
if (l >= y || r <= x) {
return -1;
}
if (l >= x && r <= y && !pred(info[p])) {
return -1;
}
if (r - l == 1) {
return l;
}
int m = (l + r) / 2;
push(p);
int res = findFirst(2 * p, l, m, x, y, pred);
if (res == -1) {
res = findFirst(2 * p + 1, m, r, x, y, pred);
}
return res;
}
template<class F>
int findFirst(int l, int r, F &&pred) {
return findFirst(1, 0, n, l, r, pred);
}
template<class F>
int findLast(int p, int l, int r, int x, int y, F &&pred) {
if (l >= y || r <= x) {
return -1;
}
if (l >= x && r <= y && !pred(info[p])) {
return -1;
}
if (r - l == 1) {
return l;
}
int m = (l + r) / 2;
push(p);
int res = findLast(2 * p + 1, m, r, x, y, pred);
if (res == -1) {
res = findLast(2 * p, l, m, x, y, pred);
}
return res;
}
template<class F>
int findLast(int l, int r, F &&pred) {
return findLast(1, 0, n, l, r, pred);
}
};
constexpr i64 inf = 1E18;
struct Tag {
i64 cm = 0LL;
i64 add = 0LL;
void apply(const Tag &t) & {
cm = std::max(cm, t.cm - add);
add += t.add;
}
};
struct Info {
i64 max = 0LL;
void apply(const Tag &t) & {
max = std::max(max, t.cm) + t.add;
}
};
Info operator+(const Info &a, const Info &b) {
return {std::max(a.max, b.max)};
}
i64 play_game(i64 N, int Q, i64 K, std::vector<i64> L, std::vector<i64> R) {
std::vector<i64> val {0LL, K};
std::vector<std::pair<i64, int>> e;
for (int i = 0; i < Q; i++) {
R[i]++;
e.emplace_back(L[i], 1);
e.emplace_back(R[i], -1);
val.push_back(L[i] % K);
val.push_back(R[i] % K);
}
std::sort(e.begin(), e.end());
std::sort(val.begin(), val.end());
val.erase(std::unique(val.begin(), val.end()), val.end());
const int m = val.size() - 1;
LazySegmentTree<Info, Tag> seg(m);
auto work1 = [&](i64 l, i64 r, int a) {
l = std::lower_bound(val.begin(), val.end(), l) - val.begin();
r = std::lower_bound(val.begin(), val.end(), r) - val.begin();
i64 v = seg.rangeQuery(0, m).max;
seg.rangeApply(l, r, {v - a, a});
};
auto work = [&](i64 l, i64 r, int a) {
if (l == r) {
return;
}
if (l / K == (r - 1) / K) {
work1(l % K, (r - 1) % K + 1, a);
} else {
work1(l % K, K, a);
i64 t = (r - 1) / K - l / K - 1;
if (t > 0) {
i64 v = seg.rangeQuery(0, m).max;
seg.rangeApply(0, m, {v - a, a * t});
}
work1(0, (r - 1) % K + 1, a);
}
};
i64 lst = 0;
int cur = 0;
for (auto [x, t] : e) {
work(lst, x, cur);
cur += t;
lst = x;
}
return seg.rangeQuery(0, m).max;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 6
Accepted
Test #1:
score: 6
Accepted
time: 0ms
memory: 3548kb
input:
1 1 1 0 0
output:
1
result:
ok single line: '1'
Test #2:
score: 6
Accepted
time: 1ms
memory: 3552kb
input:
250000 500 1 18032 175029 101994 180534 17236 150204 19363 240816 66286 170166 40660 155563 155572 165989 36560 84766 209917 222641 67178 129065 147896 220339 181655 221539 14603 58499 52144 182663 232703 234576 101708 114632 22193 192988 71686 226463 38877 70178 13921 248563 51229 102727 109765 138...
output:
43047134
result:
ok single line: '43047134'
Test #3:
score: 6
Accepted
time: 2ms
memory: 4196kb
input:
250000 5000 1 98115 241326 12876 103121 117304 218696 116396 174228 9448 120564 30837 225165 107185 124281 85828 137912 106158 189467 29941 209692 207709 230353 146355 187817 64724 164678 104368 145949 106499 169341 30590 46690 2162 207087 70614 97313 779 200486 6666 138370 582 78745 58180 144078 58...
output:
423880930
result:
ok single line: '423880930'
Test #4:
score: 6
Accepted
time: 73ms
memory: 23096kb
input:
250000 250000 1 8800 228506 10087 37260 14874 80184 94114 152089 6811 113583 16629 76050 100831 163650 20800 54725 107410 158473 21330 178096 121807 242437 210019 228617 30570 86202 169441 183611 103542 161089 34035 215955 24336 242466 120595 160111 23111 183963 93377 115055 36812 243746 141388 2179...
output:
20836107553
result:
ok single line: '20836107553'
Test #5:
score: 6
Accepted
time: 0ms
memory: 3616kb
input:
3 5 2 0 2 0 2 1 1 1 1 1 1
output:
5
result:
ok single line: '5'
Test #6:
score: 6
Accepted
time: 0ms
memory: 3820kb
input:
100 6 50 0 99 0 70 0 10 20 30 40 50 60 70
output:
6
result:
ok single line: '6'
Test #7:
score: 6
Accepted
time: 1ms
memory: 3664kb
input:
250000 500 250000 176204 240588 178422 192741 200350 228864 10611 31982 30104 53953 85884 138540 103334 152671 70875 171575 1030 227905 46069 75425 111153 114537 14337 78805 2004 241855 107078 145330 161155 173964 135233 234237 40514 114719 78211 117900 53334 56320 157399 229765 125059 220174 104323...
output:
259
result:
ok single line: '259'
Test #8:
score: 6
Accepted
time: 1ms
memory: 3720kb
input:
250000 500 249999 163419 167010 227323 231544 6747 148619 106260 128686 152281 152431 178673 210850 178326 205961 49041 220612 35816 194213 105614 112672 40379 207523 27782 234601 68749 189368 118219 235540 166163 173035 16397 133328 23091 221881 70317 119268 38823 237586 6826 127135 76186 188480 20...
output:
249
result:
ok single line: '249'
Test #9:
score: 6
Accepted
time: 1ms
memory: 3664kb
input:
250000 500 200000 123536 208095 22801 192237 89640 207952 1493 190314 36658 194434 109288 142058 64468 134455 63232 99944 187675 213208 44725 128672 186192 208839 191648 238331 9549 204236 16554 185223 136819 174099 27885 117512 78518 240152 42428 246547 136199 193849 130309 195527 141002 157860 190...
output:
255
result:
ok single line: '255'
Test #10:
score: 6
Accepted
time: 1ms
memory: 3924kb
input:
250000 500 125000 97150 245141 18359 37807 14109 97684 101513 246263 101312 129406 92721 176379 140281 185250 95049 235575 177077 246108 152616 232113 53126 69340 124089 141620 55515 82011 109786 235437 12422 193595 30248 166870 57607 179825 9731 130445 82744 232360 146503 244777 52600 57129 951 214...
output:
395
result:
ok single line: '395'
Test #11:
score: 6
Accepted
time: 5ms
memory: 4572kb
input:
250000 5000 250000 71627 242628 105561 122356 70354 96403 197923 225795 90160 186073 38572 75199 43139 249150 29888 110247 144452 243882 75659 135492 79009 199446 50990 165885 137710 160011 52214 129804 121363 211322 217789 237535 37308 172327 33541 199561 85941 133660 14598 42494 147281 228245 3601...
output:
2491
result:
ok single line: '2491'
Test #12:
score: 6
Accepted
time: 5ms
memory: 4588kb
input:
250000 5000 249999 7263 8878 64820 236041 111512 172730 54906 244884 48520 53101 42320 136629 43938 51513 53123 165416 88598 240934 75114 226579 23441 29227 11973 67196 11127 28526 48408 128382 20498 41622 130102 175741 243163 244885 114101 161247 121405 169172 102946 247680 84962 173073 146627 2043...
output:
2564
result:
ok single line: '2564'
Test #13:
score: 6
Accepted
time: 5ms
memory: 4724kb
input:
250000 5000 200000 51664 66072 48959 96435 34890 169492 86781 215484 25559 57353 9694 65228 100790 132712 193143 245541 18816 133539 8349 155999 136016 196480 23407 184019 141790 180163 115562 157712 77832 105966 66143 137453 189463 215350 94129 228725 25171 60289 131445 170424 98494 240426 4132 399...
output:
2497
result:
ok single line: '2497'
Test #14:
score: 6
Accepted
time: 5ms
memory: 4588kb
input:
250000 5000 125000 23038 49260 22023 58481 167690 227791 61738 178456 187029 228577 93572 116406 64333 158069 14793 165402 238551 242652 5047 79698 104548 206040 16726 149100 96168 150571 161386 236224 230973 237774 28036 162383 135854 186683 63012 198599 146070 231369 81288 209694 118670 144952 474...
output:
3817
result:
ok single line: '3817'
Test #15:
score: 6
Accepted
time: 176ms
memory: 36888kb
input:
250000 250000 250000 60620 110173 65040 246046 72558 74815 127517 226469 79477 141735 128460 168084 190600 232286 65560 238023 44001 130839 163358 181710 119132 169239 84170 146100 217709 239539 17393 145138 19894 91773 157441 172001 186670 197815 225491 239190 36218 57264 15714 182492 34715 231855 ...
output:
124745
result:
ok single line: '124745'
Test #16:
score: 6
Accepted
time: 176ms
memory: 36636kb
input:
250000 250000 249999 14320 109938 179359 219442 56051 244571 162 223166 21143 168950 49266 200770 66092 84913 91215 216188 127721 238388 92189 226412 131169 178676 126841 177156 145335 187778 22986 189328 12069 220235 20462 103938 53057 131995 137853 184804 98321 220470 119523 215514 3021 226212 988...
output:
125137
result:
ok single line: '125137'
Test #17:
score: 6
Accepted
time: 173ms
memory: 36596kb
input:
250000 250000 200000 33760 94993 6740 10698 53668 53904 85694 115759 50067 185295 131978 150789 13407 188196 17091 227357 29304 81008 92548 165362 227543 244278 73411 145768 1062 149065 74815 197129 169917 237325 107297 121576 105953 197614 104138 244490 86889 209437 95594 194811 106592 222401 12141...
output:
125132
result:
ok single line: '125132'
Test #18:
score: 6
Accepted
time: 166ms
memory: 29884kb
input:
250000 250000 125000 155365 230141 71664 145795 142765 181943 65291 80464 178779 243970 215443 231707 19233 197437 12196 65435 220648 243173 81764 176788 87880 160130 22759 49190 21220 34822 133308 235294 75648 94480 34312 131370 38729 86599 6283 244932 222140 238784 42139 171595 149845 214163 79181...
output:
187548
result:
ok single line: '187548'
Test #19:
score: 6
Accepted
time: 0ms
memory: 3592kb
input:
250 8 50 0 200 40 140 49 49 50 150 100 190 149 199 199 199 75 249
output:
17
result:
ok single line: '17'
Test #20:
score: 6
Accepted
time: 1ms
memory: 3724kb
input:
250000 500 124999 202167 239352 145385 187212 127053 154487 80970 104309 138238 218833 101431 140899 57206 194492 82251 121831 79777 234877 77928 133230 89304 166621 191615 243921 28689 91204 36161 150495 15876 139089 64428 72070 193471 243745 27069 118471 187721 236132 87779 235327 133035 219325 16...
output:
378
result:
ok single line: '378'
Test #21:
score: 6
Accepted
time: 1ms
memory: 3724kb
input:
250000 500 80000 31169 80004 213897 223686 47854 53407 18822 204877 130674 212333 88127 118299 33431 130873 72876 146241 146009 152052 75491 171304 77460 104773 14068 115131 79714 243294 19491 104389 11293 45595 143313 161164 22966 220518 82140 99925 51026 91822 174072 234865 122934 139387 154536 18...
output:
561
result:
ok single line: '561'
Test #22:
score: 6
Accepted
time: 1ms
memory: 3656kb
input:
250000 500 50000 18694 218026 2905 104864 166883 194819 81792 224197 176732 181963 37122 197374 121489 147220 124571 237780 50216 248769 10908 210565 151063 190781 16447 157083 29671 228523 94419 200132 84784 123472 123573 237865 4575 212124 132927 145501 54340 160781 18487 191887 50426 161525 49524...
output:
896
result:
ok single line: '896'
Test #23:
score: 6
Accepted
time: 5ms
memory: 4668kb
input:
250000 5000 124999 20072 192376 10963 131847 73194 83026 24876 158789 41441 175375 35863 207040 51738 134658 3956 98779 109445 128883 37135 150695 91822 103350 47311 176275 151687 231043 33039 231518 69700 211172 71985 129675 29661 230697 22683 100704 215895 232127 50594 92892 88251 187157 91185 169...
output:
3732
result:
ok single line: '3732'
Test #24:
score: 6
Accepted
time: 5ms
memory: 4576kb
input:
250000 5000 80000 58445 58514 73588 155199 19190 237584 15021 162061 35587 208042 67347 82938 33520 66905 94077 243548 195993 205248 75063 135194 186766 241449 81432 249529 44646 189754 88533 209397 65768 95668 203551 212985 69509 200644 164292 244507 8032 90528 95921 181272 66270 69585 147614 23028...
output:
5410
result:
ok single line: '5410'
Test #25:
score: 6
Accepted
time: 5ms
memory: 4644kb
input:
250000 5000 50000 147922 234945 21624 140865 106643 119709 65334 92686 63183 249259 207994 239187 34137 59757 217035 234086 18811 247852 9431 44749 2312 212491 754 81472 21009 151931 31913 210230 45791 232667 49762 143942 161988 163751 131071 152579 161346 243080 151225 235662 36507 100316 72962 107...
output:
8484
result:
ok single line: '8484'
Test #26:
score: 6
Accepted
time: 166ms
memory: 30028kb
input:
250000 250000 124999 2677 247927 138954 176621 48093 160975 31941 70764 14697 67489 67922 197029 206137 223917 78557 172748 224255 232123 180464 189779 139566 213491 95564 116734 102813 121816 43784 62815 39827 176929 19447 168743 6999 223343 8998 232118 46834 159161 161331 204990 34628 84036 53464 ...
output:
187734
result:
ok single line: '187734'
Test #27:
score: 6
Accepted
time: 159ms
memory: 29512kb
input:
250000 250000 80000 96974 155381 66922 180127 199833 214041 3309 41042 98132 110413 177414 219757 15495 148058 67155 133626 3716 100008 29721 223138 83361 216709 6250 155592 15544 51215 63423 181443 93375 173268 168019 176606 106991 196501 104870 156550 13980 211375 8047 181803 142157 168375 116442 ...
output:
272854
result:
ok single line: '272854'
Test #28:
score: 6
Accepted
time: 162ms
memory: 26400kb
input:
250000 250000 50000 94789 175611 35445 112826 44813 81011 29121 150274 237328 247123 93705 238342 64546 227133 206252 214787 7854 170918 36277 94641 152125 229387 8629 143371 1172 90200 105646 166672 68151 221823 188939 248499 119598 175735 70668 219911 52889 123735 187862 215425 20902 159971 11774 ...
output:
425032
result:
ok single line: '425032'
Test #29:
score: 6
Accepted
time: 0ms
memory: 3792kb
input:
250 8 49 0 200 40 140 49 49 50 150 100 190 149 199 199 199 75 249
output:
19
result:
ok single line: '19'
Test #30:
score: 6
Accepted
time: 1ms
memory: 3664kb
input:
250000 500 49999 4856 88090 139361 228192 240059 244612 47502 191290 112927 127924 178802 182492 105595 220475 100898 116876 64153 212289 138445 155491 326 187713 55090 209500 51706 144390 3587 30604 42831 186525 113819 242213 234615 249736 107104 127430 62111 124209 3762 229069 112276 208717 95429 ...
output:
851
result:
ok single line: '851'
Test #31:
score: 6
Accepted
time: 0ms
memory: 3924kb
input:
250000 500 10000 214880 236399 19044 114605 49616 171832 113563 173539 213805 224646 57927 221634 97055 123005 200467 207828 11650 227418 22121 186119 145754 169541 22333 143818 112432 139053 158301 215017 211519 228499 143480 213736 29309 203769 18275 86874 20365 201897 49623 114619 23094 142740 87...
output:
4304
result:
ok single line: '4304'
Test #32:
score: 6
Accepted
time: 1ms
memory: 3852kb
input:
250000 500 9999 196493 232984 157804 162234 5426 103536 14063 246449 37693 158374 69289 80016 112920 173222 46043 167040 105978 130954 54368 86857 22267 128013 98932 202488 73617 82185 27759 108008 72315 158294 7143 177374 126785 249785 18069 75169 30671 201996 130297 156254 6575 32004 110412 204893...
output:
4205
result:
ok single line: '4205'
Test #33:
score: 6
Accepted
time: 1ms
memory: 3868kb
input:
250000 500 500 61864 236241 66529 100680 94892 233136 10323 185845 9152 66013 80027 224568 199286 245110 31336 165225 123538 129936 130976 141995 81153 104381 25577 226847 3416 15939 21853 221798 28791 76159 8357 64730 19666 23702 78583 193717 70903 97900 80946 214280 136487 249078 149022 208747 335...
output:
85305
result:
ok single line: '85305'
Test #34:
score: 6
Accepted
time: 0ms
memory: 3896kb
input:
250000 500 499 100413 222362 30474 48086 71462 147287 193528 222150 25352 152182 145078 181561 21371 100600 22435 234926 77064 178502 41594 244078 38315 173597 35702 223691 101061 116525 129909 166573 29528 193613 131696 187560 124827 190329 47065 169631 12972 189480 63854 102657 142923 176736 65398...
output:
83839
result:
ok single line: '83839'
Test #35:
score: 6
Accepted
time: 1ms
memory: 3856kb
input:
250000 500 100 37057 96123 31658 203038 42863 55695 43593 111382 24436 59778 351 149923 194605 196546 60015 225040 137456 205949 175131 242372 92057 174837 144798 181396 92303 127255 55021 220756 9269 166522 92503 169220 126389 180747 62063 190987 8116 9761 5614 109311 32003 215965 149005 235968 519...
output:
417259
result:
ok single line: '417259'
Test #36:
score: 6
Accepted
time: 5ms
memory: 4568kb
input:
250000 5000 49999 168482 237534 6635 218085 173533 198381 98040 246536 73275 237371 8545 171197 18493 37186 51799 200867 70297 235424 102405 103576 115225 206072 64028 231019 102689 179209 113438 127121 76245 181005 26658 163190 82009 184259 62254 102762 88958 116935 106904 194743 53373 194357 88847...
output:
8447
result:
ok single line: '8447'
Test #37:
score: 6
Accepted
time: 5ms
memory: 4068kb
input:
250000 5000 10000 112031 243012 3414 181471 117995 135203 56918 62007 192807 212233 109604 137461 52907 192610 130725 203502 62102 134207 19506 134665 116314 245871 219137 242378 62453 189972 28678 34511 68759 231348 106042 204199 98958 152251 133693 145636 203184 212443 223805 228383 111034 169796 ...
output:
42100
result:
ok single line: '42100'
Test #38:
score: 6
Accepted
time: 5ms
memory: 4260kb
input:
250000 5000 9999 179096 188235 22037 245896 131998 173030 93928 246022 1773 16098 14324 154923 77011 148072 48852 214924 96684 152927 93141 175758 63515 179342 219122 235749 4360 177004 35777 111583 92840 143199 156018 174618 98118 111500 62451 102750 33583 147072 32647 208052 42248 248696 75014 163...
output:
41063
result:
ok single line: '41063'
Test #39:
score: 6
Accepted
time: 4ms
memory: 3932kb
input:
250000 5000 500 51436 207217 43493 215603 38641 192285 75153 114606 66406 172091 8879 149631 10204 222880 20048 157600 11350 131336 216620 228445 7387 68548 35013 84589 144909 172562 31539 142158 131347 204928 36625 200590 126476 214464 194221 197155 47696 89136 93069 194676 13154 69454 121807 23995...
output:
839922
result:
ok single line: '839922'
Test #40:
score: 6
Accepted
time: 5ms
memory: 3924kb
input:
250000 5000 499 110057 237711 10378 178792 85819 102830 25585 163516 12384 138391 8727 221521 206403 211219 5375 217913 6577 19539 13156 44555 88391 135323 53249 56644 113551 210738 128161 207498 100882 161694 44512 78280 81984 248702 6375 241014 32602 53686 166010 213336 180677 228188 120551 237888...
output:
828834
result:
ok single line: '828834'
Test #41:
score: 6
Accepted
time: 4ms
memory: 3988kb
input:
250000 5000 100 41667 125567 3330 137440 211286 217728 52892 90965 107530 190778 3331 124875 118041 172693 143761 148991 124302 189140 231838 241579 92196 132268 11694 237983 13500 229114 20041 140260 62362 101293 180411 199397 156661 211894 63622 152495 20387 222407 21290 110520 144689 214474 46323...
output:
4149936
result:
ok single line: '4149936'
Test #42:
score: 6
Accepted
time: 157ms
memory: 26120kb
input:
250000 250000 49999 87611 197685 71604 194034 20841 159266 51096 138038 69450 180892 11389 194356 72516 178236 197478 236344 136356 173510 70281 92964 15326 60211 21930 175266 68906 115755 39762 129520 59847 117470 144279 181161 116499 122480 22352 222283 94984 112145 75288 216893 34915 97784 85196 ...
output:
425954
result:
ok single line: '425954'
Test #43:
score: 6
Accepted
time: 148ms
memory: 24756kb
input:
250000 250000 10000 43345 190866 43398 198395 91039 246085 1553 144429 103165 148464 16203 97270 57361 225046 20504 123531 16917 238654 142325 171253 45954 172934 10654 238099 51094 157634 34234 185620 217956 244260 141235 158361 55318 167174 166158 226385 23845 45781 41271 153853 73484 207527 17232...
output:
2081340
result:
ok single line: '2081340'
Test #44:
score: 6
Accepted
time: 140ms
memory: 23532kb
input:
250000 250000 9999 69208 174918 73634 227902 223270 248072 90970 241427 24548 50403 111552 180498 8696 191519 27297 201820 134352 209041 59234 96839 129028 222750 68136 139597 76069 246024 113453 234858 18864 133073 26266 185977 191460 223610 59448 75768 105859 154850 60023 170070 8452 244419 106390...
output:
2084319
result:
ok single line: '2084319'
Test #45:
score: 6
Accepted
time: 122ms
memory: 23080kb
input:
250000 250000 500 75334 212194 111320 226192 22067 189626 182115 208361 195366 242097 55349 108997 50258 183346 48378 178802 156349 208294 199879 200406 83393 123827 98487 116317 32010 234185 164522 165911 91194 238901 27521 215767 22099 93282 16533 208788 88563 92323 48093 192316 135065 223588 7609...
output:
41600331
result:
ok single line: '41600331'
Test #46:
score: 6
Accepted
time: 130ms
memory: 23732kb
input:
250000 250000 499 113884 150912 107969 212313 2177 219441 167374 175998 14375 41001 29508 141518 9073 76520 158200 166988 65505 103478 4843 100005 137983 190463 80457 223909 20118 132596 12167 41318 150136 192134 28258 121810 42612 119120 10823 63948 64477 231588 60893 173475 5832 124072 135107 1758...
output:
41713026
result:
ok single line: '41713026'
Test #47:
score: 6
Accepted
time: 104ms
memory: 23084kb
input:
250000 250000 100 17824 76188 30533 86074 203674 235750 162789 241632 42722 120903 34352 72284 1694 77862 43696 207481 50814 199658 50783 187989 127548 191702 27651 34268 108374 172708 38361 249133 31200 246317 159333 197957 24064 163265 87165 122042 195673 206908 115235 129529 53066 130725 42160 48...
output:
208116142
result:
ok single line: '208116142'
Subtask #2:
score: 2
Accepted
Test #48:
score: 2
Accepted
time: 0ms
memory: 3620kb
input:
1000000000000 2 1 0 999999999999 0 999999999999
output:
2000000000000
result:
ok single line: '2000000000000'
Test #49:
score: 2
Accepted
time: 1ms
memory: 3680kb
input:
1000000000000 500 1 527513625833 530840786800 647452909306 949600639479 31806145281 650067061607 553077890363 630839559971 257074666199 821047850133 40471877454 201059651806 803554707022 898136081520 471301438903 727946340638 264120737467 760504330624 907943458863 964032452524 429831669748 436619668...
output:
170256829357459
result:
ok single line: '170256829357459'
Test #50:
score: 2
Accepted
time: 1ms
memory: 3680kb
input:
1000000000000 500 1 414 999999999862 339 999999999592 110 999999999609 65 999999999687 201 999999999683 476 999999999660 27 999999999601 99 999999999861 154 999999999840 381 999999999680 418 999999999766 467 999999999594 328 999999999839 324 999999999876 228 999999999732 12 999999999519 151 99999999...
output:
499999999756043
result:
ok single line: '499999999756043'
Test #51:
score: 2
Accepted
time: 0ms
memory: 3668kb
input:
1000000000000 500 1 0 999999999999 0 999999999999 0 999999999999 0 999999999999 0 999999999999 0 999999999999 0 999999999999 0 999999999999 0 999999999999 0 999999999999 0 999999999999 0 999999999999 0 999999999999 0 999999999999 0 999999999999 0 999999999999 0 999999999999 0 999999999999 0 99999999...
output:
500000000000000
result:
ok single line: '500000000000000'
Test #52:
score: 2
Accepted
time: 2ms
memory: 4032kb
input:
1000000000000 5000 1 221556197091 291816057384 148769055147 275292703709 534309543008 824106987357 78364289194 141984928287 250487454460 735122717003 738050503381 855545135847 369599220819 764293495846 400040673548 588081233660 518776974 861872533120 131602584518 813182000883 35688052931 65622312854...
output:
1660567231836695
result:
ok single line: '1660567231836695'
Test #53:
score: 2
Accepted
time: 2ms
memory: 3936kb
input:
1000000000000 5000 1 684 999999997778 1255 999999995923 186 999999996399 1894 999999999460 3812 999999997356 1756 999999998768 354 999999996804 2652 999999998655 2504 999999996983 4708 999999995686 2398 999999998054 1085 999999998326 728 999999996050 3622 999999997692 1535 999999999997 4353 99999999...
output:
4999999974797344
result:
ok single line: '4999999974797344'
Test #54:
score: 2
Accepted
time: 1ms
memory: 3928kb
input:
1000000000000 5000 1 0 999999999999 0 999999999999 0 999999999999 0 999999999999 0 999999999999 0 999999999999 0 999999999999 0 999999999999 0 999999999999 0 999999999999 0 999999999999 0 999999999999 0 999999999999 0 999999999999 0 999999999999 0 999999999999 0 999999999999 0 999999999999 0 9999999...
output:
5000000000000000
result:
ok single line: '5000000000000000'
Test #55:
score: 2
Accepted
time: 90ms
memory: 24756kb
input:
1000000000000 250000 1 236177530578 673136242266 248319786421 549057238550 459752478411 572309112542 226890967260 458031457160 151110476596 639062902378 324653264944 627910197907 14880272367 315630033255 240100010106 955415705404 168489956211 508526888692 89621094054 319031766833 688000331282 716851...
output:
83326370007046216
result:
ok single line: '83326370007046216'
Test #56:
score: 2
Accepted
time: 85ms
memory: 23960kb
input:
1000000000000 250000 1 68879 999999808782 76483 999999803402 205232 999999849112 223445 999999891538 56925 999999790929 111672 999999870842 147863 999999752623 113911 999999999025 52704 999999986166 129439 999999796783 172785 999999771286 92737 999999850681 95029 999999829161 169669 999999985298 851...
output:
249999937551812170
result:
ok single line: '249999937551812170'
Test #57:
score: 2
Accepted
time: 36ms
memory: 23640kb
input:
1000000000000 250000 1 0 999999999999 0 999999999999 0 999999999999 0 999999999999 0 999999999999 0 999999999999 0 999999999999 0 999999999999 0 999999999999 0 999999999999 0 999999999999 0 999999999999 0 999999999999 0 999999999999 0 999999999999 0 999999999999 0 999999999999 0 999999999999 0 99999...
output:
250000000000000000
result:
ok single line: '250000000000000000'
Subtask #3:
score: 13
Accepted
Test #58:
score: 13
Accepted
time: 1ms
memory: 3724kb
input:
1000000000000 500 700000000000 489537143769 630143286953 260425914571 671352459669 442325411396 997637458393 437240212342 479801508680 171199409565 885024134315 335757811617 912510646664 255044472489 455548540270 529689058580 898532986737 266612500614 411414634748 267273797534 728080538500 289244868...
output:
267
result:
ok single line: '267'
Test #59:
score: 13
Accepted
time: 1ms
memory: 3852kb
input:
1000000000000 500 500000000001 194852823461 704113805972 34798761374 711805505973 187861934474 873915161262 658388472683 929907019818 130479073221 146446988785 859760468428 961670921726 92024157306 430278895924 763041517261 803265263971 343603995575 790751364135 132826556180 159881405749 29421305318...
output:
383
result:
ok single line: '383'
Test #60:
score: 13
Accepted
time: 1ms
memory: 3648kb
input:
1000000000000 500 500000000000 353283711292 753390242754 409444130277 834048019276 136449811215 900733029718 408212343841 493085316508 751745690257 831607381974 696468817923 801174250431 263605120800 634603212011 604100085622 985207804422 244312071685 619370007034 18359382761 818967723620 3086054926...
output:
383
result:
ok single line: '383'
Test #61:
score: 13
Accepted
time: 5ms
memory: 4592kb
input:
1000000000000 5000 700000000000 167112082201 519810929528 644002304026 657844552359 488029718627 527169731318 126245462613 560250589445 350067045189 609412882817 717210796926 888884060262 527884877134 531084241333 592372293787 949684326959 457211426738 730405434187 157034882680 257644454218 32743329...
output:
2580
result:
ok single line: '2580'
Test #62:
score: 13
Accepted
time: 5ms
memory: 4668kb
input:
1000000000000 5000 500000000001 358895222803 877080421292 199572601885 464590560400 664968695009 973432737373 76549596424 296994474567 180944425353 864800003209 449917619557 691379188561 183262867467 846668223869 524822778277 736277089790 552060514228 897623552349 143905897659 877282194113 299338709...
output:
3807
result:
ok single line: '3807'
Test #63:
score: 13
Accepted
time: 5ms
memory: 4596kb
input:
1000000000000 5000 500000000000 610301442249 671054791814 10028123108 775611211147 802262773901 961920478317 931068507707 935972324946 750125742770 981887898313 419892793123 538441388471 211185419550 329301029354 44977618039 977539530554 782621249987 796045088923 129758833910 427807270527 3448236020...
output:
3783
result:
ok single line: '3783'
Test #64:
score: 13
Accepted
time: 286ms
memory: 51632kb
input:
1000000000000 250000 700000000000 407005708715 413426131017 161250312899 418233569227 145811583980 510120760333 173376542214 351624468911 27741679251 614866178405 670984905443 947360052732 173105671419 480730661652 212421185474 215029518110 301341595120 358442267926 103235366621 231470654168 1000956...
output:
127615
result:
ok single line: '127615'
Test #65:
score: 13
Accepted
time: 307ms
memory: 51240kb
input:
1000000000000 250000 500000000001 586853050117 670307732924 730254816703 822829614036 292512059220 601486142677 191047395972 347668538921 144387761689 252309757913 720145180506 869784940580 280855570661 701403295526 82907019536 150296765321 583204792015 684973291803 180226861582 663271521417 1399797...
output:
187291
result:
ok single line: '187291'
Test #66:
score: 13
Accepted
time: 283ms
memory: 51340kb
input:
1000000000000 250000 500000000000 672984262706 992319340739 188885048348 884390737238 208540127449 751993497197 101787377376 254720040236 707566058379 974324926910 454943076702 527906333424 493586277259 605962301721 273439494579 350326114111 428558327672 517886901998 80934937692 526044465725 8347108...
output:
187153
result:
ok single line: '187153'
Subtask #4:
score: 15
Accepted
Dependency #3:
100%
Accepted
Test #67:
score: 15
Accepted
time: 0ms
memory: 3668kb
input:
1000000000000 500 499999999999 309210527781 962617830045 891540831305 922889060510 282398167485 836515138094 461126252974 503547757913 732170639416 835959596831 378134160849 887696610735 845407096412 928667461503 572838609690 903921134080 10910861427 364920467198 628300475382 849108610124 7436976513...
output:
361
result:
ok single line: '361'
Test #68:
score: 15
Accepted
time: 1ms
memory: 3696kb
input:
1000000000000 500 300000000000 396200490960 981157655752 871871007800 950873025053 780562703504 920628006064 515674014359 670488763983 79912327730 180160912171 513669158118 829485073542 375969736642 648754291572 409035411650 726079129246 30476674 70666745144 104526378150 893193910720 62745101924 216...
output:
572
result:
ok single line: '572'
Test #69:
score: 15
Accepted
time: 1ms
memory: 3660kb
input:
1000000000000 500 200000000001 356344958892 752274337466 124028653743 829872864314 362769086249 609854059819 10911840172 786158987414 506356105622 527424329913 413462370554 823481441992 483604683798 835194750371 664261433196 963798511704 116001379564 519090825265 670960107755 800100937563 1979406952...
output:
868
result:
ok single line: '868'
Test #70:
score: 15
Accepted
time: 1ms
memory: 3720kb
input:
1000000000000 500 200000000000 7975524209 150319329414 435049304489 640328385538 406124287836 659720869557 420233020554 874629535990 307299578582 375895293665 342287801017 674838609198 317827555856 511527235880 416515263982 940402152934 10127948842 712796785216 258339959977 827103616918 243425587750...
output:
863
result:
ok single line: '863'
Test #71:
score: 15
Accepted
time: 2ms
memory: 4640kb
input:
1000000000000 5000 499999999999 194900186166 560904342312 418085038298 735846292337 95029654594 407383776810 34064457382 110873295101 130774812147 668191742951 557770281806 993656579003 331567156715 643899484121 169219176842 617877413043 863554183527 971364020843 606151194863 865363451420 1423775286...
output:
3733
result:
ok single line: '3733'
Test #72:
score: 15
Accepted
time: 5ms
memory: 4656kb
input:
1000000000000 5000 300000000000 357623931818 767178511354 59396055473 844818540533 440674538000 616130752434 231894258258 932186005395 59361017239 262026551990 387513126236 530661514934 696243484673 939670682153 27332608445 802663467318 51139646514 779880817678 91559581604 319615333428 104388309251 ...
output:
5696
result:
ok single line: '5696'
Test #73:
score: 15
Accepted
time: 5ms
memory: 4580kb
input:
1000000000000 5000 200000000001 737823719552 938126560881 541811584914 554400315815 123670464953 518900042898 875343310506 923553449480 33877878375 565255015736 185535617636 505692056213 22245214237 753942654910 190013970750 886579993188 220269269179 518385085114 140984070706 659126419478 5480609214...
output:
8687
result:
ok single line: '8687'
Test #74:
score: 15
Accepted
time: 5ms
memory: 4636kb
input:
1000000000000 5000 200000000000 64130294662 991697964958 712831203647 912161986522 241618010960 430633143832 710232096447 902161178962 91578536618 719038271564 281639695514 806802234672 926804220432 962378394212 72817500936 394338286837 65622804835 383858503821 559834495588 962607271911 75132695417 ...
output:
8581
result:
ok single line: '8581'
Test #75:
score: 15
Accepted
time: 291ms
memory: 51332kb
input:
1000000000000 250000 499999999999 111452989316 348906443205 16953021470 230457539092 115659690365 606500089564 460431334466 732131408446 174631653465 507183835205 456006605887 832619999373 672430199624 855117997917 284778166565 725898130451 111691840748 700341087864 69736616468 235535428791 78951447...
output:
187148
result:
ok single line: '187148'
Test #76:
score: 15
Accepted
time: 290ms
memory: 51296kb
input:
1000000000000 250000 300000000000 171338268242 742250374182 247642491395 450535682384 27147447264 638779021402 333506471217 478124320043 378427435344 955174107960 283970912066 736814112594 244142582959 481090545300 37424805145 883433617303 612511151022 652605927302 459279121025 775482894414 16376573...
output:
285249
result:
ok single line: '285249'
Test #77:
score: 15
Accepted
time: 303ms
memory: 51396kb
input:
1000000000000 250000 200000000001 75499693827 517662023193 410680150317 504095104634 513483893368 847848868987 748609293098 775647551402 265582749894 681995735724 126403114678 241112504708 380883757736 657922886288 116858032465 831125454267 809726573297 867737172568 223906974535 411630858268 2480524...
output:
425209
result:
ok single line: '425209'
Test #78:
score: 15
Accepted
time: 303ms
memory: 51504kb
input:
1000000000000 250000 200000000000 119926144983 769068242639 200359553543 773966012277 319644447295 648414064300 68304367414 382683326238 155203456751 550008398838 92469671914 927346587638 144850659069 314004155495 569574784743 863342973646 143877892306 699558175279 397483794519 417612934486 25668259...
output:
425285
result:
ok single line: '425285'
Subtask #5:
score: 16
Accepted
Test #79:
score: 16
Accepted
time: 0ms
memory: 3608kb
input:
1000000000000 500 199999999999 706819024629 963292506311 230674270029 335986697877 629242014470 656530582138 169121845078 356297897421 427332409502 950785188805 136568479540 890773747341 128873878004 517715625255 592265122313 992654704254 159253384693 445902398415 851956611956 861825483439 160403414...
output:
864
result:
ok single line: '864'
Test #80:
score: 16
Accepted
time: 1ms
memory: 3900kb
input:
1000000000000 500 100000000000 272323512948 876909859341 96266942788 480223789703 334864447364 861589302699 325594014972 803215035453 87608278271 364850838319 353648949489 800759184418 131376279849 983216951309 393479782973 675184336374 322642752282 577854959978 668790459667 823645374313 13069087570...
output:
1605
result:
ok single line: '1605'
Test #81:
score: 16
Accepted
time: 1ms
memory: 3720kb
input:
1000000000000 500 4294967297 361361843389 505957754249 173502650155 450139628382 307776752485 523122662955 572227757506 689879411690 26988796889 880545253351 568235993242 841670543149 363414955392 890521057370 421644498551 856112556360 132502352971 407368638109 321396087923 475738934928 771443377 28...
output:
39047
result:
ok single line: '39047'
Test #82:
score: 16
Accepted
time: 0ms
memory: 3764kb
input:
1000000000000 500 10000000 23205082304 378610984600 681466629438 967272575088 38777092712 370779442727 121718166773 592019594314 927243158567 974777145554 755394842194 794458702107 430368258812 998357610192 123015395127 788942813975 488054668401 845277323213 115000307012 860830829371 349392377108 44...
output:
17019195
result:
ok single line: '17019195'
Test #83:
score: 16
Accepted
time: 1ms
memory: 3900kb
input:
1000000000000 500 1000000 240445009658 670515555923 611100611029 969730816794 112894087241 815829610735 67666081246 179942653199 906608648847 963138395401 818944940090 899601771253 887843185065 932699214476 116163379425 843260266891 720790915671 989377809824 422534466524 766162485543 814246251338 86...
output:
165714766
result:
ok single line: '165714766'
Test #84:
score: 16
Accepted
time: 1ms
memory: 3724kb
input:
1000000000000 500 1000000 580089376037 881578626036 245045176718 815594896258 196866019011 702177032023 40848212789 425823814745 282272969508 380285127966 88442011189 241480378409 28140208281 679407445763 615873016039 916134030635 119609423821 875437380014 600911265320 865454409433 170106968920 2828...
output:
169559515
result:
ok single line: '169559515'
Test #85:
score: 16
Accepted
time: 1ms
memory: 3604kb
input:
1000000000000 500 1000000 530812939255 555272050926 616014265323 878989742407 248278142270 579934518720 14030344332 675999943586 560257800511 817106831276 349349147696 620213761373 123581202086 512121449564 433930475587 716104681844 66938620166 286695813626 774993096820 964746333323 483965801480 755...
output:
172007624
result:
ok single line: '172007624'
Test #86:
score: 16
Accepted
time: 1ms
memory: 3656kb
input:
1000000000000 500 1000000 233260443112 477241535177 457583377491 504344373504 336545041337 466281940009 926176072427 954652667364 258223501882 875097407322 577696475691 998947144338 219022195891 299390742966 243398000543 516075333054 217290117214 425517362215 64038257213 912220152511 187586218974 83...
output:
173514821
result:
ok single line: '173514821'
Test #87:
score: 16
Accepted
time: 1ms
memory: 3732kb
input:
1000000000000 500 100000 214903285970 257928090489 455470994666 944149779217 565595430678 751821512869 99795001538 649857754913 665529149770 984145970109 124309106402 308418337887 205243014846 659997639480 363281297976 847668890089 271237081660 457557940956 167339854644 978198165155 580464884433 651...
output:
1756217992
result:
ok single line: '1756217992'
Test #88:
score: 16
Accepted
time: 1ms
memory: 3928kb
input:
1000000000000 500 5000 895582499272 907191508083 459363680762 908785861292 65097701103 755228620162 82336664140 844035173515 371037937481 543563292447 520185954382 824805899067 14866291920 804448283827 9623301139 483163674610 435985055953 898956211293 98472653169 819883526822 325656834889 4117571667...
output:
32943112646
result:
ok single line: '32943112646'
Test #89:
score: 16
Accepted
time: 1ms
memory: 3664kb
input:
1000000000000 500 500 132321358147 938095993841 432733701901 590575206821 963835784725 992231721157 179182697350 818059867875 167797284899 970856500489 162218008320 547854677933 228155607413 771184153569 376379621604 827172694330 193132292340 996023813560 168980196059 685346136872 249244097117 44205...
output:
344991069029
result:
ok single line: '344991069029'
Test #90:
score: 16
Accepted
time: 0ms
memory: 3804kb
input:
1000000000000 500 69 421302115805 771097069986 519506184208 977654162122 349259700652 900797501026 469980161082 673447771905 362219814948 522514764904 192507824966 219349525747 38416133985 341503039413 657943663885 662844244617 223803020647 614863622638 408011257382 864372778744 454003412234 7303740...
output:
2358732672999
result:
ok single line: '2358732672999'
Test #91:
score: 16
Accepted
time: 1ms
memory: 3556kb
input:
1000000000000 500 2 155 999999999911 310 999999999683 176 999999999713 122 999999999952 304 999999999749 121 999999999547 436 999999999977 274 999999999968 224 999999999603 151 999999999850 417 999999999726 454 999999999876 496 999999999889 275 999999999600 413 999999999781 400 999999999967 380 9999...
output:
249999999874548
result:
ok single line: '249999999874548'
Test #92:
score: 16
Accepted
time: 1ms
memory: 3660kb
input:
999999999589 499 499 407 999999999541 432 999999999575 451 999999999554 50 999999999203 268 999999999527 245 999999999154 69 999999999550 346 999999999133 166 999999999500 15 999999999469 27 999999999384 185 999999999386 246 999999999136 479 999999999174 63 999999999225 191 999999999352 174 99999999...
output:
501002003685
result:
ok single line: '501002003685'
Test #93:
score: 16
Accepted
time: 0ms
memory: 3572kb
input:
999999999876 500 500 140 999999999660 31 999999999654 465 999999999737 218 999999999598 379 999999999646 149 999999999489 193 999999999684 6 999999999721 419 999999999850 120 999999999392 142 999999999804 126 999999999748 132 999999999543 316 999999999830 42 999999999417 113 999999999845 271 9999999...
output:
499999999802
result:
ok single line: '499999999802'
Subtask #6:
score: 7
Accepted
Dependency #5:
100%
Accepted
Test #94:
score: 7
Accepted
time: 6ms
memory: 4732kb
input:
1000000000000 5000 199999999999 351759179235 581552722139 270319377684 950221833945 305687707529 508266103302 543399944095 918729988909 730548937163 980607260343 547294708998 601326701313 271924904525 624318053422 212853505458 787092034261 76663637 922098045779 539908766675 621570751015 543603884660...
output:
8568
result:
ok single line: '8568'
Test #95:
score: 7
Accepted
time: 3ms
memory: 4572kb
input:
1000000000000 5000 100000000000 446806735843 964328630238 633980623701 724326033297 648511278882 835342018972 27569000995 405682143373 265422960115 721614012443 207324078350 609304899445 417376990610 906074435941 679952857575 718115471637 855675478458 973824199923 685186988888 821152818119 301268861...
output:
16796
result:
ok single line: '16796'
Test #96:
score: 7
Accepted
time: 3ms
memory: 4660kb
input:
1000000000000 5000 4294967297 103507321835 360757815194 472826358651 608971189476 408539449724 645879980433 122938700603 371376310663 32461805194 981302499421 591088357868 727352661525 182271879412 677108194858 140312496463 951175887979 563919232639 828309766568 294274513641 298539774350 62088858255...
output:
390509
result:
ok single line: '390509'
Test #97:
score: 7
Accepted
time: 8ms
memory: 4660kb
input:
1000000000000 5000 10000000 283768853428 906386774452 446020027594 819342696734 10665693976 340880693249 425244075384 693134634234 149841310415 837575287877 265836083236 770458674567 150557638546 292049981259 132468158267 520217043186 4836741983 226401955845 137686719782 772534413139 390658863243 39...
output:
168705620
result:
ok single line: '168705620'
Test #98:
score: 7
Accepted
time: 8ms
memory: 4584kb
input:
1000000000000 5000 1000000 18798648124 69189173012 5962123985 310560020236 74771278881 796455468999 198051533851 310174800471 148987692817 509125647083 365532271266 846278743661 5209777080 179443463308 419368741292 459241614628 112992086221 561270458040 37600168071 918951203286 92091268132 409246812...
output:
1652009138
result:
ok single line: '1652009138'
Test #99:
score: 7
Accepted
time: 8ms
memory: 4596kb
input:
1000000000000 5000 1000000 780928177758 970077229672 516585649713 694941473239 268610724954 967625432471 17517984459 563977500711 289564964295 623799907522 45335270700 518470071356 76384346617 729370466335 431319062545 929797213207 218865516943 248274962494 843894208120 928803299739 359466952984 541...
output:
1662145243
result:
ok single line: '1662145243'
Test #100:
score: 7
Accepted
time: 8ms
memory: 4588kb
input:
1000000000000 5000 1000000 525226991015 925650778516 420775598300 718316311895 167060237158 458155203731 724861168447 934198434866 425847268477 734179200666 240096830444 667112904150 110704140347 251032628146 366541734654 472785493633 329033914961 976429210052 609038505064 942950363487 355131803597 ...
output:
1644569507
result:
ok single line: '1644569507'
Test #101:
score: 7
Accepted
time: 8ms
memory: 4664kb
input:
1000000000000 5000 1000000 273820771569 885519294657 114049914850 924341941373 370790009141 615139873995 336979177534 427909385139 557834605364 890003204210 439153357484 856905480048 173288775292 805254598469 334324215275 983213965547 439202312979 663433714506 378477769305 920242651428 309646911106 ...
output:
1658084490
result:
ok single line: '1658084490'
Test #102:
score: 7
Accepted
time: 8ms
memory: 4600kb
input:
1000000000000 5000 100000 280049110003 960699054749 23960156600 565137758215 157497552758 944007669980 294655912437 999046472184 117660075821 535322155710 203058426892 409683625968 489760803299 520276380021 92541644891 845776502272 331704039323 356344926494 393697333237 661390095914 223953090206 834...
output:
16956936144
result:
ok single line: '16956936144'
Test #103:
score: 7
Accepted
time: 7ms
memory: 3972kb
input:
1000000000000 5000 2500 160613939456 419759817789 394618823108 571265224741 237962772460 550859039057 206009387481 986691533460 49024216842 896831845903 674770581804 715364550871 341490317047 437545725747 126924352607 862769278491 468959904793 733547005402 191924800392 728927171780 529495113038 7623...
output:
662696863123
result:
ok single line: '662696863123'
Test #104:
score: 7
Accepted
time: 2ms
memory: 3996kb
input:
1000000000000 5000 500 460285738765 477955170989 15284509941 371054370221 233317540672 750607336131 43012430907 468228768741 227581848028 457164853607 418763185779 563004131666 122562458474 569122107694 297963000792 996050562168 239311099109 430069218755 679503492011 876604404451 110108654919 929076...
output:
3309838481916
result:
ok single line: '3309838481916'
Test #105:
score: 7
Accepted
time: 2ms
memory: 3936kb
input:
1000000000000 5000 69 184747019669 351916518318 554357291915 956051559767 286226013885 383748512238 539829607337 842175452666 195004636522 698043675443 275406832404 767214922122 4456087123 26991406461 330516976794 545917243972 840854225337 874158688556 496588717162 632997819759 745079337476 94245034...
output:
24444015351358
result:
ok single line: '24444015351358'
Test #106:
score: 7
Accepted
time: 2ms
memory: 3932kb
input:
1000000000000 5000 2 1935 999999999777 278 999999995020 3477 999999999515 4392 999999996731 4279 999999996040 2246 999999995924 79 999999999931 2485 999999998676 1394 999999995512 1724 999999997400 1972 999999996560 1744 999999998997 2217 999999995895 4152 999999995391 1253 999999998920 2785 9999999...
output:
2499999987459039
result:
ok single line: '2499999987459039'
Test #107:
score: 7
Accepted
time: 5ms
memory: 4040kb
input:
999999998841 4999 4999 1509 999999995613 2216 999999998073 4185 999999998181 662 999999994175 1999 999999997403 622 999999995510 768 999999997305 2206 999999998701 751 999999994297 1580 999999998686 29 999999996709 85 999999995115 3026 999999995600 964 999999996230 1965 999999998517 1635 99999999512...
output:
500100018174
result:
ok single line: '500100018174'
Test #108:
score: 7
Accepted
time: 4ms
memory: 4268kb
input:
999999999330 5000 5000 1713 999999998863 3728 999999997805 2389 999999998961 1670 999999996876 1215 999999997405 4088 999999995208 802 999999997453 2135 999999998121 16 999999998223 3107 999999995996 517 999999994709 845 999999996481 3002 999999994534 1318 999999995861 3563 999999998061 3158 9999999...
output:
499999998368
result:
ok single line: '499999998368'
Subtask #7:
score: 41
Accepted
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Dependency #4:
100%
Accepted
Dependency #5:
100%
Accepted
Dependency #6:
100%
Accepted
Test #109:
score: 41
Accepted
time: 308ms
memory: 51372kb
input:
1000000000000 250000 199999999999 439305848099 951284536435 446483574548 805771484481 21884476185 244648762981 93499316387 529915154040 918792144715 920475917243 50257039351 685198990747 316642354471 893644485008 286441594173 754038855804 81244860245 531310867443 55215823394 845811655700 46837793469...
output:
425629
result:
ok single line: '425629'
Test #110:
score: 41
Accepted
time: 306ms
memory: 51272kb
input:
1000000000000 250000 100000000000 2953860884 869196856761 375570940096 696033094222 4929007892 249936797119 499211271591 734978405805 554569107618 819455797724 705857809637 822022080213 711132782505 820667299723 800103294057 908692183359 250052197616 932135946162 214310223686 817500418056 4729435959...
output:
838958
result:
ok single line: '838958'
Test #111:
score: 41
Accepted
time: 452ms
memory: 51280kb
input:
1000000000000 250000 429497297 123079224465 199778785167 446114388954 949825999605 106150506432 695697020248 178645567556 682479601373 564184260711 572426547528 136668870026 633044250700 97110538728 237946616112 776110045584 863209532037 399997642538 736930010756 380099099804 784795788307 3935926306...
output:
193764363
result:
ok single line: '193764363'
Test #112:
score: 41
Accepted
time: 516ms
memory: 51228kb
input:
1000000000000 250000 10000000 879072686467 975477783645 142856099409 570374153843 878179434683 912708269058 114721942346 657719549501 435618447159 902102645999 49788302673 590511500771 403209353365 539423074068 367849136003 840021837469 113804459917 221584278803 696295723075 880485305507 17230680942...
output:
8335937637
result:
ok single line: '8335937637'
Test #113:
score: 41
Accepted
time: 543ms
memory: 50680kb
input:
1000000000000 250000 1000000 681075843429 725944647387 258698890414 860280160583 326424535761 685634639109 108446262427 476635480535 39588673767 351841884076 71730845662 384999649346 192599995362 858425854373 262598365730 655715168128 72822136555 570819419962 920581523386 967449580743 33311587478 62...
output:
83163349437
result:
ok single line: '83163349437'
Test #114:
score: 41
Accepted
time: 529ms
memory: 50548kb
input:
1000000000000 250000 1000000 804752000191 972747453520 790166573028 821783565390 556536304999 659526920002 640522239782 815686843755 447543745951 526880480692 157140455924 587462685210 431990558643 469469711056 788469286449 828874854471 275901731719 985023085078 381808446930 601627379246 59175563352...
output:
83347216443
result:
ok single line: '83347216443'
Test #115:
score: 41
Accepted
time: 550ms
memory: 50564kb
input:
1000000000000 250000 1000000 482740392377 739543052635 659057710263 740890136246 153626094880 537284406699 576849595517 903953742822 777056609533 888660416557 535873838888 898007324725 569205672157 660337886638 612593355658 633140472976 89664223972 139669549422 512040060927 696624335840 905614466083...
output:
83191874001
result:
ok single line: '83191874001'
Test #116:
score: 41
Accepted
time: 552ms
memory: 50528kb
input:
1000000000000 250000 1000000 156433817267 506338651749 504921789727 687318732168 423631827988 783275693273 550031727060 987925674593 22937771079 325482119867 212846931536 914607221853 660351698667 925539990441 408452583652 428816156890 331170789573 903426716224 679126450733 800211227026 128950733838...
output:
83388797132
result:
ok single line: '83388797132'
Test #117:
score: 41
Accepted
time: 535ms
memory: 50604kb
input:
1000000000000 250000 1000000 273134250864 834422209453 309636126087 601187519579 268829506172 412925291666 39337797852 490654050092 273113899920 799158598986 293340604817 490831762539 186447126948 760087659768 233081775395 236871620158 485817253917 676039465372 850507807834 899503150916 266177789529...
output:
83318761497
result:
ok single line: '83318761497'
Test #118:
score: 41
Accepted
time: 463ms
memory: 29860kb
input:
1000000000000 250000 100000 849310243877 951709444613 38448296729 781062883406 167659223338 469304698809 663367747258 700461606346 239343208975 293740937901 79922548411 135390161364 53537106721 196171037940 293643225773 705663263454 560207476669 815099805463 717002669486 727825588692 73276336336 405...
output:
834953269319
result:
ok single line: '834953269319'
Test #119:
score: 41
Accepted
time: 333ms
memory: 23720kb
input:
1000000000000 250000 5000 638934392569 704899776829 369713378810 848601873623 453762773201 549333421744 499089972839 831091403795 451177482956 740543224298 586651015322 864054776752 314877103600 693658839860 57224694327 498629633056 117119856224 255449934211 185372150039 247383352294 947724770756 94...
output:
16675738108109
result:
ok single line: '16675738108109'
Test #120:
score: 41
Accepted
time: 236ms
memory: 23056kb
input:
1000000000000 250000 500 185055285307 202678795648 199563526074 868291725570 715908308230 929922272813 614446548121 726321868917 64007058966 635546307539 553609822970 560683318029 149557671796 315391089207 201215135241 939664436481 142670697978 669492607155 191423114092 883776666355 164229198459 404...
output:
166847432171257
result:
ok single line: '166847432171257'
Test #121:
score: 41
Accepted
time: 163ms
memory: 22960kb
input:
1000000000000 250000 69 484055942028 490695236550 402663791747 574226071941 142214657271 814060809590 66031568372 745616672387 293110401152 755137816624 21825212419 615063403771 198052887956 460205053016 150647864979 741193566689 59704024033 410864984159 45008409938 855954341160 588340657501 7127588...
output:
1207394546078861
result:
ok single line: '1207394546078861'
Test #122:
score: 41
Accepted
time: 83ms
memory: 23708kb
input:
1000000000000 250000 2 48544 999999810972 67023 999999766697 119402 999999836589 67507 999999797828 86780 999999946279 17133 999999774137 232599 999999857552 35000 999999994196 40112 999999802025 77380 999999953836 136242 999999892607 156932 999999803957 196297 999999980093 11824 999999895630 226839...
output:
124999968708809804
result:
ok single line: '124999968708809804'
Test #123:
score: 41
Accepted
time: 208ms
memory: 36692kb
input:
999999998889 249999 249999 129926 999999881383 41050 999999848415 103087 999999872850 133255 999999926054 218359 999999922155 58438 999999825880 235415 999999782477 85764 999999977687 20483 999999989577 1589 999999976482 62750 999999749464 208811 999999926051 106570 999999876211 127461 999999942278 ...
output:
500001937289
result:
ok single line: '500001937289'
Test #124:
score: 41
Accepted
time: 207ms
memory: 36720kb
input:
999999999170 250000 250000 214808 999999841235 50542 999999898937 71453 999999753627 139997 999999801424 44041 999999994914 110049 999999755692 226817 999999846885 99490 999999788345 150000 999999810347 31836 999999800236 90788 999999936010 68432 999999942042 30414 999999997491 88193 999999805552 23...
output:
499999936977
result:
ok single line: '499999936977'