QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#72324 | #5022. 【模板】线段树 | zhoukangyang | 100 ✓ | 2853ms | 28296kb | C++17 | 3.0kb | 2023-01-15 14:42:06 | 2023-01-15 14:46:34 |
Judging History
answer
#include<bits/stdc++.h>
#define L(i, j, k) for(int i = (j); i <= (k); ++i)
#define R(i, j, k) for(int i = (j); i >= (k); --i)
#define ll long long
#define sz(a) ((int) (a).size())
#define vi vector < int >
#define me(a, x) memset(a, x, sizeof(a))
#define ull unsigned long long
#define ld __float128
using namespace std;
const int N = 1 << 20, B = 288;
int n, q, op[N], l[N], r[N];
int a[N];
int cov[N];
pair < int, int > ad[N];
int all;
void solve(int L, int R, vi q) {
if(L == R) {
if(op[L] == 2) {
cout << a[l[L]] << '\n';
} else {
R(i, sz(q) - 1, 0)
if(l[L] <= q[i] && q[i] < r[L])
a[q[i] + 1] ^= a[q[i]];
}
return ;
}
int G = (R - L + 2) >> 1, mid = (L + R) >> 1;
L(t, L, R) {
int S = t - L + 1;
L(i, max(l[t] - S, 1), l[t]) cov[i] = true;
L(i, max(r[t] - S, 1), r[t]) cov[i] = true;
}
vi b, t(sz(q));
L(i, 0, sz(q) - 1)
if(cov[q[i]]) b.emplace_back(q[i]), t[i] = -1;
else t[i] = a[q[i]], a[q[i]] = 0;
vi st, imp;
L(t, L, R) {
st.emplace_back(l[t]);
if(r[t]) st.emplace_back(r[t]);
}
sort(st.begin(), st.end());
int ri = 0;
for(auto u : st) {
int l = max(u + 1, ri + 1);
ri = min(u + G, n);
L(i, l, ri) if(!cov[i]) imp.emplace_back(i);
}
vi T(sz(imp));
L(t, L, R) {
int S = t - L + 1;
L(i, max(l[t] - S, 1), min(l[t] + S, n)) cov[i] = false;
if(r[t]) L(i, max(r[t] - S, 1), min(r[t] + S, n)) cov[i] = false;
}
solve(L, mid, b);
L(i, 0, sz(imp) - 1) T[i] = a[imp[i]], a[imp[i]] = 0;
solve(mid + 1, R, b);
// ------------------------------
all = 0;
L(i, mid + 1, R)
if(op[i] == 1) {
++all, ad[all].first = l[i], ad[all].second = 1;
++all, ad[all].first = r[i] + 1, ad[all].second = -1;
}
sort(ad + 1, ad + all + 1);
int pos = 1, s = 0;
L(i, 0, sz(imp) - 1) if(T[i]) {
int u = imp[i];
while(pos <= all && ad[pos].first <= u) s += ad[pos].second, ++pos;
for(int g = s; g; g = (g - 1) & s) a[u + g] ^= T[i];
a[u] ^= T[i];
}
// -------------------------------------
all = 0;
L(i, L, R)
if(op[i] == 1) {
++all, ad[all].first = l[i], ad[all].second = 1;
++all, ad[all].first = r[i] + 1, ad[all].second = -1;
}
sort(ad + 1, ad + all + 1);
pos = 1, s = 0;
L(i, 0, sz(t) - 1) if(t[i] > 0) {
int u = q[i];
while(pos <= all && ad[pos].first <= u) s += ad[pos].second, ++pos;
for(int g = s; g; g = (g - 1) & s) a[u + g] ^= t[i];
a[u] ^= t[i];
}
}
int main () {
// return system("fc qwq.out a.out"), 0;
// freopen("a.in", "r", stdin);
// freopen("qwq.out", "w", stdout);
ios :: sync_with_stdio(false);
cin.tie(0); cout.tie(0);
int tst;
cin >> tst;
cin >> n >> q;
L(i, 1, n) {
cin >> a[i];
}
L(t, 1, q) {
cin >> op[t];
if(op[t] == 2) {
cin >> l[t];
} else {
cin >> l[t] >> r[t];
}
}
for(int L = 1, R; L <= q; L = R + 1) {
R = min(q, L + B - 1);
vi p(n);
L(i, 1, n) p[i - 1] = i;
solve(L, R, p);
}
L(i, 1, n) cout << a[i] << '\n';
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 8
Accepted
Test #1:
score: 8
Accepted
time: 1ms
memory: 13584kb
input:
1 6 6 1 1 5 1 9 4 2 5 1 2 5 2 4 1 3 6 2 6 1 1 6
output:
9 4 12 1 0 5 4 12 0
result:
ok 9 numbers
Test #2:
score: 0
Accepted
time: 2ms
memory: 11664kb
input:
1 999 997 898798734 979577086 45974352 1013270193 1053191143 533594258 372426673 947830633 122319874 368651315 866424479 109724831 427664962 558099346 764830489 326451620 322471751 525780385 746941281 670254345 586958579 979544209 743892216 436404384 291681381 979530194 998929567 367716728 909076993...
output:
1015342581 962986689 965094083 871356796 835210392 172023195 63088572 606096781 569607283 436055720 154605892 663158209 154605892 776365236 281312240 62398687 182713417 604764772 816533315 793514230 325061861 806973284 91749226 283750235 198953311 170342298 432592070 809908556 683302450 40932811 669...
result:
ok 1996 numbers
Test #3:
score: 0
Accepted
time: 8ms
memory: 13784kb
input:
1 999 997 89872218 906651903 120274311 490547919 291584020 755757065 24942887 707247173 763024744 68250332 114193028 999245166 140381610 171802205 399965713 299821903 907998064 906075056 427270276 335420206 708713870 492555323 359637714 197212814 35225369 1011322274 912003632 633998134 1026276199 85...
output:
89872218 860962725 120274311 490547919 978745892 924706625 610771729 524956121 105748312 139294727 866385688 729638611 92178006 1037482711 80194776 277477501 592738191 694314356 733017733 701758468 65199929 983529101 717179143 542164040 444291361 439952700 147939819 276321083 1012586084 166061298 30...
result:
ok 999 numbers
Test #4:
score: 0
Accepted
time: 8ms
memory: 13688kb
input:
1 998 997 802301789 913975794 256883306 462593698 958614999 708264636 114045898 622336472 273146091 1035403087 151608039 853195969 670449389 1967248 347890740 88419426 272759411 668812195 315110503 54515201 11283025 183682542 149656693 916299553 345162140 626592021 633508243 201443721 191882154 4200...
output:
654798390 720797824 232736065 90537128 467468783 391542471 410387328 970043816 199400953 691327788 183682542 543340459 435746483 305146388 967107550 72899382 419833683 273367829 1062016570 511549763 893866015 137019003 177123936 524992882 462306449 1057090504 72525968 344810664 332588248 94524245 57...
result:
ok 1491 numbers
Test #5:
score: 0
Accepted
time: 2ms
memory: 13564kb
input:
1 10 64 178 181 183 184 188 189 190 191 192 195 1 3 5 2 10 2 8 1 4 9 2 10 2 2 1 1 5 2 5 2 3 2 3 1 2 7 2 3 1 3 9 2 7 1 1 8 1 2 8 2 7 2 7 2 5 2 2 2 7 2 5 1 2 7 1 8 10 1 2 3 1 6 10 1 5 6 1 5 7 2 4 1 5 10 1 2 5 2 3 1 4 7 2 5 1 2 10 1 3 10 1 2 5 2 3 1 1 3 1 2 7 2 10 1 2 9 2 4 1 2 6 2 10 1 4 6 1 2 9 2 4 2...
output:
195 191 195 181 4 2 2 5 7 1 1 3 181 1 3 15 2 12 2 6 189 6 186 7 9 6 125 13 13 189 189 183 178 181 183 10 4 14 189 179 122 6
result:
ok 42 numbers
Subtask #2:
score: 4
Accepted
Test #6:
score: 4
Accepted
time: 1060ms
memory: 17584kb
input:
2 249998 99999 1048488450 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok 300080 numbers
Test #7:
score: 0
Accepted
time: 677ms
memory: 16812kb
input:
2 249999 100000 734489692 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok 325012 numbers
Test #9:
score: 0
Accepted
time: 689ms
memory: 16688kb
input:
2 249997 99998 713646381 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
output:
0 0 0 713646381 0 713646381 0 0 0 0 0 0 713646381 713646381 713646381 713646381 0 0 0 713646381 0 713646381 713646381 713646381 0 0 713646381 0 713646381 713646381 713646381 713646381 0 713646381 713646381 713646381 0 0 713646381 0 713646381 713646381 0 713646381 713646381 0 0 713646381 0 0 0 0 0 0 ...
result:
ok 250982 numbers
Subtask #3:
score: 7
Accepted
Test #10:
score: 7
Accepted
time: 1870ms
memory: 18128kb
input:
3 250000 99999 1 1 1 1 1 0 1 0 1 1 0 1 0 1 1 1 1 1 1 0 1 0 1 0 1 1 1 0 0 0 0 0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 1 1 1 0 0 0 1 0 1 0 0 1 0 0 1 1 1 0 0 0 1 1 1 1 1 1 0 0 1 1 1 1 0 0 0 0 1 1 0 0 1 1 0 1 1 0 1 1 0 1 1 1 0 0 1 1 0 0 1 1 1 0 1 1 1 1 1 0 1 0 1 0 0 1 0 1 1 1 0 1 1 0 1 1 0 1 0 0 1 1...
output:
0 0 0 0 1 0 1 0 0 0 0 0 1 0 0 1 0 0 0 0 1 1 0 1 1 0 1 0 1 1 1 0 1 1 1 0 1 1 1 1 1 1 1 0 1 0 0 0 1 1 0 1 0 0 1 1 0 1 0 0 0 0 1 1 1 0 1 1 0 0 0 1 1 0 1 0 1 1 0 1 0 1 1 0 1 1 0 0 1 0 1 0 1 0 1 1 1 1 0 0 0 1 1 0 0 0 1 1 1 0 1 1 1 1 1 0 1 0 1 1 0 1 1 1 0 0 1 1 1 0 0 0 1 0 1 1 1 1 1 1 0 1 1 1 1 1 0 1 1 0 ...
result:
ok 300215 numbers
Test #11:
score: 0
Accepted
time: 714ms
memory: 16952kb
input:
3 249996 100000 1 1 0 0 0 1 1 0 1 0 0 0 1 0 1 0 0 1 0 0 0 1 1 1 0 0 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 1 1 1 1 1 0 1 1 0 0 1 0 1 0 0 0 1 1 1 1 0 0 0 1 0 0 1 0 0 1 1 0 1 1 1 1 0 1 0 1 0 1 0 0 0 0 0 0 1 1 1 0 0 1 0 0 0 1 0 0 1 0 0 0 1 1 1 0 1 1 0 0 0 1 0 0 1 1 0 0 1 0 1 0 1 0 0 1 1 1 0 1 1 0 0 1 1 1 1 ...
output:
0 1 0 1 0 0 1 0 1 0 1 1 1 0 0 0 0 0 1 0 0 0 0 1 0 0 1 1 1 0 1 0 1 0 0 1 0 0 1 1 1 0 0 1 0 1 0 0 0 0 0 0 0 0 0 1 0 0 1 1 1 0 0 0 0 1 0 1 1 1 0 1 1 1 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 0 0 1 0 1 0 0 0 0 1 1 0 1 1 1 0 0 1 0 0 1 0 1 1 1 1 0 1 0 0 1 1 0 0 0 0 0 1 1 0 0 1 ...
result:
ok 258845 numbers
Test #12:
score: 0
Accepted
time: 2648ms
memory: 28296kb
input:
3 249998 100000 0 1 0 1 1 0 1 0 1 0 1 0 1 0 0 1 1 0 0 0 1 0 0 0 1 1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 0 1 1 0 1 0 1 0 1 0 1 1 1 0 1 1 0 0 0 1 0 1 1 0 0 0 1 1 1 0 0 1 0 1 1 1 0 0 0 1 1 0 0 1 0 1 1 1 0 1 0 1 1 1 0 0 0 0 1 1 0 0 0 0 1 1 0 1 1 1 1 0 0 1 1 0 0 1 0 1 1 1 ...
result:
ok 341048 numbers
Subtask #4:
score: 13
Accepted
Test #14:
score: 13
Accepted
time: 604ms
memory: 27396kb
input:
4 249996 99997 309331355 195839266 912372930 57974187 363345291 954954162 650621300 389049294 821214285 263720748 231045308 844370953 768579771 664766522 681320982 124177317 32442094 297873605 743179832 1073656106 443742270 235746807 1054294813 974443618 422427461 307448375 1018255356 20105813 36821...
output:
611117059 866091251 300188933 0 478915924 1053588351 453142424 897441996 60971719 748656483 600408393 0 303761852 983037069 883016404 332332552 1069626159 860304528 851235295 561276840 389049294 681320982 484263000 351914192 620106464 667080579 733146026 375466744 0 347632358 737240082 321494160 0 3...
result:
ok 299980 numbers
Test #15:
score: 0
Accepted
time: 673ms
memory: 16892kb
input:
4 249996 99997 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 707358968 0 0 0 165359261 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 301087804 0 0 0 0 ...
result:
ok 348991 numbers
Test #16:
score: 0
Accepted
time: 696ms
memory: 16676kb
input:
4 249996 100000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
output:
0 0 0 0 0 0 0 0 412012733 460047966 0 0 0 94984489 0 0 0 0 1010860949 0 0 0 336953687 0 0 0 0 0 655564155 25780913 662736870 0 0 0 0 0 679917886 0 998313118 0 0 0 0 0 171168202 20014081 336953687 0 0 0 0 1018313742 0 997397452 0 849015355 0 16108473 0 0 0 504340154 0 397006673 0 0 0 0 0 0 290851883 ...
result:
ok 250950 numbers
Test #17:
score: 0
Accepted
time: 715ms
memory: 17236kb
input:
4 249999 99998 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 956381802 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1021925694 922314342 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
result:
ok 300062 numbers
Subtask #5:
score: 12
Accepted
Test #18:
score: 12
Accepted
time: 749ms
memory: 26560kb
input:
5 249997 99997 860563869 428592873 58576739 761578583 47999879 294581118 988847649 569566599 640106250 440172702 178219106 966598261 763325707 846927552 877923116 145156535 246778542 25949847 507939778 116507169 555239769 259969305 328955819 171606729 535970481 121608060 4437163 370976515 713807003 ...
output:
860563869 717285236 452329866 773393204 485721677 965902221 831024341 890990738 455498944 92913689 556500009 102303365 264515518 445496274 654612933 988537886 165104807 364103659 952755344 576499197 775866335 1003839403 606880290 1006459039 1005979559 588810854 592470517 765610807 123827263 86327854...
result:
ok 249997 numbers
Test #19:
score: 0
Accepted
time: 756ms
memory: 16256kb
input:
5 249998 100000 1055401468 532211763 131695513 214363867 831955115 452049333 729606869 69161863 428100767 90941242 729034740 90774107 332674212 930394013 601735907 104187221 1017052616 31513597 868964816 1054507185 926990168 75998133 1039482150 781325037 680316641 471310435 780674964 330142918 10271...
output:
1055401468 532211763 131695513 214363867 831955115 452049333 729606869 69161863 428100767 90941242 729034740 90774107 332674212 930394013 601735907 104187221 1017052616 31513597 868964816 1054507185 926990168 75998133 1039482150 781325037 680316641 471310435 780674964 330142918 1027184688 750941669 ...
result:
ok 249998 numbers
Test #20:
score: 0
Accepted
time: 533ms
memory: 16256kb
input:
5 249999 65535 206222027 1038492265 248834236 84032585 981309757 273118313 589015947 1002433231 482381717 342803573 48417408 196676553 50772773 199061806 637191822 974252922 289297532 48985206 415073252 593023329 9193325 632026989 55397875 918843456 476033799 664362612 383124333 926156312 133237149 ...
output:
206222027 833392802 1064859678 981091415 515434 272673027 861602440 149219399 337930194 4891559 44591399 152134382 169335243 30058725 607153771 505513233 253743469 234136859 357115647 907147166 916304115 322324382 276499053 650082861 987810090 494507870 196056115 1016828459 996842422 602075803 53081...
result:
ok 249999 numbers
Subtask #6:
score: 16
Accepted
Dependency #5:
100%
Accepted
Test #21:
score: 16
Accepted
time: 1385ms
memory: 20972kb
input:
6 249999 99998 234899190 294042590 622374272 592723113 719234312 350081074 842293736 684699037 330659123 145765638 707972395 212219898 665588169 1002656251 377046330 569400576 515159132 246671859 367313733 436193585 1056439739 889727758 441186237 802117710 672761337 1013893805 760105556 959623512 10...
output:
416342969 682608684 897388094 564167584 723521403 277032360 571217154 804968920 345689708 20430886 2669323 397914023 682539746 743678615 902811241 79705781 117866215 29290630 463835109 948618157 996425135 333840809 879030503 756069154 651860206 62844241 563208222 473841643 306068071 945671265 755499...
result:
ok 340922 numbers
Test #22:
score: 0
Accepted
time: 2157ms
memory: 27048kb
input:
6 249999 100000 440794180 373448998 924631752 1029747555 1025197824 772227211 39885098 362601933 28836613 109487897 1065155159 170512808 1054469991 504110707 412993411 172546234 861597564 320825471 551313957 607675657 108258007 713412450 183442416 266654936 968422736 230720896 824830683 653610670 10...
output:
98475211 195528780 696822840 514087003 829956911 329558613 774154603 206369270 459595700 862203687 923064620 893978487 446169540 162819606 623685563 362210402 266466497 536712664 619196444 636251427 621982108 29822991 825999568 1023819390 976493671 1002043855 522408337 819431256 487829199 839724281 ...
result:
ok 258991 numbers
Test #23:
score: 0
Accepted
time: 2067ms
memory: 16796kb
input:
6 249997 99996 858874420 647336645 792849435 487078011 572740439 880018128 888095353 792485726 562377029 925278515 769802546 863097170 1024187886 86325040 278572503 296068408 305389187 156383560 564344122 985485618 352643959 100128572 51313514 939087520 196935800 175799309 561623994 704660004 265677...
output:
432854594 738728738 262426424 538231132 618966731 444275244 553066863 973600567 229016163 137911233 474170208 151027732 489894673 52703384 860246793 29393762 677235209 677602352 528898618 55456646 169243833 468519972 485795189 732890985 359625381 702665297 407151543 225249034 52286602 259376944 8254...
result:
ok 316451 numbers
Test #24:
score: 0
Accepted
time: 940ms
memory: 22056kb
input:
6 249996 99998 397969543 991721013 639702540 604481296 351426688 333740122 724850461 729736402 79245133 118976945 532880690 120525599 614643743 490724539 699303708 215416342 87908710 952073016 139568877 646769946 252759252 177392171 163619316 265404108 1038973785 470689235 333983939 483290379 506253...
output:
754257332 1052657251 965428426 49222948 557704117 889334077 162967177 294432927 874425580 892648866 412985497 714268964 951853077 64552159 353730625 303006842 751382734 843554529 77391004 575486290 608292876 351321372 429291997 40738032 302573118 696246768 219586525 303187951 464261520 207417065 940...
result:
ok 317038 numbers
Test #25:
score: 0
Accepted
time: 1064ms
memory: 17932kb
input:
6 249998 99999 74522082 95255299 47435923 65293311 383519294 730856524 280602586 438150212 797041603 855416036 351530040 132807245 542585310 141165127 621841979 482556601 64204348 505740339 462640304 741843044 862320843 658389156 400859300 211413099 262112183 559589336 1020279140 419610155 7952237 8...
output:
1045894056 630057317 929438146 334646479 346277018 348756210 981696510 903965260 25853408 1064725614 1002783967 676558112 133571240 729988430 561338032 29334387 773547167 92854356 301810906 127798863 1067419577 48822296 572267332 888557141 411790443 782015691 296921318 861559634 526869577 249098463 ...
result:
ok 317041 numbers
Test #26:
score: 0
Accepted
time: 573ms
memory: 16568kb
input:
6 249998 99997 577746632 849120672 736337072 70635835 1013824888 1021260621 541416538 1005818681 278158852 893179416 959378713 834506551 88091311 524975252 624021199 343226213 405214456 366338193 747080860 620032308 395804065 67500831 684949729 1024468310 633953451 714771601 102914368 82038716 10389...
output:
706515843 840382939 308759114 794493220 26217834 598937432 701146310 358149620 300917798 445590452 213060422 925053200 288408262 554925044 132231526 588760212 774258858 113417756 82987278 149295032 3610090 265306580 883044706 257188428 671846846 258199312 489653506 965163452 87049738 359044380 45775...
result:
ok 317039 numbers
Test #27:
score: 0
Accepted
time: 2018ms
memory: 16756kb
input:
6 249998 100000 634924332 130071305 345967772 29577538 897204306 852816395 507355338 816369280 1058372196 1039530725 225035235 1001646366 706532591 139562806 151046291 666098137 464965567 848982745 999568327 925760429 152064227 621233133 401251501 876360663 529097894 195375821 289367217 751641045 35...
output:
383000531 1017346284 325626122 695917821 705132789 90722032 97893415 308759240 431359599 438441373 960506652 214053236 399084533 84622208 861963168 521868009 577802595 647595327 871097082 250561060 341202823 652714801 1020990292 104653506 713664830 1043687822 871264432 403461930 921298687 780777098 ...
result:
ok 300095 numbers
Subtask #7:
score: 11
Accepted
Dependency #5:
100%
Accepted
Test #28:
score: 11
Accepted
time: 2436ms
memory: 21988kb
input:
7 249999 99998 1028875149 290751586 85260062 527433830 11253389 381520904 163374626 882045937 328797576 362761070 107207247 721987314 848366187 492948114 913994419 980121735 553555299 238308272 517289115 493658637 535863518 18389830 59694996 328276770 970756488 409396240 782649706 568544673 92874299...
output:
1028875149 738715631 944215187 442824568 301937391 208850429 326346711 949048384 530229817 360046897 113798338 662976437 1038450827 77462178 408152765 715534355 971679612 157215891 311073633 592050299 123595235 1003261179 822447669 966766090 711357766 488633610 854837708 587478280 758571291 10388445...
result:
ok 249999 numbers
Test #29:
score: 0
Accepted
time: 696ms
memory: 16576kb
input:
7 250000 99998 68776396 519381483 967158007 157650177 569513143 170186723 329178420 121791809 611207883 4984898 668763787 598163713 1067063994 73036043 445005646 777536482 1071223412 711474045 512588044 150106310 84537131 583523355 991697048 704428493 1040325967 695429796 248804866 405113944 8955700...
output:
68776396 451694631 1035786555 707556817 636183931 825922419 265294008 354815728 544684807 1053690542 1041110395 175499474 1042232586 785949259 696187148 979469550 1002496952 257816878 484979267 702731538 523966500 54856010 277941363 600194134 564966460 1007604812 797742414 138134944 262931849 730450...
result:
ok 250000 numbers
Test #30:
score: 0
Accepted
time: 2112ms
memory: 20820kb
input:
7 249997 99997 597183909 680101817 292954814 211421060 322240152 582982668 261783670 350567227 690037262 665337267 214181897 200518471 817281670 553043840 562097559 36896281 153617858 166007682 919116929 500935009 642844867 876022540 147528553 447604240 272016329 28978861 747757614 112386136 5414641...
output:
597183909 185715228 292954814 895853187 37936166 553467946 21126100 720689625 165437988 548176949 1033516728 268911522 245848164 42031800 496986717 505377734 115080393 320037524 8447838 84209644 692547061 135333692 103154939 331647431 65501326 604960963 472833001 216393214 560453260 514521781 346023...
result:
ok 249997 numbers
Test #31:
score: 0
Accepted
time: 2853ms
memory: 18052kb
input:
7 250000 99998 448881889 860688996 573487325 501725480 82207547 365466204 111713682 265756761 150179737 873496281 847554992 121243005 493490008 335806025 1054184887 221928483 98453014 993533271 264435810 650583574 54232494 956669682 151684782 650423140 503351870 451693638 335380441 476842585 5789527...
output:
448881889 860688996 573487325 1070137845 62963442 1065638443 962698343 265756761 926584428 53145781 844631389 833680312 919444669 819251611 228216850 901320877 843271188 844229702 45197181 338940316 983349996 314621672 700949658 149399591 825587888 238508532 189693444 327451919 176433288 354458160 6...
result:
ok 250000 numbers
Test #32:
score: 0
Accepted
time: 2755ms
memory: 22372kb
input:
7 249998 99997 547007742 509093478 92080843 368117206 919862472 375917150 424662519 525029880 440047984 1025000696 932314846 285515394 164841215 390692110 6412328 797713131 944025279 534448825 1023285696 692312046 260461368 55543634 834032845 662470531 736141364 551086449 346792889 100321507 4569228...
output:
547007742 509093478 455421101 277614365 589494558 60362632 424662519 179983406 753493432 82601881 786311977 240111482 899879636 162894114 46530214 751948231 587497894 611222719 1026063420 125323473 32643939 995589495 63389116 1005201515 695130788 1060664077 838309277 40305139 166274187 452500877 727...
result:
ok 249998 numbers
Test #33:
score: 0
Accepted
time: 2811ms
memory: 18292kb
input:
7 250000 99997 562413573 834049947 408675594 795659456 400823146 935313070 432349725 73792611 423917761 783162558 61472281 339796225 536937096 1066637142 869886618 188301639 797581692 319235651 259285887 328309280 181691545 398762900 995340004 494956219 1050273053 15601556 606224678 500209796 359266...
output:
562413573 834049947 408675594 517626715 550714016 255287556 966692825 623378900 423917761 177229081 882317931 157377955 122626377 582095860 957581519 367511930 394479318 94512312 1044965919 348268657 188270399 6795561 604484142 833487752 762204463 132792750 505784013 308519604 831637499 71789851 216...
result:
ok 250000 numbers
Test #34:
score: 0
Accepted
time: 790ms
memory: 16296kb
input:
7 249999 100000 302448361 57136927 811790644 140050867 771930139 171529339 881027903 513211210 928072261 592513846 652835668 567734554 205221274 834498580 943482823 606941191 693560976 855105562 944712493 451533111 932510172 251195533 549703772 454765070 1016453234 239382258 181843560 562871347 6850...
output:
302448361 291580406 576983005 693819761 1006913266 895141270 954588409 661955940 626506924 90267781 870069964 979704396 124676397 484217195 492498869 366750743 995104889 180367228 863879776 274542049 583424446 395823693 1051408580 482845431 815039054 739315855 344364395 451514887 233614746 76085943 ...
result:
ok 249999 numbers
Subtask #8:
score: 29
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
Dependency #7:
100%
Accepted
Test #35:
score: 29
Accepted
time: 1854ms
memory: 15476kb
input:
8 250000 99997 152956208 457940348 723087408 395639970 717515656 379648511 586461651 493072122 740040289 469101036 658510264 725888675 209014286 451273441 611882960 935843549 535373342 310785473 382955341 236461610 282703204 487959212 287241888 247937612 452005360 518718723 977423225 761371714 24456...
output:
770552915 231903440 161817952 1003820435 972053102 782967631 196700810 746225563 490444187 546021801 324582001 615121747 933898679 589857050 823623524 348577304 568278505 401284784 508001095 638656454 617630112 695467294 313817985 670789353 136323484 362939009 790427065 106346425 470732347 281680898...
result:
ok 300009 numbers
Test #36:
score: 0
Accepted
time: 1719ms
memory: 10508kb
input:
8 250000 99998 483493859 224985217 692593344 939579243 132512644 566962731 573512128 451822668 184262429 627618225 990842838 738829070 745694008 565951085 330289193 852329387 758783390 451822840 61443875 687131483 967063895 86782763 304552557 1035688086 925047468 161601566 7522544 357467927 10240233...
output:
386126574 739546145 279328936 344816130 906833164 473440739 385929063 88466238 671310061 577195970 381063842 991388754 862844017 288857685 974781929 737277401 444048020 273017242 344826843 194978143 485842319 325750702 433859936 820423022 220513348 1018264155 681211011 543010491 57174163 327890018 3...
result:
ok 259135 numbers
Test #37:
score: 0
Accepted
time: 1086ms
memory: 12352kb
input:
8 250000 99998 526902620 346585975 317509459 713918328 482028902 877112108 674315062 153469543 679075944 112562751 198383395 911685518 485250709 758097269 778676590 37172180 1017592931 687882707 536410284 571858012 748507782 506395806 434176947 721511051 879614453 390129499 932194711 465858567 97822...
output:
732304781 488069629 859027182 208695478 512503643 62350816 195023291 352671096 876605497 855666802 533291944 239542493 480247565 679494740 752484752 222723554 797997664 991644880 930401943 902694053 271441568 652524171 816991134 645515920 928645134 830028920 306392485 746673866 592162616 704773065 4...
result:
ok 317042 numbers
Test #38:
score: 0
Accepted
time: 1054ms
memory: 11716kb
input:
8 249998 99996 1056737598 624739358 63643587 712080756 66368657 68323182 818611809 189353242 372519475 482547976 840583625 105226190 696313386 756951682 718595616 838159683 354361529 500183472 584430538 108191087 299822695 940751016 112408428 536304775 1019084792 779957694 641789421 10984192 3852447...
output:
734099331 954642334 969116274 325852508 637603631 10720097 663606640 835953886 1023730721 482605938 665351158 152078440 29649674 193701638 485675891 715473263 374885087 41117365 750020447 852337624 302861799 703419279 541691146 9716039 870774595 458286584 242161258 992241471 1072214782 887109958 214...
result:
ok 317038 numbers
Test #39:
score: 0
Accepted
time: 1950ms
memory: 11120kb
input:
8 249997 99999 550926270 919566720 166218764 381300465 511325165 801598734 786590231 331957541 139709074 440492058 1017472828 563781347 601738310 289744653 774684853 767502133 609528546 452857744 871686394 552165988 877939070 943033484 795521988 296545783 753571956 425244202 938224140 169713850 5812...
output:
696320672 194238711 679487804 779220608 45578820 909422077 636744631 793940247 430180423 380120991 795357479 415365753 608442823 120274898 327335059 380573804 486975953 346010506 560001054 596133665 72911619 202146359 1034095294 528311352 683712803 464100320 912763855 235728308 35396064 356307966 66...
result:
ok 300064 numbers
Test #40:
score: 0
Accepted
time: 1124ms
memory: 11896kb
input:
8 249998 99998 384210603 474467887 625288904 884707961 480871459 15094790 865920389 576148009 361322985 316556457 895754496 975142974 170269614 654533400 499589258 506199384 308814946 571653525 767242933 1030666585 515912247 36788641 58549584 512810849 828961437 404696061 93649261 462837201 56456864...
output:
38383896 1041742484 941001638 310957691 369767972 516128034 221732385 983329482 552490702 946571781 344801718 313641436 438350446 661903142 251171106 320084253 208031847 801761432 956858764 988044995 1052975513 864500806 318829227 20057819 967460217 563802074 904202753 236587306 1017308233 464729666...
result:
ok 341083 numbers