QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#444393 | #8648. Tower | green_gold_dog# | 25 | 1953ms | 152784kb | C++23 | 10.1kb | 2024-06-15 18:44:46 | 2024-06-15 18:44:47 |
Judging History
answer
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,sse,sse2,sse3,ssse3,sse4,abm,popcnt,mmx")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef long double ldb;
typedef complex<double> cd;
constexpr ll INF64 = 2'000'000'000'000'000'000, MOD = 1'000'000'007;
constexpr db PI = acos(-1);
constexpr bool IS_FILE = false, IS_TEST_CASES = false;
random_device rd;
mt19937 rnd32(rd());
mt19937_64 rnd64(rd());
template<typename T>
bool assign_max(T& a, T b) {
if (b > a) {
a = b;
return true;
}
return false;
}
template<typename T>
bool assign_min(T& a, T b) {
if (b < a) {
a = b;
return true;
}
return false;
}
template<typename T>
T square(T a) {
return a * a;
}
template<>
struct std::hash<pair<ll, ll>> {
ll operator() (pair<ll, ll> p) const {
return ((__int128)p.first * MOD + p.second) % INF64;
}
};
struct Node {
ll tree, ms, madd, maddp;
ll l, r;
Node *nl = nullptr, *nr = nullptr;
Node(ll l, ll r): l(l), r(r) {
tree = 0;
ms = -1;
madd = 0;
maddp = 0;
}
void make_sons() {
if (nl != nullptr) {
return;
}
ll mid = (l + r) / 2;
nl = new Node(l, mid);
nr = new Node(mid, r);
}
void set(ll x) {
if (x == -1) {
return;
}
tree = x * (r - l);
madd = 0;
maddp = 0;
ms = x;
}
void add(ll x) {
tree += x * (r - l);
madd += x;
}
void addp(ll x) {
tree += x * (r - l) * (r - l - 1) / 2;
maddp += x;
}
void push() {
make_sons();
ll mid = (l + r) / 2;
nl->set(ms);
nr->set(ms);
ms = -1;
nl->add(madd);
nr->add(madd);
madd = 0;
nr->add(maddp * (mid - l));
nl->addp(maddp);
nr->addp(maddp);
maddp = 0;
}
ll get(ll x) {
if (x < l || r <= x) {
return 0;
}
if (r - l == 1) {
return tree;
}
push();
return nl->get(x) + nr->get(x);
}
void set(ll ql, ll qr, ll x) {
if (ql <= l && r <= qr) {
set(x);
return;
}
if (qr <= l || r <= ql) {
return;
}
push();
nl->set(ql, qr, x);
nr->set(ql, qr, x);
tree = nl->tree + nr->tree;
}
void add(ll ql, ll qr, ll x) {
if (ql <= l && r <= qr) {
add(x);
return;
}
if (qr <= l || r <= ql) {
return;
}
push();
nl->add(ql, qr, x);
nr->add(ql, qr, x);
tree = nl->tree + nr->tree;
}
void addp(ll ql, ll qr, ll x, ll st) {
if (ql <= l && r <= qr) {
add(st);
addp(x);
return;
}
if (qr <= l || r <= ql) {
return;
}
push();
ll mid = (l + r) / 2;
nl->addp(ql, qr, x, st);
if (ql <= mid) {
st += (mid - max(l, ql)) * x;
}
nr->addp(ql, qr, x, st);
tree = nl->tree + nr->tree;
}
};
struct segment_tree {
Node *root;
segment_tree(ll n) {
root = new Node(0, n);
}
ll get(ll x) {
return root->get(x);
}
void set(ll l, ll r, ll x) {
root->set(l, r, x);
}
void add(ll l, ll r, ll x) {
root->add(l, r, x);
}
void addp(ll l, ll r, ll x, ll st = 0) {
root->addp(l, r, x, st);
}
};
void solve() {
ll n, q, d, a, b;
cin >> n >> q >> d >> a >> b;
ll cp = min(a * d, b);
ll cph = b - cp;
vector<pair<ll, ll>> segs(n);
map<ll, vector<tuple<ll, ll, ll>>> m;
for (ll i = 0; i < n; i++) {
cin >> segs[i].first >> segs[i].second;
ll b1 = segs[i].first / d, b2 = segs[i].second / d;
if (b1 == b2) {
m[b1].emplace_back(0, segs[i].first % d, segs[i].second % d);
m[b1 + 1].emplace_back(1, q, 0);
m[b1 + 2].emplace_back(1, q, 0);
}
if (b1 + 1 == b2) {
m[b1].emplace_back(0, segs[i].first % d, d - 1);
m[b2].emplace_back(0, 0, segs[i].second % d);
m[b2 + 2].emplace_back(1, q, 0);
m[b2 + 1].emplace_back(1, q, 0);
}
if (b1 + 1 < b2) {
m[b1].emplace_back(0, segs[i].first % d, d - 1);
m[b1 + 1].emplace_back(0, 0, d - 1);
}
}
vector<ll> ans(q + 1, -1);
vector<ll> qqq(q);
for (ll i = 0; i < q; i++) {
ll x;
cin >> x;
qqq[i] = x;
m[x / d].emplace_back(1, i, x % d);
}
ll lst = 0;
segment_tree st(d);
st.set(0, 1, 0);
st.set(1, d, INF64);
deque<pair<ll, ll>> zs;
m[0].emplace_back(1, q, 0);
zs.emplace_back(1, d - 1);
ll last = INF64;
ll pbad = 0;
while (!m.empty()) {
auto[now, op] = *m.begin();
m.erase(m.begin());
st.add(0, d, (now - lst) * cp);
lst = now;
st.add(0, pbad, cph);
ll bsuff = d;
deque<pair<ll, ll>> nzs;
ll npbad = 0;
sort(op.begin(), op.end());
for (auto[t, l, r] : op) {
if (t != 0) {
continue;
}
assign_min(bsuff, r + 1);
assign_max(npbad, l);
st.set(l, r + 1, INF64);
nzs.emplace_back(l, r);
}
st.add(max(pbad, bsuff), d, cph);
pbad = npbad;
deque<pair<ll, ll>> nnzs = nzs;
vector<pair<ll, ll>> rseg;
deque<pair<ll, ll>> nnnzs;
ll lst = 0;
for (auto[l, r] : zs) {
if (lst < l) {
nnnzs.emplace_back(lst, l - 1);
}
nnnzs.emplace_back(l, r);
lst = r + 1;
}
if (lst < d) {
nnnzs.emplace_back(lst, d - 1);
}
zs = nnnzs;
while (!zs.empty()) {
auto[l, r] = zs.front();
zs.pop_front();
while (!nnzs.empty() && nnzs.front().first <= r) {
auto[nl, nr] = nnzs.front();
nnzs.pop_front();
if (nr < l) {
continue;
}
if (nl > l) {
rseg.emplace_back(l, nl - 1);
}
if (nr > r) {
nnzs.emplace_front(r + 1, nr);
}
l = nr + 1;
}
if (l <= r) {
rseg.emplace_back(l, r);
}
}
for (auto[l, r] : rseg) {
ll fe = (l == 0 ? last : st.get(l - 1));
ll nst = st.get(l);
if (nst >= INF64 && fe >= INF64) {
nzs.emplace_back(l, r);
} else {
if ((nst >= INF64) || (fe + a <= nst && cph > 0)) {
st.set(l, r + 1, fe + a);
st.addp(l, r + 1, a);
}
}
}
sort(nzs.begin(), nzs.end());
for (auto[t, l, r] : op) {
if (t != 1) {
continue;
}
ans[l] = st.get(r);
}
zs = nzs;
last = st.get(d - 1);
}
for (ll i = 0; i < q; i++) {
if (ans[i] >= INF64) {
ans[i] = -1;
} else {
//ans[i] = qqq[i];
}
cout << ans[i] << '\n';
}
}
int main() {
if (IS_FILE) {
freopen("", "r", stdin);
freopen("", "w", stdout);
}
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
ll t = 1;
if (IS_TEST_CASES) {
cin >> t;
}
for (ll i = 0; i < t; i++) {
solve();
}
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 5
Accepted
time: 81ms
memory: 14072kb
input:
2000 200000 500 66309 387245 91 122 793 1029 1127 1131 1304 1611 2007 2039 2601 2701 2906 3052 3253 3263 3495 3609 4157 4225 4283 4283 4757 4766 4786 4847 4885 5086 5326 5342 5607 5750 5847 5877 6093 6230 6548 6793 7206 7308 7413 7419 7752 7780 8244 8410 8501 8515 9335 9447 9512 9514 9602 9906 10076...
output:
-1 -1 1545376776 -1 1355518146 -1 -1 1538578776 1124179254 736677313 275840218 -1 314646902 120181124 592802647 1470145222 1194355416 630012616 541479470 1380556431 748297307 1579324340 83071935 -1 547672724 766967273 940718126 967114418 448357717 -1 208077708 264694996 68332763 -1 699361243 1542138...
result:
ok 200000 lines
Test #2:
score: 0
Accepted
time: 81ms
memory: 14056kb
input:
2000 200000 500 45649 229891 123 232 663 994 1023 1041 1065 1065 1523 1542 1962 1983 2044 2066 2449 2453 2589 2591 2788 2810 3207 3418 3666 3685 3944 3945 4256 4320 4699 4706 4915 4950 5196 5207 5271 5545 5705 5707 5867 6034 6273 6328 6364 6380 6764 6787 6974 7007 7363 7365 7632 7648 7754 7924 7954 ...
output:
-1 -1 1044862158 349767467 -1 -1 -1 -1 534260754 853076992 514160380 514034955 -1 -1 680989150 557376047 -1 410302211 -1 -1 14156128 -1 -1 656642980 -1 335413929 465525211 1047741337 1007928386 -1 183280077 -1 842399625 553981561 -1 -1 486838795 823208939 597570650 68518820 -1 -1 36379839 -1 4959492...
result:
ok 200000 lines
Test #3:
score: 0
Accepted
time: 81ms
memory: 13940kb
input:
2000 200000 500 11 228852 288 470 648 922 1193 1288 1509 1516 1792 1915 2023 2061 2443 2477 2512 2693 2735 2860 3176 3196 3260 3363 3622 3658 3939 3988 4177 4223 4470 4541 4640 4789 4812 4850 5167 5246 5443 5594 5692 5804 5875 5982 6265 6286 6416 6609 6816 6833 6928 7130 7298 7305 7401 7403 7778 781...
output:
61754766 1843455 193255572 95486804 80338946 188441144 126474653 -1 119132183 159054071 107422913 158596895 105813337 -1 166163718 -1 165014783 -1 2988793 146889891 -1 75748618 -1 -1 -1 109483978 -1 112469548 163413919 67263527 170983140 128997679 168000122 -1 186380233 151702042 42025050 -1 1556077...
result:
ok 200000 lines
Test #4:
score: 0
Accepted
time: 81ms
memory: 14104kb
input:
2000 200000 500 123 507044 13 349 778 805 1289 1419 2069 2074 2126 2129 2299 2392 2629 2629 3035 3054 3171 3184 3225 3381 3967 4100 4222 4225 4432 4603 4741 4745 4972 5123 5239 5245 5412 5530 5737 5757 5859 6162 6286 6289 6452 6542 6820 6825 6940 6974 7327 7328 7686 7781 8122 8169 8499 8909 8957 896...
output:
23238378 -1 320316781 492915201 -1 118374346 -1 118865646 -1 27397189 413766267 33059543 89523552 84434908 75590808 178982529 452655813 119364449 76127495 -1 -1 296028030 320308540 475355659 -1 210903877 288320772 388500820 -1 149739573 428228318 -1 -1 -1 -1 478454749 -1 -1 -1 -1 268399317 -1 310981...
result:
ok 200000 lines
Test #5:
score: 0
Accepted
time: 85ms
memory: 13892kb
input:
2000 200000 500 367 183500 395 476 616 705 1068 1085 1392 1462 1898 2004 2105 2124 2266 2553 2678 2684 2845 2855 3145 3188 3497 3630 3705 3708 3857 3995 4221 4223 4405 4642 4724 4730 4993 5199 5224 5225 5325 5637 5722 5735 6111 6152 6322 6341 6464 6694 6764 6838 7013 7174 7249 7261 7423 7713 7803 78...
output:
-1 81789987 195275562 134586974 172718274 -1 77090919 -1 169680615 26763842 81273618 74582841 -1 -1 164912918 -1 45100263 25295842 5720062 138829861 -1 23310005 142354162 158449681 -1 43546018 5823556 -1 -1 -1 -1 125462620 -1 25779548 121436630 4706408 -1 -1 -1 87290583 -1 47107386 94590213 17249256...
result:
ok 200000 lines
Test #6:
score: 0
Accepted
time: 313ms
memory: 43008kb
input:
195716 197150 20 41515 610194 34 34 36 36 38 38 40 40 42 42 44 44 46 46 83 83 85 85 87 87 89 89 91 91 93 93 95 95 97 97 99 99 104 104 106 106 108 108 110 110 112 112 114 115 118 118 120 120 132 132 134 134 136 136 138 138 140 140 142 142 144 144 146 146 148 148 150 150 175 175 177 177 179 179 181 18...
output:
27145048833 -1 20311977145 5823894704 12611222982 10375331362 -1 4666825214 8294213599 7946746140 15043381651 12084461892 2564209663 -1 2889605968 30371230407 13809822492 10059353510 20452787039 -1 186985672 -1 -1 -1 14667164575 21798169916 2551478619 -1 2357959404 24230797781 5359696913 11480637002...
result:
ok 197150 lines
Test #7:
score: 0
Accepted
time: 305ms
memory: 42872kb
input:
194401 196154 20 81884 184176 27 27 29 29 31 31 33 33 35 35 37 37 39 39 41 41 43 43 45 45 103 106 110 110 114 115 119 119 121 121 123 123 125 126 128 128 130 130 132 132 135 135 137 137 170 171 173 173 175 175 179 179 181 181 183 184 186 186 203 203 205 205 207 207 210 210 212 212 214 214 216 216 22...
output:
-1 7397081928 2079536780 1740817712 7985105512 8791917840 -1 2108310564 3818312684 3403790452 -1 -1 7282843676 8094061364 8075949632 -1 4202973208 -1 5158569260 5191129360 -1 5769244224 -1 5536679820 7825620684 4417835300 10616377912 -1 7443886064 5554791552 7631714344 4169124128 10019841164 8876887...
result:
ok 196154 lines
Test #8:
score: -5
Wrong Answer
time: 334ms
memory: 43432kb
input:
197806 197356 20 29644 637771 3 3 5 5 7 7 9 9 11 11 13 13 15 15 17 17 19 19 21 21 71 71 73 73 75 75 77 77 79 79 81 81 83 83 85 85 87 87 89 89 94 94 96 96 98 98 100 100 102 102 104 104 106 107 122 122 124 124 126 126 128 128 131 131 133 133 135 135 156 156 158 158 160 160 163 163 165 165 216 216 218 ...
output:
-1 16954750062 16958753702 -1 -1 30901144350 985781254 7739146942 14740081892 1811661710 -1 7367462343 26987223721 2970179667 -1 -1 -1 -1 26582062546 16921654608 2133518942 17191976915 -1 26653516539 29685914818 812738814 25301618658 27421506407 29700046559 13376448387 1925824313 9818564575 -1 86864...
result:
wrong answer 2nd lines differ - expected: '16958900222', found: '16954750062'
Subtask #2:
score: 0
Wrong Answer
Test #29:
score: 38
Accepted
time: 12ms
memory: 11340kb
input:
1938 1960 999999 47694 9291 2883622 3085639 3674880 3745876 9982198101 9982517489 19960889157 19960925795 19962228551 19962276101 19964301694 19964730442 19964826417 19965369252 19965984922 19966442459 19968019821 19968213820 19968334967 19968392242 19968426638 19968840337 19969017519 19969109591 19...
output:
2629532778036 1625568767553 -1 -1 -1 931487890158 217249154424 -1 3376854733974 453288498306 1144114552242 194772660096 116508067359 1965611506731 2806098123096 3404924462019 1737385084617 1649786307423 -1 3043407203193 2248403158668 -1 -1 538903132932 2740777563264 -1 3173320399527 -1 -1 2616652920...
result:
ok 1960 lines
Test #30:
score: 0
Accepted
time: 12ms
memory: 10836kb
input:
1837 1989 999999 41963 54422 9980315942 9981214568 9981614247 9981843710 9982430252 9982433585 9983182843 9983561789 9984404759 9984499318 9984655332 9984859904 9985420428 9985717345 9985762820 9985867258 9986396224 9986498679 9986533284 9986947589 9987502488 9988096750 9989096806 9989207060 9989676...
output:
-1 2554711024271 -1 977926019067 3238028322568 201257084557 -1 3205448836431 387280383252 -1 -1 -1 1216454626736 823964810173 117884656882 2669122054316 734561443433 1448900485845 3203724783289 796733108264 883217412007 -1 -1 147443422287 2027763666999 2378863303928 -1 -1 3091310739595 2261110540233...
result:
ok 1989 lines
Test #31:
score: -38
Wrong Answer
time: 19ms
memory: 11500kb
input:
1985 1968 999999 1 1000000 9978505229 9979247763 9979301501 9979397117 9981449577 9981533536 9981765886 9982271507 9983158890 9983349521 9983843213 9984416208 9985032631 9985197994 9987158017 9987185683 9987259105 9988030168 9988487256 9988529335 9988581372 9988946469 9989439295 9989530721 998958116...
output:
-1 -1 41756151855 -1 21130824370 10798059961 -1 31279958990 323352831 41582756792 11079926835 41820255491 26549802 -1 10665304650 10861538009 10415393032 -1 41745002758 31292576465 32808000 -1 21190645756 21129139730 41472591198 255523792 21091737475 58533221 338121633 -1 -1 -1 -1 10913070721 -1 418...
result:
wrong answer 3rd lines differ - expected: '700140493470', found: '41756151855'
Subtask #3:
score: 25
Accepted
Test #44:
score: 25
Accepted
time: 1918ms
memory: 152132kb
input:
198085 196577 999999 1 999999 562622 895604 1799586 1975565 2518299 2941986 4934097 5403130 5755102 5996130 6036200 6112534 6391882 6431514 6451793 6555786 6613625 6621089 7130933 7204522 7335426 7522555 7748545 7784568 8184979 8494887 9066856 9178094 9303615 9384897 9716200 9719420 11693951 1183563...
output:
27793636591 139076373265 -1 -1 164554928593 340203577240 767735640886 -1 808488370439 777661458222 428941062963 -1 756913262477 860152123456 -1 734774231229 724225013316 184932545705 418133621292 -1 890908770677 450977017227 806542610691 -1 898938307262 536837237896 805921470285 -1 588880769556 -1 4...
result:
ok 196577 lines
Test #45:
score: 0
Accepted
time: 1953ms
memory: 152060kb
input:
199371 195400 999999 1 999999 4612523 4947496 5154685 5535111 6001135 6243639 7356800 7512564 7752763 7797747 8964902 8981715 9750529 9966044 9975655 10525517 16728399 17323380 17812655 17876446 17926768 18006465 18054955 18353713 18566302 18650151 19483683 19787610 20585307 20768207 22240113 222443...
output:
-1 621180105200 -1 -1 461780052274 772236852813 710455468422 730649315181 758552247311 190536170737 472110590707 660933061395 107617202142 917915550413 -1 252526045269 -1 730423595734 -1 -1 -1 -1 -1 -1 -1 276664132078 392648881685 207163529590 748682653117 622053824210 485855702116 -1 661004479399 -...
result:
ok 195400 lines
Test #46:
score: 0
Accepted
time: 1933ms
memory: 151992kb
input:
198278 196370 999999 1 999999 161975 250088 790789 822594 1044921 1160804 1182774 1186404 1212165 1493435 1928841 1935221 2686095 2994407 3085371 3137281 4151843 4199695 4797370 4807889 7089261 7293018 7469787 8294563 8639586 9028758 9535294 9647237 10261792 10434860 14068523 14148691 14245117 14573...
output:
107006124752 127121450263 719480563528 -1 97915594959 -1 272093640421 -1 -1 779112437224 -1 278064103799 -1 -1 94629533880 -1 518947410699 295938119924 -1 286734572810 -1 462315178138 -1 656398601363 -1 515972463880 -1 -1 463731627587 29815838997 503713954019 894142823925 386885082072 675276164984 4...
result:
ok 196370 lines
Test #47:
score: 0
Accepted
time: 1857ms
memory: 150352kb
input:
190308 196088 999999 1 999999 1589316 1719530 2162548 2518931 2629052 2984381 3086913 3353461 3455225 3455282 5432539 5481306 5850838 6295339 6986760 7082054 7925601 7941270 8188318 8209952 8326216 8494288 8898926 9225853 9795199 10273087 10964225 10973927 11365962 11546260 11612346 11669740 1177897...
output:
335994513998 -1 756345517990 63844676033 816674895005 95793949773 448915126326 961367036898 926970280278 315502814398 608736217929 -1 -1 890007920329 940210562473 619071423487 926609908048 149362280657 571340649004 777210538008 256673125898 -1 349176941798 648540718499 938038904114 -1 459037706019 4...
result:
ok 196088 lines
Test #48:
score: 0
Accepted
time: 1919ms
memory: 152060kb
input:
197660 195976 999999 1 999999 13343 692586 752194 983954 2435751 2945408 5413895 5421536 5520870 5720635 6959165 7086977 8622293 8847227 9660334 9823364 9835842 10252958 10929283 11277121 13750555 13810298 16634199 16637075 16870329 16970353 17336772 17653119 17725964 17833010 17958933 18336713 1890...
output:
521609825924 -1 932434325540 43425485771 757783622284 -1 601903818129 254437477178 819025671166 -1 236626854386 -1 257471432852 235245317149 117469362126 373027753560 -1 385486221028 -1 945304016581 -1 -1 375101203285 153888061031 -1 520898561028 189327508417 -1 587569604527 108513358547 -1 11696540...
result:
ok 195976 lines
Test #49:
score: 0
Accepted
time: 954ms
memory: 56228kb
input:
200000 200000 2000 1 2000 630 1632 1876 2158 2711 3735 4234 4856 5509 5902 13850 14242 15159 15716 17404 18103 19901 20024 20304 21089 21221 21344 22180 22985 23130 23236 30082 30591 30689 31072 33612 33935 40527 42290 45383 46190 46716 46800 47173 47263 47557 48161 57768 59567 59738 59853 60060 605...
output:
79991745323 789936142800 949975423013 729941161919 -1 -1 -1 519967821113 429970845198 639947050982 909952551269 399975684295 919965655725 909951170493 -1 589951000213 269982121508 389969423060 59994813183 379961893157 659944665315 -1 249979594110 499967867639 209979928363 519968145089 199982438348 8...
result:
ok 200000 lines
Test #50:
score: 0
Accepted
time: 973ms
memory: 56176kb
input:
200000 200000 2000 1 2000 260 867 876 1570 2586 2588 2630 2673 5473 6136 6816 7919 8895 9594 10867 11177 11588 11926 11969 12540 14072 14360 17570 18053 18756 19104 20252 20268 20514 20850 20971 21741 23959 24092 24462 24567 25212 25711 28968 29583 30188 30283 30780 31258 34284 34620 35552 35705 380...
output:
-1 9997494709 239984588464 10002561642 -1 310031121401 820005048898 -1 239980275729 470006769653 740015016291 240003164340 239998669154 239988346465 29996548578 -1 -1 90006192595 239988759589 -1 90005179717 690002714628 80001200307 790011724101 240001187799 690005227176 639999528978 -1 -1 4300175646...
result:
ok 200000 lines
Test #51:
score: 0
Accepted
time: 969ms
memory: 56172kb
input:
200000 200000 2000 1 2000 4457 4812 5482 5543 6836 7518 7558 7879 16521 16744 17677 17817 17916 17952 18233 18735 22630 22876 22954 23607 31841 33245 33432 33510 34384 34614 44971 45885 51032 51076 53548 53978 53980 54480 54995 55041 56164 57051 58728 59306 60549 60759 62649 62801 63829 64019 68138 ...
output:
-1 -1 490005213735 389983980028 -1 479993577366 269964928122 30006145533 589998466131 209977981338 709974711240 589993534516 -1 909979446385 530007635029 -1 909972674899 -1 849970905468 520005647906 -1 279969864933 299980247051 -1 279977883884 -1 510008135845 89998515208 -1 -1 -1 510006963301 369988...
result:
ok 200000 lines
Test #52:
score: 0
Accepted
time: 1899ms
memory: 152572kb
input:
200000 200000 1000000 1 1000000 1201721 1894242 3016023 3044124 3467614 3538694 3868596 3901358 5781073 5925868 6188800 6413742 6683123 6948980 9324814 9508614 9797754 9926873 11701859 11712194 12520205 12627404 12987536 13383402 14184412 14404606 15290399 15593444 16186265 16463964 17416648 1774610...
output:
154980181226 3053320078 -1 116668888082 52271638839 -1 194799064164 -1 135756169612 35949188430 -1 101574878576 177681636714 -1 23671095214 172261625503 67298510105 -1 175627528003 28969352849 196466288166 192245483818 100571063417 -1 12133638153 65877759591 -1 -1 118589141668 215552746469 -1 -1 143...
result:
ok 200000 lines
Test #53:
score: 0
Accepted
time: 1933ms
memory: 152784kb
input:
200000 200000 1000000 1 1000000 170004 855149 2051762 2466419 3042850 3311890 4045589 4929749 5434536 5840730 6619205 6629299 6732346 7131471 8450452 8495454 8766287 8983021 9117442 9301222 9425194 9857355 14712346 15056382 15443258 15607917 16976863 17104932 18404155 19086936 19517213 19643464 2176...
output:
13535930147 22930364103 -1 -1 200106537302 194624823376 -1 208412563639 -1 38366854635 54568152392 145580423084 89318146708 158033508663 -1 -1 62672221678 115668089771 -1 42043383736 67774069552 55883146103 -1 185303429007 63170324973 106302694809 16821998417 217192371056 154398812901 170874356974 3...
result:
ok 200000 lines
Test #54:
score: 0
Accepted
time: 730ms
memory: 55948kb
input:
200000 200000 50 1 50 28 31 35 38 135 160 275 283 304 323 404 407 429 434 507 520 530 549 577 578 588 602 611 614 628 631 720 727 730 736 746 754 767 767 784 797 881 900 988 1009 1117 1133 1175 1192 1209 1218 1232 1232 1249 1250 1338 1349 1476 1486 1500 1515 1522 1547 1589 1616 1640 1644 1677 1683 1...
output:
-1 -1 -1 -1 -1 -1 -1 96813 -1 -1 -1 -1 99999906396 79999852694 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 79999765785 -1 -1 -1 -1 -1 -1 20000052620 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 79999887656 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 79999727135 25633 120000236130...
result:
ok 200000 lines
Test #55:
score: 0
Accepted
time: 726ms
memory: 56008kb
input:
200000 200000 50 1 50 19 20 38 43 59 93 107 137 343 347 361 363 616 626 683 686 692 707 709 716 750 783 807 807 947 950 966 968 980 997 1021 1032 1064 1079 1111 1148 1174 1189 1198 1204 1265 1280 1288 1309 1320 1342 1484 1491 1518 1526 1539 1563 1567 1571 1606 1608 1642 1642 1644 1644 1655 1658 1831...
output:
-1 40000020068 -1 -1 -1 -1 -1 -1 -1 -1 39999950681 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...
result:
ok 200000 lines
Test #56:
score: 0
Accepted
time: 748ms
memory: 55860kb
input:
200000 200000 50 1 50 4 5 7 14 23 23 25 28 38 46 80 111 270 271 303 321 354 362 374 390 396 399 431 431 444 452 454 454 456 468 497 505 567 579 585 586 718 721 784 796 898 917 933 933 944 949 1001 1032 1059 1068 1074 1078 1166 1169 1171 1188 1203 1206 1242 1254 1398 1415 1420 1437 1465 1469 1582 160...
output:
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 39999747777 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 49999721223 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 49999702499 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...
result:
ok 200000 lines
Subtask #4:
score: 0
Skipped
Dependency #1:
0%