QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#649895 | #8557. Goldberg Machine | caijianhong | AC ✓ | 713ms | 83008kb | C++23 | 4.4kb | 2024-10-18 11:24:00 | 2024-10-18 11:24:00 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#define debug(...) fprintf(stderr, ##__VA_ARGS__)
#else
#define endl "\n"
#define debug(...) void(0)
#endif
using LL = long long;
namespace ds_bf {
int c[200010];
void add(int l, int r, int k) {
if (l > r) return ;
for (int i = l; i <= r; i++) c[i] += k;
}
LL sum(int n, int k) {
LL res = 0;
for (int i = 1; i <= n; i++) res += min(k, c[i]);
return res;
}
int select(int n, LL k, int idx) {
assert(idx > 0);
for (int i = 1; i <= n; i++) if (c[i] <= k && --idx == 0) return i;
return -1;
}
};
namespace ds {
constexpr int B = 1400, N = 1e5 + 10;
struct block {
int elem[B], tag, ptr[N], val[B];
LL psm[B];
block() {
memset(elem, 0, sizeof elem);
memset(val, 0, sizeof val);
memset(psm, 0, sizeof psm);
tag = 0;
fill(ptr + 1, ptr + N, B);
}
void add_value(int v) { ++val[--ptr[v + 1]]; }
void del_value(int v) { --val[ptr[v]++]; }
void buildsum() {
psm[0] = val[0];
for (int i = 1; i < B; i++) psm[i] = psm[i - 1] + val[i];
}
void _add(int l, int r) {
for (int i = l; i <= r; i++) add_value(elem[i]++);
buildsum();
}
void _del(int l, int r) {
for (int i = l; i <= r; i++) del_value(elem[i]--);
buildsum();
}
void add(int l, int r, int k) { return k == 1 ? _add(l, r) : _del(l, r); }
LL calc(int k) { // sum_x min(x, k) [WA]
int pos = k >= tag ? ptr[k - tag] : 0;
return (pos ? psm[pos - 1] + 1ll * pos * tag: 0) + 1ll * (B - pos) * k;
}
int count(int k) { // sum_x [x <= k]
return k + 1 >= tag ? ptr[k - tag + 1] : 0;
}
int select(int k, int idx) { // idx-th x, x <= k
for (int i = 0; i < B; i++) if (elem[i] <= k - tag && --idx == 0) return i;
throw logic_error("ds::block::select: wrong argument");
}
} blk[N * 2 / B + 10];
void add(int l, int r, int k) {
debug("add(%d, %d, %d)\n", l, r, k);
if (l % B && (l / B + 1) * B - 1 <= r) blk[l / B].add(l % B, B - 1, k), l = (l / B + 1) * B;
while (l + B - 1 <= r) blk[l / B].tag += k, l += B;
if (l <= r) blk[l / B].add(l % B, r % B, k);
}
LL sum(int n, int k) {
LL res = 0;
for (int i = 0; i * B <= n; i++) res += blk[i].calc(k);
debug("sum(%d, %d) = %lld\n", n, k, res);
return res;
}
int select(int n, int k, int idx) {
++idx;
for (int i = 0; i * B <= n; i++) {
if ((i + 1) * B <= n && blk[i].count(k) < idx) idx -= blk[i].count(k);
else return blk[i].select(k, idx) + i * B;
}
throw logic_error("ds::select: wrong argument");
}
};
int n, dfn[100010], rdel[100010], ptr[100010], fa[100010], cnt, siz[100010], rnk[200010], q;
vector<int> g[100010];
void dfs(int u, int _fa) {
if (u != 1) {
int &pos = rdel[u] = (int)(find(g[u].begin(), g[u].end(), _fa) - g[u].begin()), c = (int)g[u].size();
pos = (pos + 1) % c, ptr[u] = (ptr[u] - pos + c) % c;
rotate(g[u].begin(), g[u].begin() + pos, g[u].end());
}
dfn[u] = ++cnt, siz[u] = 1, fa[u] = _fa, rnk[cnt] = u;
for (int v : g[u]) if (v != _fa) dfs(v, u), siz[u] += siz[v], rnk[++cnt] = u;
}
void update_t(int u, int k) {
int l = dfn[u] + 1, r;
if (u > 1 && ptr[u] + 1 == (int)g[u].size()) r = dfn[u] + siz[u] * 2 - 2;
else r = dfn[g[u][ptr[u]]] - 1;
r = min(r, cnt);
if (l <= r) ds::add(l, r, k);
}
int main() {
#ifndef LOCAL
cin.tie(nullptr)->sync_with_stdio(false);
#endif
cin >> n;
for (int i = 1, c; i <= n; i++) {
cin >> c >> ptr[i];
g[i].resize(c);
for (int j = 0; j < c; j++) cin >> g[i][j];
}
dfs(1, 0), --cnt;
for (int i = 1; i <= n; i++) update_t(i, +1);
cin >> q;
while (q--) {
char op;
cin >> op;
if (op == 'C') {
int x, y;
cin >> x >> y;
update_t(x, -1);
int c = (int)g[x].size();
ptr[x] = (y - rdel[x] + c) % c;
update_t(x, +1);
} else {
LL k;
cin >> k;
++k;
int now = 0;
auto calc = [&](int now) { return 1ll * cnt * now - ds::sum(cnt, now); };
for (int j = __lg(n); j >= 0; j--) if (calc(now + (1 << j)) < k) now += 1 << j;
debug("k = %lld, calc(%d) = %lld\n", k, now, calc(now));
if (now >= n) cout << rnk[(k - calc(now) - 1) % cnt + 1] << endl;
else cout << rnk[ds::select(cnt, now, k - calc(now))] << endl;
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 3ms
memory: 69104kb
input:
7 2 0 2 3 3 0 1 4 5 3 0 1 6 7 1 0 2 1 0 2 1 0 3 1 0 3 5 Q 10 C 2 1 Q 10 C 3 2 Q 10
output:
1 4 1
result:
ok 3 number(s): "1 4 1"
Test #2:
score: 0
Accepted
time: 8ms
memory: 71236kb
input:
2 1 0 2 1 0 1 10000 Q 330436 Q 980610 Q 275 Q 22846 Q 85515 Q 339826 Q 647638 Q 689585 Q 153103 Q 934080 Q 633096 Q 431962 Q 692869 Q 914798 Q 436671 Q 832351 Q 78371 Q 328899 Q 727824 Q 351781 Q 819165 Q 267140 Q 722576 Q 133777 Q 414375 Q 205621 Q 160403 Q 445832 Q 628729 Q 532763 Q 934703 Q 80779...
output:
1 1 2 1 2 1 1 2 2 1 1 1 2 1 2 2 2 2 1 2 2 1 1 2 2 2 2 1 2 2 2 1 2 1 2 1 2 1 1 2 2 2 1 1 2 2 2 2 1 1 2 2 2 1 2 2 1 2 1 2 2 2 2 1 2 1 2 1 2 2 2 2 1 1 2 1 1 1 2 1 1 1 2 1 2 1 1 2 2 1 2 2 1 1 1 1 2 1 2 2 2 1 2 1 1 1 2 1 2 2 2 1 1 2 2 2 1 1 2 1 1 1 2 1 1 1 1 1 2 2 2 2 1 2 1 1 2 1 2 1 1 2 2 1 1 2 2 1 1 1 ...
result:
ok 10000 numbers
Test #3:
score: 0
Accepted
time: 24ms
memory: 69280kb
input:
3 2 1 2 3 1 0 1 1 0 1 100000 C 2 0 C 2 0 Q 145832 C 3 0 Q 19924 Q 443533 C 1 0 C 1 0 C 3 0 C 2 0 C 3 0 Q 635031 Q 280859 Q 509745 C 1 1 Q 262631 Q 340848 C 2 0 C 3 0 C 2 0 C 2 0 Q 775790 Q 614349 C 2 0 Q 684238 Q 797643 C 1 1 C 1 1 C 3 0 C 2 0 C 1 0 Q 669611 Q 257133 Q 631101 Q 731654 C 2 0 Q 942620...
output:
1 1 3 3 3 2 2 1 1 3 1 2 3 2 2 1 1 3 2 2 2 3 1 3 3 3 3 1 2 1 2 2 1 1 2 2 1 1 1 3 2 2 1 3 3 1 2 1 2 3 1 3 2 1 1 1 3 1 1 1 2 1 3 2 1 1 2 1 2 1 3 3 3 1 3 2 1 2 2 1 2 2 1 3 3 3 1 1 1 3 1 3 3 1 1 1 2 1 1 1 1 1 1 1 1 1 3 3 1 2 1 3 1 1 3 3 1 2 1 3 3 1 2 3 2 1 3 2 2 3 2 1 1 3 1 1 1 1 3 3 1 3 2 1 2 3 1 1 1 1 ...
result:
ok 50039 numbers
Test #4:
score: 0
Accepted
time: 40ms
memory: 71152kb
input:
100 3 1 2 7 3 5 2 12 82 1 45 5 6 4 50 4 83 9 1 6 4 2 16 22 59 3 4 3 11 2 10 21 5 2 20 27 3 14 60 4 0 53 1 13 8 6 5 56 39 15 96 7 68 4 0 80 3 18 31 6 2 48 30 5 65 24 36 2 1 5 23 3 0 2 81 33 3 2 7 37 17 3 1 69 73 6 4 2 78 26 8 19 2 0 4 54 2 1 13 100 5 4 61 57 9 28 32 2 1 29 15 2 0 66 6 2 0 5 35 4 0 25...
output:
15 10 8 5 11 71 13 12 2 7 49 17 16 23 20 45 20 3 39 10 36 59 90 76 8 96 65 14 59 24 30 69 55 56 40 4 69 39 22 53 4 57 45 77 7 2 21 42 53 48 19 5 2 29 85 5 3 82 69 39 67 30 61 39 31 85 39 3 39 49 84 5 93 49 17 75 60 40 70 88 42 18 3 63 54 22 39 39 39 9 1 7 22 17 36 2 48 24 61 95 31 16 10 96 77 14 13 ...
result:
ok 50092 numbers
Test #5:
score: 0
Accepted
time: 268ms
memory: 70764kb
input:
10000 1 0 2 2 1 3 1 2 0 4 2 2 0 5 3 2 0 6 4 2 1 7 5 2 1 6 8 2 1 7 9 2 1 8 10 2 1 11 9 2 1 12 10 2 1 11 13 2 1 14 12 2 0 15 13 2 1 14 16 2 0 15 17 2 1 18 16 2 1 17 19 2 1 18 20 2 1 19 21 2 0 20 22 2 1 21 23 2 1 24 22 2 1 23 25 2 1 24 26 2 0 27 25 2 0 26 28 2 0 27 29 2 1 28 30 2 1 31 29 2 1 32 30 2 0 ...
output:
3695 1238 8636 8591 2895 2667 4000 3585 8805 6970 693 1129 9441 4828 1860 8041 7027 3334 826 3833 7100 145 3356 1195 9411 5003 1050 7925 5316 8514 5282 2349 9669 5638 1680 1593 568 2541 71 9748 2000 8123 6526 9624 5372 8597 600 8168 1137 7137 5992 6263 5121 3854 7322 2048 995 6513 4767 6323 3397 521...
result:
ok 49942 numbers
Test #6:
score: 0
Accepted
time: 105ms
memory: 71208kb
input:
30000 29999 8267 1430 15644 27896 12799 17006 2477 8579 14556 4736 23952 25221 4682 5439 25328 2601 11013 27331 13683 20234 23304 22969 10465 7534 10799 23752 11252 19644 9199 28411 6470 13255 27985 548 18397 14573 433 11968 24502 16871 15844 5273 28520 4849 14604 6927 8161 5450 2693 18229 10077 121...
output:
1 1 1 18571 1 1 1 1 20202 1 608 15018 1 26493 1 6195 1 3238 5442 27989 1 1 13461 1 27683 1 22468 1 10644 16048 5627 1 25230 1 1 11300 1 21716 1 1 1 1 4579 19435 10620 16302 8473 1 1 11022 1 1 1 1185 24354 1207 26583 5269 5527 1 23873 27349 1 9017 1 1 8809 11374 1 1 16028 1 1 1 1 2176 1 11776 2947 89...
result:
ok 49891 numbers
Test #7:
score: 0
Accepted
time: 431ms
memory: 74748kb
input:
100000 7 3 2 8 9 20 79 239 71974 13 0 1065 275 3 138 4 1652 14 13 54296 1 22924 7635 74 10 8 7 5 100 3207 133 643 21907 107 2 63 18 14 2 55 366 1942 1576 11026 51606 12 216 139 352 6 11079 802 5046 981 6331 1636 8 2 135 32774 16 3143 935 386 12955 3 13 2 161 26 10499 99 35999 19850 17 28 12452 2172 ...
output:
18439 14335 45004 43239 59748 23528 56515 19365 45470 26160 2641 17013 78320 36589 2365 22421 97194 56822 16187 7339 90363 5571 36861 27472 25475 13633 22657 60111 21057 65937 46096 2561 52219 58465 83093 22296 50485 27638 24917 21651 79646 97340 1594 72475 592 19419 17700 13280 48452 40357 127 1872...
result:
ok 50048 numbers
Test #8:
score: 0
Accepted
time: 623ms
memory: 82588kb
input:
100000 1 0 2 2 1 1 3 2 0 4 2 2 1 5 3 2 0 4 6 2 0 5 7 2 0 8 6 2 0 9 7 2 1 8 10 2 1 9 11 2 0 12 10 2 1 13 11 2 0 12 14 2 1 13 15 2 0 14 16 2 1 15 17 2 0 18 16 2 1 17 19 2 0 18 20 2 1 19 21 2 1 20 22 2 1 21 23 2 1 22 24 2 0 23 25 2 0 24 26 2 1 25 27 2 1 26 28 2 1 29 27 2 1 28 30 2 0 31 29 2 1 30 32 2 1...
output:
2885 4325 9434 5555 603 7506 2646 9700 8046 4664 3154 1765 4310 3571 2212 6661 3501 11509 5405 3416 2889 1766 7635 11761 7510 1692 10988 2205 702 8881 8984 2629 3499 1465 8412 7473 2617 2476 5001 8310 7617 7729 4343 3586 3585 6303 2970 12619 5642 5976 9512 5667 2777 1669 252 9621 7284 5900 10198 134...
result:
ok 49785 numbers
Test #9:
score: 0
Accepted
time: 665ms
memory: 82296kb
input:
100000 1 0 2 2 0 3 1 2 1 2 4 2 1 3 5 2 0 6 4 2 0 5 7 2 0 8 6 2 0 7 9 2 1 8 10 2 1 9 11 2 1 12 10 2 0 13 11 2 1 12 14 2 1 13 15 2 0 14 16 2 0 15 17 2 1 16 18 2 0 19 17 2 1 20 18 2 1 19 21 2 0 20 22 2 1 21 23 2 0 24 22 2 1 23 25 2 0 26 24 2 1 27 25 2 0 26 28 2 0 29 27 2 0 30 28 2 1 29 31 2 1 32 30 2 1...
output:
3670 6153 9873
result:
ok 3 number(s): "3670 6153 9873"
Test #10:
score: 0
Accepted
time: 580ms
memory: 82288kb
input:
100000 1 0 2 2 0 3 1 2 0 4 2 2 0 5 3 2 1 4 6 2 0 5 7 2 1 8 6 2 0 9 7 2 0 8 10 2 1 9 11 2 1 12 10 2 0 11 13 2 0 14 12 2 1 13 15 2 1 16 14 2 1 17 15 2 1 16 18 2 1 17 19 2 1 20 18 2 0 19 21 2 0 22 20 2 1 21 23 2 0 22 24 2 0 23 25 2 0 26 24 2 0 27 25 2 0 28 26 2 1 29 27 2 0 30 28 2 0 31 29 2 1 30 32 2 0...
output:
1865 5173 4231 3824 2816 5206 259 9625 3929 9453 248 1668 1012 6207 425 1279 4904 521 10607 10006 5049 8777 10003 1907 4277 904 2421 6627 59 11822 592 2854 6447 6043 3223 10621 5050 8687 3180 4171 140 4864 10884 4397 9625 1758 3015 2798 145 322 1402 1085 9711 10 12632 5957 5119 1517 57 1164 1055 565...
result:
ok 100000 numbers
Test #11:
score: 0
Accepted
time: 375ms
memory: 74508kb
input:
100000 99999 36711 30216 83568 53589 70552 48020 83548 8778 66470 99883 31710 13373 28251 7762 70246 25975 96788 43748 36740 38961 61123 28190 55349 41291 36613 58999 25852 22101 26709 7042 28351 32052 64049 22449 74417 76416 84639 48283 7623 98190 42028 79488 26334 22246 45682 90088 39564 75448 609...
output:
1 1 97598 1 1 1 1 1 1 95094 1 1 56528 17028 34655 19440 76213 1 84504 1 30185 66756 32615 48434 54733 40724 1 41835 51607 8113 1 1 31575 1 48399 95326 95329 1 1 98730 1 32825 1 96823 1 1 85701 1 1 62886 42964 1 1 1 77715 86595 74535 1 53107 1 36507 1 1 36579 48954 36464 1 67934 8303 2939 1 19646 738...
result:
ok 49736 numbers
Test #12:
score: 0
Accepted
time: 29ms
memory: 75504kb
input:
100000 99999 10988 16277 12061 5931 29342 97610 38018 15247 55295 90645 84564 47826 20917 32487 75812 50061 91400 63205 90164 49983 2053 94325 50728 74387 43410 43658 22899 83531 20811 34679 54305 12826 73750 16432 46610 13790 31012 55790 49036 75438 42383 21846 94854 79072 20878 47269 63181 27690 9...
output:
1 6075 1 88275 1
result:
ok 5 number(s): "1 6075 1 88275 1"
Test #13:
score: 0
Accepted
time: 713ms
memory: 74820kb
input:
100000 99999 86397 841 19907 67424 99294 63291 28910 86038 83665 93909 20005 23363 19665 46786 35788 79100 87398 40990 56701 87323 13825 84982 25879 79819 98526 15035 57040 98657 52166 71034 90022 89944 70371 10047 76247 65024 47305 39833 845 87410 86004 64828 93906 73667 78907 45354 42176 14480 251...
output:
83989 846 1 1 58395 1 74572 91089 99847 61164 1 1 79626 74091 1 1 1 12541 27459 6852 1 45648 1 1 1 1 1 77223 33099 14568 1 1 1 1 6176 1 1 1 1 97480 34114 1 1 68804 1 1 1 18788 31154 1 95839 3880 1 1 35419 79041 52983 9189 2608 1 1 1 1 1 20537 1 1 1 1 94427 21340 1 1 3904 1 1 49680 1 72852 1 75108 13...
result:
ok 99997 numbers
Test #14:
score: 0
Accepted
time: 451ms
memory: 74784kb
input:
100000 1 0 2 3 1 3 4 1 3 0 6 5 2 3 1 7 8 2 3 2 3 10 9 3 0 3 11 12 3 0 13 14 4 3 0 15 4 16 3 1 17 5 18 3 0 19 5 20 3 2 6 21 22 3 0 24 6 23 3 0 7 25 26 3 2 28 7 27 3 1 30 29 8 3 0 31 32 8 3 2 34 33 9 3 1 36 9 35 3 1 37 10 38 3 1 39 10 40 3 2 11 42 41 3 0 11 44 43 3 2 46 45 12 3 0 48 47 12 3 2 13 49 50...
output:
14295 16549 29568 67323 27208 95998 48783 45821 41964 61152 94993 14226 3826 22908 97535 5347 42415 22033 3324 93943 2441 57350 15960 8475 75670 77139 16611 56615 25671 62893 2705 31587 4554 48148 15629 13186 33990 86000 63741 32710 92033 448 86625 99247 73310 47478 25668 84600 7115 15000 72890 9716...
result:
ok 49699 numbers
Test #15:
score: 0
Accepted
time: 391ms
memory: 74864kb
input:
100000 422 40 818 15 40171 2936 10496 582 3470 36469 631 210 121 17534 2246 946 4914 56943 15356 18 4773 15239 1857 132 31776 2905 18435 5812 23 7327 5375 1332 1289 152 3 61 27933 40 21657 282 161 28328 43 4256 9324 31655 12 65 88673 86455 92 8360 130 656 67 100 1057 22 32416 54 41 330 63 12044 47 1...
output:
23565 64 12 163 98210 89800 86 304 19315 82 281 63160 78304 5390 423 21869 29619 1 9469 16835 2640 49126 248 23 604 82182 277 99350 97 296 44470 29093 21 3321 12 21 99124 99099 614 60 593 4898 21 38803 74198 244 48580 551 66 406 8936 61 94 99802 31879 188 52273 22 16852 100 48 357 98288 59274 157 4 ...
result:
ok 49966 numbers
Test #16:
score: 0
Accepted
time: 516ms
memory: 74444kb
input:
100000 1 0 2 2 0 1 3 2 1 2 4 2 1 5 3 2 1 6 4 2 0 7 5 3 2 8 6 9 2 0 10 7 2 0 11 7 1 0 8 3 1 9 12 13 2 1 11 14 1 0 11 3 0 16 15 12 2 0 17 14 3 2 18 19 14 1 0 15 3 2 21 20 16 1 0 16 2 0 22 18 2 0 18 23 2 0 24 20 3 1 26 25 21 2 0 22 27 1 0 23 3 0 28 29 23 1 0 24 2 0 32 26 4 1 33 26 30 31 2 0 29 34 1 0 2...
output:
40325 42383 4928 49777 52357 15609 93493 67803 20263 2176 77865 4268 46113 11544 43079 53573 17387 8033 12923 33109 98299 90274 63574 53658 53734 78560 87349 96577 61023 83590 10066 89936 23849 83078 26296 9453 48304 7936 81199 42249 63527 4952 27417 19181 59761 51749 17056 48761 67768 1210 70947 76...
result:
ok 49798 numbers
Test #17:
score: 0
Accepted
time: 437ms
memory: 74776kb
input:
100000 6 0 30177 51228 36147 87113 35925 60676 1 0 65525 1 0 80891 2 0 52211 74964 1 0 97645 1 0 8586 1 0 55213 2 0 7055 97235 1 0 37916 1 0 3204 1 0 47913 1 0 22868 2 1 93162 49894 2 1 78118 34510 1 0 58772 2 1 80295 90574 5 3 26674 523 33228 54239 15838 1 0 96723 1 0 42558 1 0 88016 1 0 26964 2 0 ...
output:
50335 72775 18924 91311 50363 91517 36332 5624 57527 65550 73553 25141 34174 30723 59024 41460 87234 82399 43845 6931 13688 98238 45510 14793 22030 23003 5832 32243 4162 7087 75950 19590 40757 90956 42635 98873 52200 24418 40571 14949 28698 20291 66222 50672 66310 81383 72001 49892 31886 68936 63587...
result:
ok 49881 numbers
Test #18:
score: 0
Accepted
time: 656ms
memory: 82776kb
input:
100000 1 0 25731 2 0 21901 60136 2 0 88536 91630 2 0 78984 75156 2 1 96993 53131 2 0 38666 12375 2 0 11305 78561 2 0 35011 64607 2 1 1541 65707 2 0 65693 24815 2 0 19161 32581 2 1 68864 24213 2 0 51774 5676 2 0 38237 15679 2 1 71970 60873 2 1 24680 73594 2 0 34627 18348 2 1 20783 41792 2 0 89590 910...
output:
60134 78066 44846 82684 58873 8912 45972 71070 22310 9903 56806 86300 60764 87619 43564 93880 2721 98669 44932 97361 65230 38435 27311 19781 42657 69649 25525 39439 55984 21939 95054 42349 81715 43513 14440 29573 18879 52746 79383 41728 23135 28802 2374 85574 96622 66797 71610 54123 86078 88944 3455...
result:
ok 49834 numbers
Test #19:
score: 0
Accepted
time: 693ms
memory: 82748kb
input:
100000 1 0 89704 2 0 49300 34680 2 0 67341 33194 2 1 16547 61425 2 1 64740 33877 2 0 68045 13796 2 0 4809 12740 2 0 62014 77494 2 0 31138 21693 2 1 2677 28223 2 0 49804 66418 2 1 84608 16971 2 0 68366 32152 2 0 38992 62028 2 0 35347 87475 2 1 2853 75534 2 0 77955 55415 2 1 3191 88816 2 1 58133 449 2...
output:
75740 23706
result:
ok 2 number(s): "75740 23706"
Test #20:
score: 0
Accepted
time: 594ms
memory: 83008kb
input:
100000 1 0 98294 2 0 81011 15382 2 0 29111 33665 2 1 24396 69941 2 0 90794 74126 2 0 51326 48380 2 1 88733 87562 2 0 216 18957 2 0 71920 35262 2 0 23240 24216 2 1 29618 60275 2 1 98579 1791 2 1 21123 73028 2 0 53308 99091 2 1 99481 69658 2 1 39503 23745 2 0 95088 38504 2 0 19938 95361 2 0 28005 4974...
output:
19733 47026 6374 9229 85244 21516 27897 60972 82685 2868 69091 6580 67099 33167 66449 30154 78306 57781 9658 20927 41053 69312 63404 66474 52643 67541 6004 45405 4742 52790 12592 18079 57942 81907 42191 42320 87139 19986 52192 63337 74776 65176 79322 91481 8368 31374 44970 15789 13090 99196 66647 16...
result:
ok 99997 numbers
Test #21:
score: 0
Accepted
time: 386ms
memory: 74784kb
input:
100000 99999 99998 17128 9911 14763 55743 93004 23766 32493 44328 37247 86730 90704 62493 8142 83382 92049 35764 16967 41533 16541 21161 19744 78379 35600 1562 71964 38019 55609 18586 13911 8204 58941 83450 73512 94688 52973 74685 25821 2219 66447 85807 47233 80172 62461 59479 21971 19619 1773 1261 ...
output:
22435 96644 24451 74023 1 61846 1 1 18218 1 1 1 95582 1 1 1 90796 1 14641 1 98532 95521 7341 1 73027 80239 1 1 69877 77302 1 14258 29491 1 56119 1 1 1 79915 1 1 1 98157 1 72851 89278 1 38077 49204 87239 58312 1 1 26970 1 58168 1 1 1 42749 1 1 13128 12894 1 63125 77061 66032 1 62636 96355 1 53246 244...
result:
ok 50167 numbers
Test #22:
score: 0
Accepted
time: 23ms
memory: 75308kb
input:
100000 99999 0 78621 42202 61488 60080 88289 19925 39114 19469 11613 35934 12789 67963 94125 48480 45893 70153 42199 2724 31256 4281 96494 69101 37887 31412 85062 11706 91757 47506 12198 56912 39111 97927 24363 94706 1089 33046 64866 42945 93997 17519 54891 44146 23256 47561 7278 19784 20355 37262 6...
output:
12115 61949
result:
ok 2 number(s): "12115 61949"
Test #23:
score: 0
Accepted
time: 398ms
memory: 75212kb
input:
100000 450 0 20237 50189 70349 34838 73461 1559 43656 92095 11719 14383 18723 88864 55482 26888 44381 98519 44623 65595 62853 46123 21037 4199 9504 26884 85597 28187 50881 98960 11181 90718 42961 38789 63021 57824 49867 98242 26533 97998 15955 18328 62654 86284 56984 27605 65439 86787 77634 55350 46...
output:
26012 98242 67985 45072 45415 71229 12259 25284 44965 52320 80905 50567 11719 96695 93332 88035 21547 77634 97578 34744 82970 72708 87975 11062 22671 74194 2007 26227 25703 23793 54258 7959 9570 43948 81267 18328 67606 42282 78329 39335 80126 75309 45324 82722 26475 34744 73461 88672 96427 52920 278...
result:
ok 49950 numbers
Test #24:
score: 0
Accepted
time: 507ms
memory: 75208kb
input:
100000 1 0 41886 1 0 67296 2 1 39144 84164 2 0 79496 50501 2 1 87819 22151 2 0 61423 57868 1 0 63725 1 0 8923 2 0 6688 42689 3 2 27147 92220 45736 2 1 24263 19648 2 0 38613 95512 1 0 50437 4 0 36184 7516 79605 2358 1 0 57395 5 4 28830 66863 48564 4130 43661 2 1 10911 28703 4 3 46731 56202 1395 39241...
output:
67617 19083 37734 97042 54632 94255 29255 70653 77604 37124 32939 41829 61061 47107 61934 99860 68576 87741 57023 25837 10233 87133 93367 84602 20536 71053 75110 19055 15600 63960 65219 80487 84082 26341 59405 87097 813 93041 42832 22406 90862 44542 80496 66150 57699 87249 49106 15791 81358 43373 27...
result:
ok 49776 numbers