QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#310461 | #7181. Graph Cuts | juruoh | TL | 685ms | 97436kb | C++14 | 3.0kb | 2024-01-21 14:30:28 | 2024-01-21 14:30:29 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int readll() {
int t = 0;
char ch = getchar();
while (ch < '0' || ch > '9') ch = getchar();
while ('0' <= ch && ch <= '9') t = (t << 3) + (t << 1) + (ch - '0'), ch = getchar();
return t;
}
const int maxn = 1e5 + 5;
struct Edge {
int e, nex;
Edge(int e = 0, int nex = 0) : e(e), nex(nex) {}
} E[maxn << 1];
int hd[maxn], tote;
inline void addedge(int u, int e) {
E[++tote] = Edge(e, hd[u]), hd[u] = tote;
}
int n, m, q, eu[maxn], ev[maxn], qx[maxn], ans[maxn], vis[maxn], fl[maxn], qc[maxn];
char qt[maxn];
int eid[maxn];
void solve1(int x) {
for (int i = 1; i <= n; i++) fl[i] = 0, eid[i] = 0;
queue<int> q1, q0;
for (int i = hd[x]; i; i = E[i].nex) {
int e = E[i].e;
if (eu[e] == x) eid[ev[e]] = e, q1.push(ev[e]);
else eid[eu[e]] = e, q1.push(eu[e]);
}
for (int i = 1; i <= q; i++) {
if (qt[i] == '?' && !ans[i]) {
if (fl[x]) {
while (!q1.empty() && (fl[q1.front()] || vis[eid[q1.front()]])) q1.pop();
if (!q1.empty()) ans[i] = eid[q1.front()], vis[ans[i]] = 1, q1.pop();
} else {
while (!q0.empty() && (!fl[q0.front()] || vis[eid[q0.front()]])) q0.pop();
if (!q0.empty()) ans[i] = eid[q0.front()], vis[ans[i]] = 1, q0.pop();
}
} else {
fl[qx[i]] ^= 1;
if (qx[i] == x || !eid[qx[i]] || vis[eid[qx[i]]]) continue;
(fl[qx[i]] ? q0 : q1).push(qx[i]);
}
}
}
void solve2() {
queue<int> que;
for (int i = 1; i <= n; i++) fl[i] = 0;
for (int i = 1; i <= q; i++) {
if (qt[i] == '?' && !ans[i]) {
while (!que.empty() && (vis[que.front()] || fl[eu[que.front()]] == fl[ev[que.front()]])) que.pop();
if (!que.empty()) ans[i] = que.front(), vis[que.front()] = 1, que.pop();
} else {
fl[qx[i]] ^= 1;
for (int j = hd[qx[i]]; j; j = E[j].nex) {
int e = E[j].e;
if (!vis[e] && fl[eu[e]] != fl[ev[e]]) que.push(e);
}
}
}
}
std::vector< pair<int, int> > ls;
int main() {
// freopen("test.in", "r", stdin);
// freopen("test.out", "w", stdout);
n = readll(), m = readll();
for (int i = 1; i <= m; i++) {
eu[i] = readll(), ev[i] = readll();
addedge(eu[i], i), addedge(ev[i], i);
}
q = readll();
for (int i = 1; i <= q; i++) {
char ch = getchar();
while (ch != '+' && ch != '-' && ch != '?') ch = getchar();
qt[i] = ch;
if (qt[i] != '?') qx[i] = readll(), qc[qx[i]]++;
}
for (int i = 1; i <= n; i++) ls.push_back(make_pair(-qc[i], i));
sort(ls.begin(), ls.end());
for (int i = 0; i < min(n, 400); i++) solve1(ls[i].second);
solve2();
for (int i = 1; i <= q; i++) if (qt[i] == '?') printf("%d\n", ans[i]);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 5332kb
input:
4 5 1 2 1 3 1 4 2 3 2 4 10 + 1 + 2 ? ? ? ? ? - 2 ? ?
output:
5 4 3 2 0 1 0
result:
ok q=10
Test #2:
score: 0
Accepted
time: 1ms
memory: 5140kb
input:
0 0 0
output:
result:
ok q=0
Test #3:
score: 0
Accepted
time: 1ms
memory: 5284kb
input:
0 0 1 ?
output:
0
result:
ok q=1
Test #4:
score: 0
Accepted
time: 199ms
memory: 6236kb
input:
1000 2000 1 50 1 88 331 1 1 352 1 497 2 32 2 282 550 2 989 2 334 3 3 665 4 38 4 69 4 343 4 451 589 4 917 4 89 5 5 162 675 5 681 6 7 22 127 7 7 592 7 672 787 7 8 310 107 9 9 137 184 9 9 244 378 9 446 9 9 658 883 9 65 10 75 10 414 10 10 468 686 10 245 11 269 11 11 386 403 11 493 11 394 12 493 12 565 1...
output:
1803 626 917 916 1349 518 147 148 145 1128 1046 843 1415 619 398 399 397 396 1337 1333 733 1746 413 1283 1969 1622 707 269 265 264 263 1880 262 1182 606 1406 73 1043 1928 1917 1850 1814 1636 1877 1838 1857 1212 9 8 1789 103 833 720 613 838 998 1366 1364 1365 1784 1781 1783 1892 996 839 660 1119 1990...
result:
ok q=100000
Test #5:
score: 0
Accepted
time: 633ms
memory: 97296kb
input:
447 99681 2 1 1 3 4 1 1 5 1 6 1 7 1 8 9 1 10 1 1 11 1 12 1 13 1 14 1 15 1 16 17 1 18 1 19 1 20 1 21 1 22 1 23 1 24 1 25 1 1 26 27 1 28 1 1 29 30 1 31 1 1 32 33 1 1 34 1 35 36 1 37 1 38 1 39 1 40 1 1 41 1 42 43 1 44 1 45 1 46 1 1 47 48 1 49 1 1 50 1 51 1 52 53 1 54 1 55 1 1 56 57 1 1 58 59 1 60 1 1 6...
output:
19427
result:
ok q=100000
Test #6:
score: 0
Accepted
time: 658ms
memory: 69404kb
input:
447 99681 1 2 3 1 4 1 5 1 1 6 7 1 8 1 9 1 10 1 11 1 1 12 13 1 14 1 15 1 1 16 1 17 18 1 19 1 1 20 21 1 22 1 23 1 24 1 1 25 26 1 27 1 28 1 1 29 1 30 31 1 32 1 1 33 1 34 35 1 1 36 37 1 38 1 1 39 40 1 41 1 42 1 43 1 1 44 45 1 46 1 47 1 48 1 49 1 50 1 1 51 1 52 1 53 1 54 1 55 56 1 1 57 58 1 1 59 1 60 61 ...
output:
81616 93617 29071 93667 93673 18970 89131 93590 59101 43291 44293 69925 93683 62170 88246 40918 35668 93652 75261 61896 34591 93677 93640 93595 87325 93676 18568 9471 93623 63256 2551 83995 73236 17356 20170 93660 19771 66160 93686 46270 93613 93622 32410 75918 38496 55911 48531 93631 17761 72310 89...
result:
ok q=100000
Test #7:
score: 0
Accepted
time: 592ms
memory: 46036kb
input:
447 99681 1 2 3 1 1 4 1 5 6 1 7 1 8 1 1 9 10 1 11 1 1 12 1 13 1 14 15 1 16 1 17 1 18 1 1 19 1 20 21 1 1 22 23 1 1 24 25 1 1 26 1 27 1 28 29 1 1 30 1 31 32 1 1 33 34 1 1 35 36 1 37 1 1 38 39 1 40 1 1 41 42 1 1 43 44 1 45 1 46 1 47 1 48 1 49 1 50 1 51 1 1 52 53 1 54 1 55 1 56 1 57 1 58 1 59 1 60 1 61 ...
output:
64210 36620 11045 74256 74255 74254 74253 74252 74251 74250 74248 74247 74246 74245 74244 42164 65785 665 56969 74115 40115 74190 60952 55795 74228 74103 74165 74117 74249 74031 25535 74191 23989 74034 5927 74077 31927 74091 65525 22819 56090 74128 37327 29704 74114 74186 74202 66302 67577 10202 628...
result:
ok q=100000
Test #8:
score: 0
Accepted
time: 548ms
memory: 28904kb
input:
447 99681 2 1 1 3 4 1 1 5 6 1 1 7 1 8 1 9 10 1 1 11 12 1 1 13 14 1 15 1 1 16 1 17 18 1 1 19 20 1 21 1 22 1 1 23 24 1 1 25 26 1 27 1 28 1 29 1 30 1 1 31 32 1 33 1 34 1 35 1 1 36 37 1 38 1 39 1 40 1 1 41 42 1 43 1 1 44 45 1 1 46 1 47 48 1 1 49 50 1 51 1 52 1 1 53 1 54 1 55 1 56 57 1 1 58 59 1 60 1 1 6...
output:
0 34128 53109 48748 37341 77286 77109 56398 77110 43524 77161 11898 77310 73363 46494 77248 63423 77244 74044 67084 77199 77283 66573 77104 56104 8944 77178 77163 66316 77133 70066 77297 77172 77238 77159 39438 13149 13978 61243 45841 69823 77222 77128 77181 12733 77265 77171 77247 34105 77211 53086...
result:
ok q=100000
Test #9:
score: 0
Accepted
time: 410ms
memory: 16032kb
input:
447 99681 2 1 3 1 1 4 5 1 6 1 7 1 1 8 9 1 10 1 1 11 12 1 13 1 1 14 15 1 1 16 17 1 18 1 1 19 20 1 1 21 1 22 23 1 1 24 1 25 26 1 1 27 28 1 29 1 1 30 31 1 32 1 1 33 34 1 1 35 1 36 37 1 1 38 1 39 40 1 41 1 1 42 43 1 44 1 1 45 1 46 1 47 48 1 1 49 50 1 1 51 52 1 53 1 54 1 1 55 56 1 1 57 1 58 59 1 1 60 61 ...
output:
0 0 0 0 0 0 0 0 7808 7531 7510 49211 40367 7793 7807 32933 49196 49210 97417 7620 7567 7613 49023 48970 7751 7717 49016 7822 49154 49120 7710 49225 49113 98303 7845 7524 49248 37938 98302 98301 98300 98299 7800 7666 7866 49203 49069 49269 98298 7833 7595 7737 7560 7530 7730 7472 7640 7768 7540 49236...
result:
ok q=100000
Test #10:
score: 0
Accepted
time: 229ms
memory: 8904kb
input:
447 99681 1 2 1 3 4 1 1 5 1 6 1 7 1 8 1 9 1 10 11 1 12 1 1 13 14 1 1 15 16 1 17 1 1 18 1 19 1 20 1 21 22 1 23 1 24 1 25 1 26 1 1 27 1 28 29 1 1 30 31 1 32 1 33 1 1 34 35 1 1 36 1 37 38 1 1 39 40 1 1 41 42 1 43 1 1 44 1 45 46 1 47 1 48 1 1 49 1 50 1 51 1 52 1 53 1 54 1 55 1 56 1 57 1 58 1 59 1 60 61 ...
output:
0 0 0 0 17598 22772 62304 62416 62507 3705 62406 62459 17864 23038 68798 90358 98639 3971 17473 20286 17614 22788 20429 66536 20541 66648 17482 22656 23966 24078 20632 66739 24169 3580 3721 3589 88943 20531 66638 17699 22873 68633 84838 84929 3806 24068 84828 95303 20584 66691 24121 84881 48368 4863...
result:
ok q=100000
Test #11:
score: 0
Accepted
time: 49ms
memory: 6176kb
input:
447 99681 2 1 1 3 1 4 5 1 6 1 1 7 1 8 1 9 1 10 1 11 1 12 1 13 14 1 15 1 1 16 1 17 18 1 19 1 20 1 1 21 22 1 23 1 24 1 1 25 1 26 1 27 1 28 1 29 1 30 1 31 1 32 33 1 1 34 35 1 1 36 1 37 38 1 1 39 40 1 1 41 42 1 43 1 1 44 45 1 46 1 1 47 48 1 49 1 1 50 1 51 52 1 53 1 54 1 1 55 56 1 1 57 58 1 1 59 1 60 61 ...
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 q=100000
Test #12:
score: 0
Accepted
time: 640ms
memory: 97356kb
input:
447 99681 2 1 1 3 4 1 1 5 1 6 1 7 8 1 1 9 1 10 1 11 12 1 13 1 14 1 1 15 16 1 1 17 18 1 1 19 20 1 21 1 22 1 23 1 1 24 1 25 26 1 1 27 1 28 1 29 1 30 31 1 32 1 33 1 34 1 1 35 1 36 37 1 38 1 1 39 40 1 1 41 42 1 1 43 44 1 45 1 1 46 47 1 1 48 49 1 1 50 51 1 1 52 1 53 54 1 1 55 1 56 57 1 58 1 59 1 60 1 1 6...
output:
5550
result:
ok q=100000
Test #13:
score: 0
Accepted
time: 685ms
memory: 69168kb
input:
447 99681 1 2 3 1 4 1 5 1 1 6 1 7 1 8 9 1 10 1 11 1 1 12 1 13 14 1 15 1 16 1 17 1 1 18 1 19 1 20 21 1 22 1 1 23 1 24 1 25 26 1 27 1 28 1 1 29 30 1 1 31 1 32 33 1 34 1 35 1 1 36 37 1 1 38 39 1 40 1 41 1 1 42 43 1 1 44 1 45 46 1 47 1 1 48 49 1 1 50 51 1 1 52 53 1 54 1 1 55 56 1 57 1 1 58 59 1 60 1 61 ...
output:
85316 85315 85314 85313 85311 85307 72250 85298 35965 69865 70350 85210 24045 17296 70108 85295 15666 85276 53151 22875 84286 85204 83935 32350 66615 64266 48151 10680 45555 85217 85240 58183 67885 85283 83401 66100 85225 85149 85222 24820 85278 85267 5983 41541 85286 62655 71545 53455 85209 85292 6...
result:
ok q=100000
Test #14:
score: 0
Accepted
time: 632ms
memory: 46048kb
input:
447 99681 1 2 3 1 4 1 1 5 6 1 1 7 1 8 9 1 10 1 1 11 1 12 13 1 1 14 15 1 1 16 1 17 1 18 19 1 1 20 21 1 1 22 23 1 1 24 25 1 1 26 27 1 28 1 29 1 30 1 1 31 1 32 33 1 1 34 1 35 36 1 37 1 38 1 1 39 40 1 1 41 1 42 1 43 1 44 45 1 1 46 1 47 1 48 49 1 50 1 51 1 1 52 1 53 1 54 1 55 1 56 1 57 1 58 1 59 1 60 61 ...
output:
64965 64934 64720 17607 35514 64740 64849 64911 60357 39039 64883 64946 29666 64902 25112 49647 64928 47414 24339 64708 64897 64878 64706 64948 64865 42126 26264 25881 64780 18816 64929 59231 64947 15572 63639 64843 64915 64716 64744 64746 10164 42464 64712 64847 64900 64814 4587 64788 64961 64960 6...
result:
ok q=100000
Test #15:
score: 0
Accepted
time: 549ms
memory: 28552kb
input:
447 99681 1 2 3 1 4 1 1 5 1 6 7 1 1 8 9 1 10 1 11 1 1 12 1 13 1 14 15 1 1 16 1 17 18 1 1 19 1 20 21 1 22 1 23 1 1 24 25 1 1 26 27 1 28 1 1 29 30 1 1 31 32 1 33 1 34 1 35 1 1 36 1 37 1 38 39 1 40 1 41 1 42 1 43 1 44 1 1 45 46 1 1 47 48 1 49 1 50 1 1 51 52 1 53 1 1 54 1 55 56 1 57 1 58 1 59 1 60 1 1 6...
output:
98505 98504 98503 98499 98496 98495 98493 98490 98487 98484 98483 98481 98480 98479 98477 98476 98473 98471 98469 98468 98467 98465 98463 98460 98458 98457 98407 98254 98201 98147 97979 97921 97741 97421 97354 97217 97147 97004 96931 96706 96629 96062 95977 95891 95804 95716 95627 95537 95446 95167 ...
result:
ok q=100000
Test #16:
score: 0
Accepted
time: 400ms
memory: 16164kb
input:
447 99681 2 1 3 1 4 1 1 5 6 1 1 7 8 1 9 1 10 1 1 11 12 1 1 13 1 14 1 15 16 1 1 17 1 18 19 1 20 1 1 21 1 22 1 23 1 24 1 25 26 1 27 1 28 1 29 1 30 1 31 1 1 32 33 1 1 34 1 35 1 36 1 37 38 1 39 1 40 1 1 41 42 1 1 43 44 1 45 1 46 1 1 47 48 1 49 1 50 1 51 1 1 52 1 53 1 54 1 55 1 56 57 1 1 58 1 59 60 1 1 6...
output:
52333 52328 52270 52385 52170 50232 20370 32212 52350 52177 42082 9273 52378 52164 29248 52146 52116 52263 24295 10963 52367 52210 52299 52107 30738 52157 52360 52215 52342 52305 52166 52294 48013 51168 5845 52375 17158 52390 38647 52259 9697 15118 38995 52296 52213 52352 43762 52403 52128 39688 521...
result:
ok q=100000
Test #17:
score: 0
Accepted
time: 227ms
memory: 8888kb
input:
447 99681 2 1 3 1 1 4 5 1 1 6 7 1 8 1 1 9 10 1 11 1 12 1 13 1 14 1 1 15 1 16 1 17 18 1 1 19 1 20 1 21 22 1 1 23 24 1 25 1 26 1 1 27 1 28 29 1 30 1 1 31 1 32 1 33 34 1 35 1 36 1 1 37 1 38 1 39 1 40 1 41 1 42 43 1 44 1 1 45 1 46 47 1 48 1 1 49 50 1 51 1 1 52 1 53 54 1 1 55 56 1 57 1 1 58 59 1 60 1 1 6...
output:
94959 82564 69203 91583 7778 91709 25279 67958 89144 65131 37103 42968 73249 94980 75274 28331 94433 90539 94986 19784 83653 42631 68956 33881 94948 50129 87181 94994 78263 80669 74384 94983 26431 89288 57679 89573 95007 94929 48544 29084 79484 66944 80278 68708 21769 76793 59681 82193 94996 95000 9...
result:
ok q=100000
Test #18:
score: 0
Accepted
time: 68ms
memory: 7220kb
input:
447 99681 2 1 1 3 4 1 1 5 6 1 1 7 1 8 9 1 10 1 11 1 1 12 13 1 1 14 15 1 16 1 17 1 18 1 1 19 20 1 1 21 1 22 23 1 24 1 25 1 26 1 27 1 28 1 1 29 30 1 1 31 32 1 33 1 1 34 35 1 36 1 1 37 38 1 39 1 1 40 1 41 1 42 1 43 1 44 1 45 46 1 47 1 1 48 1 49 1 50 51 1 52 1 1 53 54 1 55 1 1 56 1 57 1 58 59 1 60 1 1 6...
output:
446 444 443 441 440 435 434 432 430 427 424 421 420 419 418 415 414 413 412 409 406 403 397 396 393 389 388 387 385 384 381 379 375 374 373 371 370 368 366 365 364 361 359 356 355 354 353 352 350 349 347 346 345 342 341 339 337 336 335 334 332 331 330 328 327 326 324 322 321 316 313 311 310 308 307 ...
result:
ok q=100000
Test #19:
score: 0
Accepted
time: 610ms
memory: 97292kb
input:
447 99681 2 1 3 1 1 4 1 5 1 6 1 7 1 8 9 1 1 10 11 1 12 1 13 1 14 1 15 1 1 16 17 1 1 18 19 1 1 20 21 1 1 22 1 23 24 1 25 1 1 26 27 1 1 28 29 1 30 1 31 1 1 32 1 33 34 1 35 1 1 36 37 1 38 1 39 1 1 40 1 41 42 1 1 43 44 1 45 1 1 46 1 47 1 48 49 1 1 50 1 51 52 1 53 1 1 54 55 1 1 56 1 57 58 1 1 59 1 60 1 6...
output:
99681
result:
ok q=100000
Test #20:
score: 0
Accepted
time: 653ms
memory: 69356kb
input:
447 99681 1 2 1 3 4 1 5 1 6 1 1 7 8 1 1 9 1 10 1 11 1 12 13 1 1 14 1 15 16 1 17 1 18 1 1 19 20 1 21 1 1 22 23 1 24 1 1 25 1 26 1 27 28 1 29 1 30 1 31 1 1 32 33 1 34 1 1 35 1 36 37 1 38 1 39 1 40 1 41 1 42 1 1 43 44 1 45 1 46 1 47 1 1 48 49 1 1 50 1 51 1 52 53 1 54 1 1 55 1 56 57 1 1 58 1 59 1 60 1 6...
output:
81890 81875 81863 81858 81835 81832 81812 81783 81780 81778 81768 81754 81753 81745 81739 81735 81734 81733 79191 78171 77756 77126 74067 73841 73614 73157 72927 70812 70572 68864 68367 66339 65822 65301 64776 64247 62636 62091 60152 57587 56421 56127 55832 55536 55239 54642 53739 53132 52521 51906 ...
result:
ok q=100000
Test #21:
score: 0
Accepted
time: 633ms
memory: 46328kb
input:
447 99681 1 2 1 3 4 1 1 5 1 6 7 1 8 1 1 9 1 10 11 1 1 12 1 13 14 1 15 1 1 16 17 1 18 1 19 1 20 1 21 1 22 1 1 23 24 1 1 25 26 1 27 1 1 28 29 1 30 1 31 1 1 32 33 1 1 34 1 35 1 36 1 37 1 38 1 39 40 1 41 1 42 1 43 1 44 1 45 1 1 46 47 1 1 48 49 1 1 50 1 51 1 52 1 53 1 54 55 1 1 56 57 1 58 1 59 1 60 1 1 6...
output:
98436 89901 69496 64915 42678 33928 28755 25711 22210 14553 841 97216 95890 98453 98438 78516 97146 98454 71428 77686 48910 24165 98426 97678 43351 82426 58876 81486 31735 40635 88753 72835 4801 79128 91881 98414 36441 83341 89761 53575 84925 48591 87696 92250 68506 75760 95626 93745 85770 77053 133...
result:
ok q=100000
Test #22:
score: 0
Accepted
time: 552ms
memory: 28236kb
input:
447 99681 2 1 3 1 1 4 5 1 1 6 7 1 1 8 9 1 1 10 11 1 1 12 13 1 14 1 15 1 16 1 17 1 18 1 1 19 1 20 1 21 22 1 23 1 24 1 25 1 1 26 1 27 1 28 29 1 1 30 31 1 32 1 1 33 1 34 35 1 36 1 37 1 1 38 1 39 40 1 41 1 42 1 1 43 44 1 45 1 46 1 1 47 48 1 1 49 1 50 51 1 1 52 53 1 1 54 55 1 56 1 1 57 58 1 59 1 60 1 61 ...
output:
0 0 29762 29909 29565 29705 29860 29628 29859 15052 29725 29648 11736 29844 29678 29835 29704 29885 29789 29723 29902 29748 29602 29924 29829 27297 29787 29792 29624 85565 95832 29730 29712 29577 29892 29805 29675 29753 29793 29578 29850 29863 29719 29874 29658 2727 29764 29810 29668 29596 29625 288...
result:
ok q=100000
Test #23:
score: 0
Accepted
time: 398ms
memory: 16120kb
input:
447 99681 2 1 1 3 4 1 1 5 1 6 7 1 1 8 1 9 1 10 1 11 12 1 13 1 14 1 15 1 16 1 17 1 18 1 19 1 1 20 21 1 22 1 23 1 24 1 1 25 1 26 1 27 28 1 29 1 1 30 1 31 1 32 33 1 1 34 35 1 36 1 1 37 38 1 1 39 1 40 41 1 1 42 1 43 1 44 1 45 1 46 1 47 1 48 49 1 1 50 51 1 1 52 53 1 1 54 1 55 1 56 1 57 1 58 59 1 1 60 1 6...
output:
14093 13998 13930 19384 19289 19221 13801 13852 14040 19143 13891 13875 13866 19092 13997 19331 19182 19166 13789 19328 13782 19100 19201 19350 6171 12544 19159 19084 19402 19308 14049 19339 19190 4885 19171 19206 5319 13786 14071 14039 19400 14036 13958 19281 19423 13375 13840 13943 19411 13921 137...
result:
ok q=100000
Test #24:
score: 0
Accepted
time: 222ms
memory: 8892kb
input:
447 99681 2 1 3 1 1 4 5 1 6 1 7 1 1 8 9 1 1 10 1 11 12 1 1 13 1 14 1 15 1 16 17 1 18 1 19 1 20 1 1 21 1 22 23 1 1 24 1 25 1 26 27 1 1 28 1 29 1 30 31 1 1 32 33 1 34 1 35 1 1 36 37 1 38 1 39 1 1 40 41 1 42 1 1 43 1 44 1 45 46 1 47 1 1 48 49 1 50 1 51 1 1 52 1 53 54 1 1 55 56 1 57 1 1 58 1 59 1 60 1 6...
output:
0 0 0 0 87174 17362 10746 74601 78462 3436 59337 17182 10566 59271 69877 17222 10606 69811 59289 69829 3256 3296 31312 31132 31172 67699 59242 61573 17190 87255 87150 17443 56452 17338 17172 9423 51007 87218 9175 17154 17406 40527 87158 17122 87140 56158 17346 17328 28647 87228 17171 17089 17416 658...
result:
ok q=100000
Test #25:
score: 0
Accepted
time: 54ms
memory: 6408kb
input:
447 99681 2 1 3 1 1 4 1 5 6 1 7 1 1 8 1 9 1 10 11 1 12 1 13 1 1 14 1 15 1 16 1 17 1 18 1 19 1 20 1 21 1 22 23 1 24 1 25 1 26 1 27 1 28 1 29 1 1 30 1 31 1 32 1 33 1 34 1 35 36 1 1 37 38 1 1 39 40 1 1 41 1 42 1 43 44 1 45 1 1 46 1 47 1 48 1 49 1 50 1 51 1 52 53 1 1 54 55 1 56 1 57 1 1 58 59 1 1 60 1 6...
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 q=100000
Test #26:
score: 0
Accepted
time: 642ms
memory: 97436kb
input:
448 100000 2 1 3 1 4 1 1 5 6 1 7 1 8 1 1 9 1 10 1 11 1 12 13 1 1 14 1 15 1 16 1 17 18 1 19 1 20 1 1 21 22 1 1 23 24 1 1 25 26 1 1 27 28 1 29 1 1 30 31 1 32 1 1 33 34 1 1 35 36 1 1 37 1 38 39 1 40 1 41 1 42 1 43 1 44 1 45 1 46 1 1 47 1 48 49 1 1 50 51 1 1 52 53 1 1 54 55 1 1 56 1 57 58 1 59 1 1 60 1 ...
output:
59584
result:
ok q=100000
Test #27:
score: 0
Accepted
time: 667ms
memory: 69336kb
input:
448 100000 2 1 3 1 1 4 1 5 1 6 1 7 8 1 9 1 1 10 1 11 1 12 1 13 14 1 1 15 1 16 1 17 1 18 1 19 1 20 21 1 22 1 1 23 24 1 25 1 26 1 27 1 28 1 29 1 1 30 31 1 32 1 1 33 34 1 35 1 1 36 1 37 1 38 1 39 1 40 41 1 42 1 43 1 1 44 45 1 46 1 47 1 48 1 49 1 50 1 51 1 1 52 53 1 1 54 1 55 1 56 1 57 1 58 59 1 60 1 61...
output:
6149 5956 6058 5921 5792 5867 6078 5768 6147 5741 5294 5743 6022 6153 5812 6085 5786 5975 5896 5826 5879 5809 5947 5895 6006 5996 5794 1787 5882 5754 5951 5934 5910 6075 6146 5977 5988 5914 5987 5900 6041 5876 5749 6115 5948 5961 6014 5998 6039 5854 5815 5728 5808 6008 5959 6027 5861 6100 5847 6159 ...
result:
ok q=100000
Test #28:
score: 0
Accepted
time: 617ms
memory: 46324kb
input:
448 100000 1 2 3 1 1 4 5 1 1 6 1 7 8 1 9 1 10 1 1 11 1 12 13 1 1 14 15 1 1 16 1 17 18 1 1 19 20 1 21 1 22 1 1 23 1 24 1 25 26 1 1 27 1 28 29 1 30 1 1 31 32 1 1 33 34 1 1 35 36 1 37 1 1 38 1 39 1 40 1 41 42 1 43 1 1 44 45 1 1 46 47 1 1 48 1 49 50 1 1 51 1 52 1 53 1 54 55 1 56 1 57 1 58 1 59 1 60 1 61...
output:
23495 23676 2715 23715 4032 23702 23541 16287 23622 23716 23717 23747 23709 23739 23545 23564 23698 23659 23700 5339 23686 22686 22295 23623 23569 23694 23590 23827 23690 23503 23582 23767 23585 3594 23547 23770 23793 23557 23661 23524 23837 23632 23518 23618 23645 23754 23501 946 23811 23558 23583 ...
result:
ok q=100000
Test #29:
score: 0
Accepted
time: 547ms
memory: 28284kb
input:
448 100000 1 2 3 1 1 4 1 5 1 6 7 1 8 1 9 1 1 10 11 1 1 12 1 13 14 1 1 15 1 16 17 1 1 18 1 19 20 1 21 1 22 1 1 23 24 1 25 1 1 26 27 1 1 28 1 29 30 1 31 1 32 1 1 33 34 1 1 35 36 1 37 1 38 1 1 39 40 1 41 1 1 42 43 1 44 1 1 45 1 46 47 1 48 1 49 1 1 50 1 51 1 52 1 53 54 1 55 1 56 1 57 1 1 58 1 59 60 1 61...
output:
67334 35758 67364 35787 43730 67272 67239 1080 51596 32665 67175 67154 67392 67163 60726 26683 67150 67393 67379 67180 67383 12279 59319 67160 11860 67396 58174 67303 67230 67142 29706 67391 67291 67390 67279 67315 9751 33031 47487 67284 67309 67144 67243 67323 33396 24760 18035 67341 67184 27825 67...
result:
ok q=100000
Test #30:
score: 0
Accepted
time: 417ms
memory: 16112kb
input:
448 100000 2 1 3 1 4 1 5 1 6 1 7 1 1 8 1 9 1 10 11 1 1 12 1 13 1 14 15 1 16 1 1 17 18 1 1 19 1 20 1 21 22 1 1 23 1 24 25 1 1 26 1 27 1 28 29 1 1 30 31 1 32 1 1 33 34 1 35 1 1 36 37 1 38 1 1 39 1 40 1 41 42 1 43 1 1 44 45 1 46 1 1 47 48 1 1 49 50 1 51 1 52 1 1 53 54 1 55 1 1 56 57 1 1 58 1 59 1 60 61...
output:
0 74629 68961 74404 79842 79876 74636 68968 74411 74711 69043 51005 50981 72547 68928 74486 51004 72546 74790 45885 69123 74731 31227 45861 31597 59068 69063 31203 31573 71130 59044 68922 74752 67174 69084 67150 74566 45884 74781 69114 46213 33067 46189 74747 33043 74800 41197 49749 74810 74806 6907...
result:
ok q=100000
Test #31:
score: 0
Accepted
time: 233ms
memory: 8840kb
input:
448 100000 2 1 1 3 1 4 5 1 6 1 1 7 8 1 9 1 10 1 1 11 1 12 13 1 1 14 15 1 16 1 1 17 1 18 1 19 1 20 21 1 1 22 23 1 1 24 1 25 26 1 27 1 28 1 29 1 30 1 1 31 1 32 33 1 34 1 1 35 1 36 37 1 38 1 1 39 1 40 41 1 42 1 1 43 44 1 1 45 46 1 47 1 1 48 1 49 1 50 51 1 1 52 1 53 1 54 55 1 56 1 57 1 58 1 59 1 1 60 61...
output:
0 0 0 0 0 0 73788 90848 73764 87337 73833 93359 18873 18987 90832 87321 91403 18971 21357 21333 90943 80973 77100 87432 80949 77076 77946 77922 21402 95976 81018 77145 77991 18705 19082 18907 18888 18892 73703 75822 75806 21272 26417 5592 64395 16945 90944 26393 5568 64371 16921 87433 26462 5637 644...
result:
ok q=100000
Test #32:
score: 0
Accepted
time: 51ms
memory: 6184kb
input:
448 100000 2 1 3 1 4 1 5 1 1 6 7 1 1 8 9 1 10 1 11 1 12 1 1 13 1 14 1 15 1 16 1 17 18 1 19 1 20 1 21 1 1 22 1 23 1 24 1 25 1 26 27 1 1 28 1 29 1 30 1 31 32 1 33 1 34 1 35 1 1 36 1 37 1 38 39 1 1 40 1 41 42 1 43 1 1 44 45 1 46 1 1 47 1 48 1 49 50 1 51 1 52 1 53 1 54 1 55 1 56 1 57 1 1 58 1 59 60 1 61...
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 q=100000
Test #33:
score: 0
Accepted
time: 616ms
memory: 97360kb
input:
448 100000 2 1 3 1 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 12 1 13 1 14 1 1 15 16 1 17 1 1 18 1 19 20 1 21 1 22 1 1 23 24 1 1 25 26 1 1 27 28 1 29 1 1 30 31 1 1 33 34 1 1 35 1 36 1 37 38 1 39 1 40 1 41 1 42 1 43 1 44 1 45 1 46 1 47 1 1 48 1 49 50 1 51 1 52 1 53 1 1 54 1 55 1 56 1 57 58 1 1 59 60 1 61 1 63...
output:
65140
result:
ok q=100000
Test #34:
score: 0
Accepted
time: 638ms
memory: 69476kb
input:
448 100000 1 2 3 1 1 4 1 5 1 6 7 1 8 1 9 1 1 10 11 1 12 1 1 13 1 14 15 1 16 1 1 17 18 1 19 1 20 1 1 21 22 1 1 23 24 1 25 1 26 1 27 1 1 28 1 29 1 30 31 1 32 1 33 1 1 34 1 35 1 36 1 37 38 1 1 39 1 40 1 41 1 42 43 1 44 1 1 45 46 1 1 47 1 48 49 1 50 1 1 51 1 52 1 53 54 1 55 1 56 1 57 1 58 1 1 59 1 60 61...
output:
75980 75964 67685 53474 14811 76046 76003 75946 65102 75953 21275 75975 76020 76041 76059 24023 17671 76001 76050 68189 69680 70169 76150 69187 31598 76133 75950 76017 46544 44569 76027 76136 76055 75956 76079 76075 17265 76154 66663 75951 57637 9793 72784 76142 18883 55876 56761 76076 62965 76077 7...
result:
ok q=100000
Test #35:
score: 0
Accepted
time: 595ms
memory: 46588kb
input:
448 100000 1 2 1 3 4 1 1 5 6 1 7 1 1 8 9 1 1 10 11 1 1 12 13 1 1 14 15 1 1 16 1 17 1 18 1 19 1 20 1 21 22 1 23 1 24 1 1 25 26 1 27 1 1 28 29 1 1 30 31 1 1 32 33 1 1 34 1 35 1 36 37 1 1 38 1 39 1 40 1 41 1 42 1 43 44 1 1 45 46 1 47 1 1 48 49 1 50 1 1 51 1 52 1 53 54 1 55 1 1 56 1 57 58 1 1 59 60 1 61...
output:
30338 30335 30334 30331 30330 30326 30323 30318 30316 30315 30311 30310 30307 30306 30303 30300 30299 30298 30297 30295 30294 30293 30291 30288 30287 30286 30285 30284 30282 30281 30280 30279 30275 30274 30273 30272 30268 30265 30264 30263 30261 30259 30258 30257 30256 30255 30254 30253 30251 30249 ...
result:
ok q=100000
Test #36:
score: 0
Accepted
time: 550ms
memory: 28864kb
input:
448 100000 2 1 3 1 4 1 1 5 1 6 1 7 8 1 9 1 10 1 1 11 1 12 1 13 1 14 1 15 16 1 17 1 1 18 1 19 20 1 1 21 22 1 1 23 24 1 1 25 1 26 27 1 1 28 1 29 30 1 1 31 32 1 33 1 34 1 1 35 1 36 37 1 1 38 1 39 40 1 1 41 1 42 43 1 44 1 45 1 46 1 47 1 48 1 49 1 1 50 1 51 1 52 1 53 54 1 55 1 56 1 1 57 58 1 59 1 1 60 1 ...
output:
33702 45920 43477 46037 45961 18777 46052 45803 46012 46029 46064 46114 45835 24310 46120 38339 46053 27764 45847 45816 31505 45889 45950 562 45932 45976 45850 46033 17160 45854 46086 46025 45805 45927 46030 41106 45874 4093 17566 45871 46091 45881 46057 45856 45999 23531 45995 45928 46075 45834 458...
result:
ok q=100000
Test #37:
score: 0
Accepted
time: 401ms
memory: 16112kb
input:
448 100000 1 2 3 1 1 4 1 5 6 1 7 1 8 1 9 1 1 10 11 1 12 1 13 1 1 14 1 15 16 1 1 17 1 18 1 19 1 20 21 1 1 22 1 23 24 1 25 1 1 26 1 27 1 28 1 29 30 1 31 1 32 1 1 33 34 1 1 35 1 36 1 37 1 38 39 1 1 40 1 41 42 1 43 1 44 1 1 45 1 46 47 1 48 1 49 1 50 1 1 51 52 1 53 1 54 1 55 1 56 1 1 57 1 58 1 59 60 1 1 ...
output:
36812 21931 36841 36601 36874 36766 36582 30360 36556 36828 36563 36688 17938 35472 36776 36595 36722 36894 23109 36876 36808 29238 36810 36851 36693 36793 10926 13019 36586 36699 4936 36562 35113 25440 36704 17128 36611 36844 36573 36625 36824 36580 537 36887 36838 16721 36725 36796 36721 36679 367...
result:
ok q=100000
Test #38:
score: 0
Accepted
time: 213ms
memory: 8876kb
input:
448 100000 1 2 1 3 1 4 5 1 6 1 1 7 8 1 9 1 10 1 11 1 12 1 1 13 1 14 15 1 16 1 1 17 1 18 19 1 1 20 1 21 22 1 1 23 24 1 1 25 26 1 1 27 28 1 29 1 1 30 1 31 32 1 33 1 1 34 35 1 1 36 1 37 38 1 1 39 1 40 1 41 42 1 43 1 44 1 45 1 46 1 47 1 1 48 49 1 1 50 51 1 52 1 1 53 54 1 1 55 1 56 57 1 58 1 1 59 1 60 61...
output:
25022 25021 25020 25015 25014 25013 25011 25010 25009 25006 25002 25000 24995 24994 24992 24991 24989 24986 24985 24982 24981 24980 24978 24976 24975 24972 24971 24970 24967 24966 24964 24963 24962 24957 24956 24953 24950 24947 24946 24945 24943 24940 24939 24937 24936 24934 24932 24931 24928 24926 ...
result:
ok q=100000
Test #39:
score: 0
Accepted
time: 83ms
memory: 6936kb
input:
448 100000 2 1 1 3 1 4 1 5 1 6 7 1 1 8 1 9 1 10 11 1 1 12 1 13 14 1 15 1 16 1 1 17 1 18 19 1 20 1 21 1 1 22 1 23 24 1 1 25 26 1 1 27 28 1 29 1 30 1 31 1 32 1 33 1 1 34 1 35 36 1 37 1 1 38 1 39 1 40 41 1 1 42 43 1 44 1 45 1 1 46 1 47 1 48 49 1 50 1 51 1 1 52 53 1 54 1 55 1 1 56 57 1 58 1 59 1 1 60 1 ...
output:
446 444 443 442 441 439 437 435 434 432 429 428 426 424 423 421 417 416 415 411 410 409 408 407 405 404 403 402 399 396 392 387 386 382 381 379 378 376 375 372 371 363 361 356 354 353 351 350 349 345 343 341 338 337 336 334 332 330 328 327 326 325 324 320 319 318 317 316 310 309 307 306 304 303 301 ...
result:
ok q=100000
Test #40:
score: 0
Accepted
time: 614ms
memory: 97300kb
input:
448 100000 2 1 1 3 4 1 5 1 1 6 1 7 1 8 9 1 10 1 11 1 1 12 1 13 1 14 1 15 1 16 1 17 18 1 19 1 20 1 1 21 22 1 23 1 24 1 25 1 26 1 1 27 28 1 1 29 1 30 31 1 1 32 1 33 34 1 35 1 1 36 1 37 38 1 1 39 40 1 1 41 1 42 1 43 1 44 45 1 46 1 1 47 1 48 49 1 1 50 51 1 52 1 53 1 54 1 55 1 1 56 57 1 1 58 59 1 1 60 1 ...
output:
78480
result:
ok q=100000
Test #41:
score: 0
Accepted
time: 675ms
memory: 69612kb
input:
448 100000 2 1 3 1 4 1 1 5 1 6 7 1 8 1 9 1 1 10 11 1 1 12 1 13 1 14 1 15 1 16 17 1 1 18 1 19 20 1 21 1 22 1 23 1 24 1 25 1 1 26 27 1 28 1 1 29 30 1 1 31 1 32 33 1 34 1 1 35 36 1 1 37 1 38 39 1 40 1 1 41 42 1 1 43 1 44 45 1 46 1 47 1 48 1 1 49 50 1 1 51 1 52 53 1 1 54 1 55 56 1 1 57 58 1 1 59 60 1 61...
output:
33652 29225 25423 21132 19137 16304 15488 11339 8373 2301 1418 34204 34294 34232 34121 34073 34161 34091 34082 34246 34044 34261 34235 34036 34334 34218 34329 34173 34301 34292 34300 34324 34374 34075 34280 34274 34240 34303 34245 34299 34367 34343 34353 34304 23487 34337 32925 10918 34283 34167 341...
result:
ok q=100000
Test #42:
score: 0
Accepted
time: 610ms
memory: 46040kb
input:
448 100000 1 2 1 3 1 4 5 1 6 1 7 1 1 8 1 9 10 1 11 1 1 12 1 13 1 14 15 1 1 16 1 17 18 1 1 19 1 20 21 1 22 1 23 1 24 1 1 25 1 26 27 1 1 28 1 29 30 1 31 1 32 1 33 1 1 34 1 35 1 36 1 37 38 1 39 1 1 40 41 1 1 42 1 43 1 44 1 45 46 1 1 47 48 1 49 1 1 50 1 51 52 1 1 53 1 54 55 1 56 1 57 1 58 1 1 59 1 60 1 ...
output:
0 94012 39587 14090 93951 23344 59469 93915 8630 60876 71009 42671 93797 94009 91649 80219 24902 92278 93926 93686 91259 71488 82153 2998 18583 15328 42332 38540 94011 84341 28724 93959 85718 29101 88130 92999 57746 86053 68805 94006 93965 71961 72197 62534 93955 46657 27587 93993 82713 69794 93995 ...
result:
ok q=100000
Test #43:
score: 0
Accepted
time: 576ms
memory: 28908kb
input:
448 100000 2 1 3 1 4 1 1 5 1 6 7 1 1 8 1 9 10 1 1 11 12 1 1 13 1 14 15 1 16 1 17 1 18 1 1 19 1 20 1 21 22 1 23 1 1 24 25 1 26 1 1 27 28 1 1 29 1 30 31 1 1 32 33 1 1 34 35 1 36 1 1 37 38 1 1 39 1 40 1 41 1 42 43 1 1 44 45 1 46 1 1 47 1 48 49 1 1 50 1 51 52 1 53 1 1 54 55 1 1 56 1 57 58 1 1 59 60 1 61...
output:
0 0 0 0 0 0 0 46498 65177 65211 46689 89498 46666 46629 89475 46589 46554 46573 6266 89438 46453 84990 78352 82106 6448 40059 34049 46643 46746 46711 52322 40404 40241 46623 46687 1010 46499 46692 46658 46741 46754 35129 46648 34230 89452 46484 46463 89555 46512 40585 89432 46669 21557 1192 46713 65...
result:
ok q=100000
Test #44:
score: 0
Accepted
time: 406ms
memory: 16436kb
input:
448 100000 2 1 1 3 4 1 1 5 6 1 7 1 8 1 1 9 10 1 11 1 1 12 1 13 1 14 15 1 1 16 1 17 18 1 1 19 20 1 1 21 22 1 23 1 1 24 1 25 1 26 1 27 1 28 29 1 30 1 31 1 32 1 33 1 1 34 35 1 1 36 37 1 1 38 1 39 40 1 41 1 42 1 1 43 44 1 45 1 46 1 1 47 48 1 49 1 50 1 51 1 52 1 1 53 54 1 55 1 56 1 1 57 58 1 1 59 60 1 61...
output:
42985 3646 42998 42919 82126 45647 41286 78368 3795 3654 3641 3776 82139 45660 41299 78381 58305 44656 65454 3651 61137 90850 4723 3721 3705 3862 3547 63863 90952 75145 90870 36400 90906 66237 47281 90972 74474 90876 67011 3715 90881 3964 3761 47926 90914 90887 9029 90867 3882 758 79993 3627 3918 37...
result:
ok q=100000
Test #45:
score: 0
Accepted
time: 222ms
memory: 8784kb
input:
448 100000 1 2 1 3 4 1 1 5 1 6 7 1 8 1 1 9 1 10 11 1 12 1 1 13 1 14 15 1 16 1 17 1 18 1 19 1 1 20 1 21 1 22 23 1 1 24 1 25 26 1 27 1 1 28 29 1 1 30 31 1 1 32 1 33 1 34 1 35 1 36 1 37 1 38 39 1 40 1 1 41 1 42 43 1 1 44 1 45 1 46 47 1 1 48 1 49 1 50 1 51 52 1 1 53 1 54 55 1 1 56 1 57 1 58 1 59 1 60 61...
output:
0 75065 75250 75258 44238 78831 97278 97286 44387 55875 56024 75088 83286 75191 96767 27099 52882 53067 38447 68703 62706 38632 78879 68888 62891 99654 53075 38640 68896 62899 99662 44154 38319 78886 99771 99816 44211 44188 44435 44442 78739 86293 86301 44295 52791 38356 55848 55825 56072 56079 5593...
result:
ok q=100000
Test #46:
score: 0
Accepted
time: 54ms
memory: 6400kb
input:
448 100000 2 1 3 1 1 4 1 5 6 1 7 1 8 1 1 9 1 10 11 1 1 12 1 13 1 14 1 15 1 16 1 17 18 1 1 19 1 20 21 1 1 22 23 1 1 24 1 25 26 1 1 27 28 1 1 29 1 30 31 1 32 1 33 1 1 34 35 1 36 1 37 1 1 38 39 1 40 1 41 1 1 42 43 1 1 44 1 45 1 46 47 1 1 48 49 1 50 1 51 1 1 52 53 1 54 1 1 55 56 1 1 57 58 1 59 1 1 60 1 ...
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 q=100000
Test #47:
score: 0
Accepted
time: 77ms
memory: 9100kb
input:
100000 100000 5722 1 35633 1 76503 1 2 8454 2 93428 3 91414 4 55025 21132 5 6 22400 6 80941 7 22043 7 29361 7 73158 78568 7 8 24159 8 26175 27612 9 39375 9 5454 10 24262 10 40601 10 11 8620 59525 11 11 79781 11 92891 64034 12 33728 14 14 59378 14 79826 560 16 16 31445 35262 16 17911 17 28509 17 9364...
output:
14209
result:
ok q=100000
Test #48:
score: 0
Accepted
time: 133ms
memory: 9240kb
input:
100000 100000 32763 1 1 41318 52251 1 66464 2 83572 2 67186 5 7 64990 34545 8 8 96178 8628 9 10 8181 94794 15 16 33467 16 34451 85594 16 17 20413 31799 17 17 41753 18 61787 71853 18 19 5788 19 49136 97968 19 34661 20 20 61751 95244 20 20211 21 31082 21 22 96882 53538 23 53831 24 81268 24 25 52202 61...
output:
83964 83963 48181 39777 48490 48489 48488 48487 79652 42757 79651 13198 75581 69615 61609 23102 22645 30538 30537 30536 27931 27930 27929 9533 13514 13513 13512 94777 75424 86077 86076 86075 95259 95258 68685 94407 66963 40039 1066 8174 53585 53584 55593 55592 85418 49164 60583 67163 67162 46010 814...
result:
ok q=100000
Test #49:
score: 0
Accepted
time: 194ms
memory: 9348kb
input:
100000 100000 98 1 1 39536 2 7197 2 36925 64304 2 3 90981 4 55694 4 58594 6 14112 6 61223 49657 7 49961 8 9 63064 84290 9 9616 10 10 26834 10 81424 11 28592 66665 11 11 67518 12 65671 12 77007 13 83518 88724 13 14 22525 28934 14 38904 15 18454 16 16 34371 33103 17 63576 17 46939 18 67514 18 18 72374...
output:
45530 57822 45529 45528 45527 7911 17940 1993 89804 68910 41483 82406 88548 88547 79123 17512 84279 54952 54951 54847 54846 91003 60553 49384 49383 49382 71136 94693 39193 33414 3764 80887 77086 73009 26126 97838 92784 92039 4708 31730 88654 88653 88652 87343 75030 74286 63805 60207 83663 80204 6581...
result:
ok q=100000
Test #50:
score: 0
Accepted
time: 227ms
memory: 9124kb
input:
100000 100000 1 30554 51310 1 1 71883 94585 1 2 40250 59351 2 2 60517 72989 3 4 3248 14035 4 4 90751 5 786 6 10125 87221 6 22862 7 7 57323 67940 7 40455 8 8 66854 9 34854 9 87440 43694 10 10 57462 82982 10 94968 10 47934 11 11 71829 24007 12 44565 12 48286 12 70260 12 12 70368 98761 12 20547 14 7549...
output:
49551 49550 49549 11901 50261 40431 71478 71477 26532 58649 52035 45418 17118 76839 76838 36518 35164 14556 14555 92807 41475 33488 3271 3270 3269 3268 35454 35453 35452 99176 87811 85164 50164 34109 48037 26073 18489 31355 31354 8106 82770 76203 63000 16879 56894 10949 9191 78771 16898 16897 16052 ...
result:
ok q=100000
Test #51:
score: 0
Accepted
time: 192ms
memory: 9156kb
input:
100000 100000 26140 1 46196 2 2 54845 78912 3 3 90871 4 12358 5 33609 5 43410 5 78393 47818 6 7 48862 13216 8 8 36636 8 40979 52931 8 8 80000 94821 8 52306 10 14072 12 36807 12 66342 12 344 13 13 4469 13 14570 13 52573 15 29037 15 38532 86576 15 16 9718 43023 16 16 86523 19 16448 20 15703 20 62471 8...
output:
0 0 0 0 33676 0 0 0 81127 70591 64094 56000 3296 25083 25082 25081 38372 38371 38370 96503 69480 1281 68074 67311 52444 39238 6529 43568 28482 19896 19895 76367 61668 12956 12955 12954 12953 6360 9074 9128 9127 9126 8056 90105 90104 90103 90102 23814 62238 62237 48282 34967 81918 22544 81470 81469 8...
result:
ok q=100000
Test #52:
score: 0
Accepted
time: 127ms
memory: 9120kb
input:
100000 100000 2005 1 1 15170 57799 2 4 38977 4 57240 42542 5 5 53318 5 75678 6 88650 65147 7 8 53626 8 70633 22352 10 11 49862 12 14548 12 50661 12 69416 13 22675 13 57792 3230 14 61629 16 16 94304 19 4752 11292 19 19 23963 47970 19 3280 20 20 13431 37640 20 20 43437 22 59910 69629 22 94875 22 23 52...
output:
0 0 63812 63811 0 0 0 0 0 0 0 0 0 0 0 0 0 64070 0 0 0 0 0 0 0 0 0 0 0 0 0 17931 17930 0 0 0 0 0 0 0 0 0 0 25349 25298 22976 0 63870 46890 79011 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 74503 57471 54550 49655 23473 0 0 0 0 79932 79931 55883 0 0 0 0 0 0 0 0 95579 95578 94320 0 0 93452 72970 0 0 0 0 0 0 ...
result:
ok q=100000
Test #53:
score: 0
Accepted
time: 51ms
memory: 7988kb
input:
100000 100000 40394 1 75982 2 3 18844 73366 3 88698 3 4020 6 6 73638 7 22013 65853 7 8 75952 8 91846 8 92431 35947 9 25852 10 60988 10 84698 10 49696 11 60792 11 94447 12 29797 13 14 32289 14 45866 85823 14 15 5953 19579 15 9976 16 16 26641 17 70399 80811 17 18 57277 19 24826 19 72978 15405 20 64474...
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 q=100000
Test #54:
score: 0
Accepted
time: 84ms
memory: 8924kb
input:
100000 100000 1 46719 1 85926 2 31507 3 10325 25701 3 4 20660 4 24390 5 28826 5 32895 5 65707 5 85849 26769 6 35848 6 8 31592 9 6175 10 10273 10 49762 8543 11 12 1257 12 49533 67310 12 12 85402 4042 13 13 91901 14 36759 95374 14 40235 16 16 95131 17 47185 49412 17 86267 17 30733 18 19 36525 99630 20...
output:
33627
result:
ok q=100000
Test #55:
score: 0
Accepted
time: 101ms
memory: 9452kb
input:
100000 100000 1 14816 1 36843 1 67254 69974 1 3 22460 4 94861 51245 5 5 53683 54692 6 6 91387 6 91712 8 56288 8 88631 9 4475 23107 9 9 37340 18545 10 10 32507 10 37510 86500 10 57406 11 11 96238 486 12 12 44026 51175 13 14 92685 14 94886 14 99844 66818 15 58293 16 16 92531 17 32186 36963 18 18 53409...
output:
36531 36530 70963 70568 4272 8258 8257 8256 31746 31745 32776 42064 42604 42793 47186 47880 48131 54801 57281 9851 72445 58486 23752 84358 80892 73568 89375 3234 76860 94068 42283 99622 72144 836 1570 1569 1675 1889 7615 9331 10852 1143 11582 11717 12302 12313 12312 13534 14099 6273 15062 15565 1556...
result:
ok q=100000
Test #56:
score: 0
Accepted
time: 128ms
memory: 9280kb
input:
100000 100000 1 92961 32241 2 2 81221 4608 3 16927 3 18769 3 3 43374 22317 4 55044 4 18810 5 6 72739 61007 7 9 25577 9 27864 34366 9 10 16913 30734 10 40980 10 60805 10 74697 10 82279 10 10021 11 23696 12 36468 12 51197 12 86124 12 12 89628 14 6535 14 21742 14 36158 57841 14 15 81216 15 84873 16 457...
output:
14824 14823 85688 75177 64551 50758 50757 5567 46589 77928 48269 97633 88964 42194 74029 1752 4258 4257 4256 5536 6065 6064 6113 6112 8570 9444 9531 9530 10198 10261 11581 11580 13817 5615 14154 14153 14856 14855 15072 15071 15682 15681 15680 15784 15783 16924 16923 17056 17054 17112 17111 19944 199...
result:
ok q=100000
Test #57:
score: 0
Accepted
time: 149ms
memory: 9236kb
input:
100000 100000 1 27333 1 84324 96084 1 9114 2 85952 2 3 5372 4 6733 9091 4 58622 4 4 86657 14441 5 55881 5 77265 5 5 80838 6 348 8 52617 8 61683 11583 9 9 73540 93581 9 94661 9 9 98721 46654 10 10 52226 12 55380 12 79729 13 40841 13 58505 80468 13 57058 14 14 59095 23508 15 68757 15 6286 17 17 39373 ...
output:
7739 21429 5108 6105 6485 6484 10804 11253 11252 14811 18998 18997 19174 19173 19172 22325 24037 13992 28772 30278 11371 30900 30899 14257 37834 941 39835 47689 50235 50280 3043 53525 28820 53977 53976 35722 43630 42348 12192 58713 62190 64006 47189 12841 44531 9906 3278 22142 19233 70823 61036 7376...
result:
ok q=100000
Test #58:
score: 0
Accepted
time: 135ms
memory: 9356kb
input:
100000 100000 60818 1 1 61357 77477 1 3 45025 59533 3 46950 4 78991 4 97104 4 36194 5 6 64485 1740 7 5623 8 23553 8 16292 9 62566 9 9 98158 10 23566 10 47129 84382 10 10 89508 11 12522 54918 11 82691 14 89591 14 15 22620 22939 16 56415 16 16 83923 18 29619 18 83502 19 24669 79130 19 43646 20 21 6966...
output:
1814 1813 18853 18851 18850 42125 48045 51189 18228 56832 8761 17388 67745 71375 56412 45626 57374 34895 88897 56127 78624 5002 96309 81492 87323 73142 2141 99266 99347 98591 51021 4500 82214 155 175 174 824 1123 2103 2165 2438 2437 1632 2788 3375 3991 4086 4266 4463 4462 5025 5543 5997 5995 6909 69...
result:
ok q=100000
Test #59:
score: 0
Accepted
time: 104ms
memory: 9272kb
input:
100000 100000 34616 1 58002 1 1 70045 10303 2 2 39631 40632 2 10056 3 41853 3 70173 3 4 92959 5 47483 16468 6 50684 6 67732 6 84535 7 47014 8 59046 9 10 65208 10 78362 11266 11 24545 11 12 21449 66415 12 92002 12 13 19643 13 23316 96267 14 91298 15 17801 16 49544 16 69757 16 4694 17 17 24548 221 18 ...
output:
7298 58265 58266 58264 1500 1505 1504 1503 2526 2605 2935 2934 3234 3904 3903 5740 4189 9525 13919 17923 6993 19824 19823 20328 20325 21799 21798 23009 23008 26356 28102 1605 30138 31014 31013 31011 31754 31282 29395 35794 35793 35791 36345 36344 36906 36905 896 38676 38675 38674 38827 38826 39508 1...
result:
ok q=100000
Test #60:
score: 0
Accepted
time: 69ms
memory: 9056kb
input:
100000 100000 1 14279 25034 1 1 25644 1 33907 55554 1 32635 2 48898 2 67742 2 30821 3 62159 3 62878 4 4 99567 5427 5 81073 5 40389 6 68943 6 86783 6 7 7357 8 43901 8 49165 66447 8 15193 10 10 27651 52896 10 11 21927 31071 11 65058 11 1885 12 12 86604 13 34951 13 57211 73415 13 76672 13 31146 14 4934...
output:
5 3 1 10 9 17 16 24 22 33 32 37 42 47 48 52 50 64 63 70 69 68 93 92 100 101 117 121 120 122 133 131 136 135 147 151 166 164 174 178 177 191 190 193 192 197 211 212 217 216 215 219 218 224 225 232 255 253 251 259 258 257 260 264 273 271 281 280 296 295 306 319 317 316 315 312 311 310 309 323 327 326 ...
result:
ok q=100000
Test #61:
score: 0
Accepted
time: 71ms
memory: 8688kb
input:
100000 100000 36686 1 2 28317 3 43331 58975 3 9005 5 5 38587 85424 5 87253 5 91242 6 7 12636 7 28747 43112 7 56525 7 95056 7 8 67866 8 96414 15486 9 9 17569 9 27913 9 45216 57385 9 12037 10 10 26847 68194 10 10 69558 91082 10 1181 11 29864 11 11 51315 74564 11 11 99360 50347 12 12 70424 80616 12 810...
output:
result:
ok q=100000
Test #62:
score: 0
Accepted
time: 73ms
memory: 8664kb
input:
100000 100000 19575 1 26203 1 72508 1 1 97963 14667 2 16976 2 3 6175 3 67390 3 85817 3 95274 61098 4 5 63076 48837 6 6 85456 8 11139 8053 9 9 14304 9 42080 78302 9 87001 9 95714 9 10 11640 10 38250 11 68261 33284 12 34067 13 37576 13 13 83578 15 23823 35578 16 57809 16 17 35284 43161 17 17 47477 516...
output:
result:
ok q=100000
Test #63:
score: 0
Accepted
time: 75ms
memory: 8652kb
input:
100000 100000 36059 1 46485 1 23653 2 73424 2 2 74494 51828 3 4 33328 53661 4 34793 5 6 51871 55444 6 6 65656 8 16246 8 34477 10425 9 62445 9 21534 10 10 30313 60761 10 96061 10 7597 11 11 15469 63367 12 40382 13 14 75126 15 56288 15 84929 53927 16 64468 16 17 53139 18 5845 76176 18 19 24677 19 5891...
output:
result:
ok q=100000
Test #64:
score: 0
Accepted
time: 85ms
memory: 8648kb
input:
100000 100000 20177 2 2 98955 3 46743 3 46866 62628 3 12631 4 75181 4 5 54593 27546 6 6 31901 6 83336 6 90688 7 32220 7 63366 8 61776 37721 9 9 48206 9 70008 96585 9 10 62990 98079 10 11 11607 21944 11 11 80964 13 9208 13 49235 13 69968 13 85800 38176 14 57272 14 15 3765 16 67576 17 40546 17 44435 1...
output:
result:
ok q=100000
Test #65:
score: 0
Accepted
time: 71ms
memory: 8664kb
input:
100000 100000 1 33218 2 26924 4 22063 4 72727 83189 4 5 26165 50928 5 6 12110 17480 7 39161 7 7 76692 20436 8 36025 8 9 52297 9 58874 67940 9 10 17168 10 40179 10665 11 11 26766 11 26798 28558 11 41443 11 91932 11 11 96520 12 38384 89050 13 14 44040 14 60933 63286 14 14 91796 38298 15 83369 15 20977...
output:
result:
ok q=100000
Test #66:
score: 0
Accepted
time: 75ms
memory: 8572kb
input:
100000 100000 97038 1 2 12394 73478 2 27345 3 3 52828 3 94198 17649 4 34700 4 4 48092 90308 4 4 92571 5 73178 5 96066 1197 6 79796 6 6 95080 7 6897 7 96564 8 57604 8 70048 29738 10 10 42975 10 99064 11 20156 11 25952 51206 11 11 97949 38714 12 92965 12 10950 13 15 6617 8272 15 17383 15 37580 15 5035...
output:
result:
ok q=100000
Test #67:
score: 0
Accepted
time: 80ms
memory: 8704kb
input:
100000 100000 1 43054 1 66061 45045 4 81759 5 15827 6 6 40801 78430 6 6 83704 3488 9 32237 9 10 8261 10 37635 98555 10 82566 11 30294 12 68894 12 13 32989 92708 14 94972 14 15 41948 16 28327 20490 17 52712 17 18 23230 18 77251 9533 19 66382 19 20 10583 23214 22 32369 22 24 32167 75443 24 26 9052 278...
output:
result:
ok q=100000
Test #68:
score: 0
Accepted
time: 55ms
memory: 8732kb
input:
99970 100000 2 1 1 3 1 4 1 5 1 6 1 7 8 1 9 1 1 10 11 1 1 12 13 1 1 14 15 1 1 16 17 1 1 18 19 1 1 20 21 1 22 1 23 1 1 24 25 1 1 26 1 27 1 28 29 1 1 30 1 31 1 32 33 1 34 1 35 1 36 1 37 1 38 1 39 1 40 1 41 1 1 42 1 43 1 44 1 45 46 1 47 1 48 1 1 49 50 1 1 51 1 52 1 53 54 1 1 55 56 1 57 1 1 58 59 1 1 60 ...
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 q=100000
Test #69:
score: 0
Accepted
time: 60ms
memory: 8148kb
input:
99970 100000 2 1 1 3 1 4 1 5 1 6 7 1 1 8 9 1 1 10 11 1 12 1 13 1 1 14 15 1 1 16 1 17 1 18 19 1 1 20 1 21 1 22 1 23 24 1 25 1 26 1 27 1 28 1 29 1 30 1 1 31 1 32 1 33 34 1 1 35 36 1 37 1 38 1 39 1 1 40 41 1 42 1 1 43 1 44 1 45 46 1 1 47 48 1 49 1 1 50 51 1 52 1 53 1 1 54 55 1 1 56 1 57 1 58 1 59 60 1 ...
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 q=100000
Test #70:
score: -100
Time Limit Exceeded
input:
99970 100000 1 2 3 1 1 4 1 5 1 6 7 1 1 8 9 1 1 10 11 1 1 12 13 1 14 1 15 1 16 1 1 17 18 1 19 1 1 20 1 21 22 1 23 1 1 24 25 1 1 26 1 27 28 1 29 1 30 1 1 31 32 1 1 33 1 34 1 35 36 1 1 37 38 1 39 1 40 1 1 41 42 1 43 1 1 44 45 1 1 46 47 1 48 1 49 1 1 50 51 1 1 52 53 1 1 54 55 1 1 56 57 1 58 1 59 1 60 1 ...