QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#718728 | #9606. PM 大师 | 251Sec | 60 | 7319ms | 179156kb | C++14 | 3.0kb | 2024-11-06 21:17:42 | 2024-11-06 21:17:45 |
Judging History
answer
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
const int inf = 0x3f3f3f3f;
int n, q, a[1000005];
int c[1000005];
multiset<int> pos[1000005];
tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> s;
int O(int x) {
int t = s.order_of_key(x);
if (*(s.find_by_order(t)) == x) return t + 1;
return t;
}
struct Seg {
struct Dat {
int u, w;
Dat operator+(const Dat &b) const {
if (w != b.w) return w < b.w ? *this : b;
return u < b.u ? *this : b;
}
} f[4000005];
int tg[4000005];
void Pushtag(int p, int w) {
f[p].w += w, tg[p] += w;
}
void Pushdown(int p) {
Pushtag(p << 1, tg[p]), Pushtag(p << 1 | 1, tg[p]);
tg[p] = 0;
}
void Build(int p, int l, int r) {
f[p].w = inf, f[p].u = l;
if (l == r) return;
int mid = l + r >> 1;
Build(p << 1, l, mid), Build(p << 1 | 1, mid + 1, r);
}
void Modify(int p, int l, int r, int L, int R, int w) {
if (l >= L && r <= R) return Pushtag(p, w);
if (l > R || r < L) return;
int mid = l + r >> 1;
Pushdown(p);
Modify(p << 1, l, mid, L, R, w), Modify(p << 1 | 1, mid + 1, r, L, R, w);
f[p] = f[p << 1] + f[p << 1 | 1];
}
void ModifyP(int p, int l, int r, int i, int w) {
if (l == r) return void(f[p].w = w);
int mid = l + r >> 1;
Pushdown(p);
if (i <= mid) ModifyP(p << 1, l, mid, i, w);
else ModifyP(p << 1 | 1, mid + 1, r, i, w);
f[p] = f[p << 1] + f[p << 1 | 1];
}
} fS, gS;
void UpdF(int w) {
if (s.find(w) != s.end()) {
fS.ModifyP(1, 1, n, w, inf);
return;
}
if (pos[w].size()) fS.ModifyP(1, 1, n, w, O(w) - c[*pos[w].begin()]);
else fS.ModifyP(1, 1, n, w, -inf);
}
void UpdG(int w) {
if (s.find(w) == s.end()) {
gS.ModifyP(1, 1, n, w, inf);
return;
}
if (pos[w].size()) gS.ModifyP(1, 1, n, w, c[*pos[w].begin()] - O(w));
else gS.ModifyP(1, 1, n, w, inf);
}
void Upd() {
while (true) {
if (fS.f[1].w < 0) {
int i = fS.f[1].u;
s.insert(i);
UpdF(i), UpdG(i);
fS.Modify(1, 1, n, i + 1, n, 1);
gS.Modify(1, 1, n, i + 1, n, -1);
continue;
}
if (gS.f[1].w < 0) {
int i = gS.f[1].u;
s.erase(i);
UpdF(i), UpdG(i);
fS.Modify(1, 1, n, i + 1, n, -1);
gS.Modify(1, 1, n, i + 1, n, 1);
continue;
}
break;
}
}
void Ins(int p, int w) {
if (w == -1) return;
pos[w].insert(p);
UpdF(w), UpdG(w), Upd();
}
void Del(int p, int w) {
if (w == -1) return;
pos[w].erase(pos[w].find(p));
UpdF(w), UpdG(w), Upd();
}
int main() {
scanf("%d%d", &n, &q);
fS.Build(1, 1, n), gS.Build(1, 1, n);
for (int i = 1; i <= n; i++) {
scanf("%d", a + i);
if (!a[i]) c[i] = 1;
}
for (int i = 1; i <= n; i++) c[i] += c[i - 1];
for (int i = 1; i <= n; i++) s.insert(i);
while (q--) {
int x, k, y; scanf("%d%d%d", &x, &k, &y);
Del(x, a[x]), Ins(x, a[x] = k);
if (a[y]) printf("%d\n", a[y]);
else printf("%d\n", *(s.find_by_order(c[y] - 1)));
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 0ms
memory: 57032kb
input:
10 10 0 -1 0 0 -1 0 -1 -1 0 -1 7 5 9 7 5 1 10 8 4 7 10 1 8 -1 3 10 6 4 2 2 1 2 9 6 5 8 4 7 -1 9
output:
6 1 3 1 2 3 1 4 3 5
result:
ok 10 lines
Test #2:
score: 10
Accepted
time: 37ms
memory: 58184kb
input:
10000 10000 -1 0 -1 -1 -1 0 -1 0 -1 0 -1 0 0 -1 -1 0 0 -1 0 -1 -1 -1 0 0 -1 -1 0 -1 -1 -1 0 0 0 -1 0 -1 -1 -1 -1 0 -1 -1 0 -1 -1 0 -1 -1 0 0 -1 0 0 0 -1 -1 -1 -1 0 0 0 0 -1 0 -1 -1 0 -1 -1 -1 0 0 -1 0 0 -1 -1 0 0 -1 -1 -1 -1 0 0 0 -1 0 -1 0 0 0 0 -1 0 0 -1 -1 0 -1 -1 -1 0 -1 0 -1 0 0 -1 -1 0 -1 -1 0...
output:
37 1767 2083 1505 2208 3174 1012 3136 4044 2661 802 4772 931 2188 605 732 1473 1221 4070 706 3786 464 300 2857 4852 3026 2965 2102 4096 4859 1841 60 2465 645 4312 2002 4168 3292 2854 2043 194 4748 3298 1687 916 4465 1101 4649 4552 598 3717 3883 2111 1911 2502 2265 2737 2193 4200 3607 4086 3908 2529 ...
result:
ok 10000 lines
Test #3:
score: 10
Accepted
time: 33ms
memory: 58064kb
input:
10000 10000 0 0 -1 0 0 -1 0 0 0 0 0 0 0 0 -1 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 ...
output:
6984 1876 1755 3945 3988 8817 1301 9211 6838 70 2044 5300 4026 6870 1879 7611 2604 5187 8292 1796 5087 2635 2369 8040 5721 6993 5554 966 5743 4301 8644 4755 2400 4647 6158 6998 2597 7698 8252 6522 8528 8153 3332 2833 4289 3081 9022 6921 6121 1549 2801 958 9507 2148 7998 4954 8624 7643 22 4162 5666 8...
result:
ok 10000 lines
Test #4:
score: 10
Accepted
time: 36ms
memory: 58052kb
input:
10000 10000 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 -1 0 -1 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 -1 0 -1 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 ...
output:
549 7364 7058 4716 4807 6918 163 2855 4219 8220 1848 2315 1228 6516 1570 7755 728 911 2810 2028 3977 6371 8418 788 2040 7159 7360 3776 8573 8326 3057 3814 3587 4894 2018 5314 812 5691 5689 7967 4493 7806 1966 5618 6862 3303 1947 6878 7511 6879 5418 5836 8916 5951 4960 1424 1290 4315 873 3208 1774 73...
result:
ok 10000 lines
Test #5:
score: 10
Accepted
time: 31ms
memory: 60128kb
input:
10000 10000 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 -1 -1 -1 -1 0 0 0 0 0 -1 -1 0 0 0 -1 0 0 0 0 -1 0 0 -1 0 0 0 -1 -1 0 -1 -1 0 -1 -1 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 -1 0 -1 0 0 -1 0 0 0 0 -1 0 0 0 0 0 0 0 -1 0 0 0 -1 0 -1 -1 0 0 0 ...
output:
3638 2094 6615 88 2643 3081 3993 7204 6569 1008 7035 4008 6846 2407 2888 6884 5588 340 3145 3234 3779 2608 6289 1428 2477 3411 161 2203 2128 5677 1759 2106 6596 313 7461 5011 1208 3021 7029 3452 4582 6173 479 4360 224 3681 5249 2351 569 1369 5212 5572 3429 7152 6636 6318 6928 6644 6678 5661 4229 185...
result:
ok 10000 lines
Test #6:
score: 10
Accepted
time: 37ms
memory: 60080kb
input:
10000 10000 -1 0 0 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 0 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 0 -1 -1 0 -1 -1 0 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 0 -1 0 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 0 -1 -1 -1 0 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 0 0 -1 -1 -1 -1 0 0 -1 -1 -1 -1 -1 ...
output:
2420 325 2194 1102 1154 1391 12 1517 1948 1801 593 441 975 1902 1078 184 226 587 52 2361 1584 2137 2255 190 1904 193 636 62 1915 1028 1751 612 330 659 1700 1672 1073 756 202 425 766 522 1844 2295 744 37 865 2367 32 1066 948 1026 1162 812 625 1512 161 1394 2372 429 1232 1155 1295 998 1941 1632 1151 1...
result:
ok 10000 lines
Test #7:
score: 10
Accepted
time: 30ms
memory: 58188kb
input:
10000 10000 -1 0 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 0 -1 0 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0...
output:
219 484 774 725 570 54 54 931 240 552 787 897 322 15 756 440 675 152 337 275 408 856 622 562 494 3 890 858 849 460 141 187 119 271 441 426 550 804 308 823 398 918 244 522 213 785 84 429 428 500 619 179 808 173 853 1011 955 46 375 520 704 416 955 800 661 899 953 533 319 87 1011 172 254 810 842 879 59...
result:
ok 10000 lines
Test #8:
score: 10
Accepted
time: 31ms
memory: 58196kb
input:
10000 10000 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1...
output:
236 370 232 128 262 311 250 336 164 107 97 183 354 3 346 307 282 350 99 214 350 489 170 373 130 81 221 200 184 275 451 67 60 70 41 472 153 479 288 228 212 332 68 76 338 114 242 116 207 22 234 204 451 213 258 159 34 193 259 122 448 105 131 177 474 490 439 405 170 322 380 360 425 33 414 302 191 161 33...
result:
ok 10000 lines
Subtask #2:
score: 0
Time Limit Exceeded
Test #9:
score: 10
Accepted
time: 7319ms
memory: 162776kb
input:
1000000 1000000 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1...
output:
459886 53317 492356 423943 292374 39197 57078 411846 146532 49283 12402 316482 109785 61994 283770 156543 483178 281298 130833 46233 335000 428931 210801 24959 71722 361514 117444 218823 54814 378720 81973 194272 135873 484070 293734 303811 349950 344506 479375 229463 8421 114254 237253 295732 15835...
result:
ok 1000000 lines
Test #10:
score: 0
Time Limit Exceeded
input:
1000000 1000000 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1...
output:
231864 158988 610606 558023 74606 42402 245012 525664 260911 510218 257983 146399 83879 681860 375125 59670 894882 210723 509929 9256 413137 839173 549143 526070 729809 423388 596082 184674 660967 119639 742727 901832 938252 900078 190461 920677 441621 942117 188500 185870 522884 40015 9817 716146 7...
result:
Subtask #3:
score: 10
Accepted
Test #16:
score: 10
Accepted
time: 4470ms
memory: 170276kb
input:
1000000 1000000 0 -1 -1 0 -1 -1 0 -1 0 -1 0 0 0 0 -1 -1 -1 0 -1 0 -1 0 -1 -1 0 -1 -1 -1 0 -1 -1 -1 0 -1 0 0 0 -1 -1 -1 -1 0 -1 -1 0 0 -1 -1 0 -1 -1 -1 0 -1 0 -1 0 0 -1 0 -1 -1 -1 -1 -1 -1 -1 0 -1 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 -1 0 0 0 -1 -1 -1 0 0 0 -1 0 0 0 -1 -1 0 0 0 0 -1 -1 0 0 0 0 -1 0 -1 0 0 0...
output:
419426 372348 476911 34348 150780 460622 223328 283198 443164 347044 103688 492126 361590 20471 24004 315761 428482 18708 420730 182298 498955 177266 56353 462764 158257 244933 422040 484780 403241 187513 20639 466402 267820 384702 293959 84073 125864 363325 86066 479275 368199 195169 20943 82210 29...
result:
ok 1000000 lines
Test #17:
score: 10
Accepted
time: 3824ms
memory: 152540kb
input:
1000000 1000000 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 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:
877817 169670 503865 868941 757832 762592 267527 132121 530021 515297 594043 369906 279274 769900 279993 925891 867298 65017 327392 534338 454981 371962 773139 594668 861490 297472 691830 240392 6931 837802 329267 717727 622016 302076 867101 808473 234174 156539 246761 217031 706530 892460 804744 36...
result:
ok 1000000 lines
Test #18:
score: 10
Accepted
time: 4314ms
memory: 154812kb
input:
1000000 1000000 0 0 0 0 -1 0 0 0 0 0 0 0 -1 0 0 -1 0 0 0 -1 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 -...
output:
76964 254688 647867 132442 555987 772576 148660 189913 890249 469690 650795 527444 823200 239204 536286 369356 374355 316809 102958 181712 133162 278773 624648 23406 191762 690329 48553 204392 70394 472228 352467 863376 689494 255188 762658 128967 848134 101255 825979 353786 758958 597186 80265 8005...
result:
ok 1000000 lines
Test #19:
score: 10
Accepted
time: 4455ms
memory: 161488kb
input:
1000000 1000000 0 0 -1 0 0 0 0 0 -1 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 -1 0 -1 0 0 0 0 0 0 0 0 -1 0 -1 0 -1 0 -1 0 0 0 0 0 0 0 0 0 0 -1 -1 0 0 0 0 -1 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 -1 0 -1 0 -1 0 -1 -1 0 0 0 0 -1 0 0 -1 -1 0 0 0 0 0 0 0 0 0 0 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 0 0 0 -1 -1 -1 ...
output:
301362 124661 594574 157761 452519 202544 349211 125801 300630 652855 79737 245694 343621 402370 220223 476997 106123 58847 28413 436012 281469 582215 577107 244922 278352 280065 748256 673531 10514 243821 418778 355056 186471 292616 428202 270231 545683 441274 487468 96171 653364 293158 395100 6348...
result:
ok 1000000 lines
Test #20:
score: 10
Accepted
time: 3517ms
memory: 176012kb
input:
1000000 1000000 -1 -1 -1 -1 -1 -1 0 -1 0 0 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 0 0 -1 -1 -1 -1 -1 0 0 -1 -1 -1 -1 -1 -1 0 -1 0 -1 0 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 0 -1 -1 0 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 0 0 -1 -1 -1 -1 -1 0 0 0 0 -1 0 -1 -1 -1 0 0 0 0 -1 -1 0 0 0 -1 -1 -1 -1 -1 -1 ...
output:
17462 58557 246658 26828 228805 46664 5019 174233 104683 211580 60036 225402 181205 52446 98450 212982 193185 179563 194752 23834 194419 83859 193437 130118 156179 245458 17678 50207 160851 30676 225732 67445 220034 72349 22635 6223 123948 109346 105038 193636 113546 110188 66568 124787 140476 40757...
result:
ok 1000000 lines
Test #21:
score: 10
Accepted
time: 3432ms
memory: 178420kb
input:
1000000 1000000 0 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 0 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 0 -1 -1 0 -1 0 -1 0 -1 -1 -1 -1 -1 -1 0 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -...
output:
39803 29623 63234 76116 87461 45159 12590 58765 7365 60656 1333 827 21466 7412 20037 21268 71878 14866 48131 59337 29187 66884 2578 94083 10058 23669 70154 29562 64147 74928 9714 61444 43695 25505 44102 89065 53943 61516 9907 29901 92226 17249 21627 45499 75849 54272 22009 10210 41368 99653 17547 43...
result:
ok 1000000 lines
Test #22:
score: 10
Accepted
time: 2935ms
memory: 179156kb
input:
1000000 1000000 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1...
output:
41794 11248 19370 9521 15603 231 33587 39333 33779 21719 13484 35524 29843 20241 10670 33496 23214 33568 43776 30681 495 8566 17874 35327 13257 40753 26163 17324 12968 7409 24322 17057 13897 48782 29846 19715 49649 38079 16190 42374 43535 7308 22123 7177 8266 28008 40105 12128 14380 45158 48919 3273...
result:
ok 1000000 lines
Subtask #4:
score: 10
Accepted
Test #23:
score: 10
Accepted
time: 5509ms
memory: 167504kb
input:
1000000 1000000 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1...
output:
99 15 51 89 58 47 81 4 40 58 14 26 26 2 62 3 28 51 13 23 91 62 25 6 56 7 25 56 87 8 66 40 56 50 75 68 70 51 54 64 79 22 59 53 45 5 13 34 44 67 18 48 7 13 63 84 50 45 48 42 47 47 4 89 35 22 59 55 5 69 14 61 84 91 51 55 92 28 31 68 17 58 50 81 61 58 54 91 34 12 26 80 50 21 6 7 43 11 73 70 1 49 35 42 1...
result:
ok 1000000 lines
Test #24:
score: 10
Accepted
time: 5499ms
memory: 168104kb
input:
1000000 1000000 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1...
output:
80 76 92 88 88 24 88 70 71 23 40 93 52 46 63 41 50 44 60 37 40 29 32 38 17 29 86 53 37 9 39 50 39 57 95 2 66 5 34 81 47 53 19 82 61 2 9 86 57 85 66 73 71 84 3 60 34 75 80 56 58 87 68 94 2 68 14 80 52 97 16 41 97 64 35 84 83 26 46 24 88 26 30 92 56 38 88 95 5 18 100 19 42 8 56 24 44 69 99 16 50 71 10...
result:
ok 1000000 lines
Test #25:
score: 10
Accepted
time: 5497ms
memory: 168068kb
input:
1000000 1000000 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1...
output:
31 56 68 1 88 75 26 48 60 62 24 63 5 51 24 29 30 72 15 73 50 87 82 11 55 56 84 37 57 87 22 75 93 86 58 28 25 21 90 97 66 11 49 65 8 37 100 93 77 90 47 5 21 18 20 100 42 28 88 99 34 34 66 96 9 50 56 13 76 95 31 70 16 90 95 25 44 97 77 100 48 7 23 88 76 48 43 22 92 71 49 6 81 51 16 5 29 32 44 93 42 24...
result:
ok 1000000 lines
Subtask #5:
score: 30
Accepted
Test #26:
score: 30
Accepted
time: 3430ms
memory: 165932kb
input:
1000000 499990 -1 0 -1 0 0 0 -1 0 0 0 -1 0 0 0 -1 -1 0 0 0 -1 0 -1 -1 0 0 0 0 -1 -1 0 -1 -1 -1 0 -1 0 -1 0 -1 0 0 0 0 -1 0 -1 0 0 0 0 0 -1 0 -1 -1 -1 0 -1 -1 0 0 0 0 -1 -1 -1 0 0 0 -1 -1 0 0 -1 0 -1 -1 0 -1 -1 -1 0 0 0 -1 0 0 0 0 -1 0 0 -1 -1 0 -1 0 0 -1 -1 0 0 -1 0 0 0 -1 -1 -1 -1 0 -1 0 -1 -1 -1 0...
output:
122348 449823 381435 492392 497609 306719 456448 468935 453769 131422 210398 134485 239919 286756 212338 48890 92958 296248 50112 369374 68132 168648 21288 329297 217369 338217 432768 374186 173797 122895 10249 126058 161754 64109 25040 96703 73480 214083 473367 351678 289989 105133 455653 50593 250...
result:
ok 499990 lines
Test #27:
score: 30
Accepted
time: 693ms
memory: 160024kb
input:
1000000 50011 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
output:
919658 553478 16799 88273 466906 665678 236667 710244 510205 781710 608312 529251 737092 417257 927478 593624 333374 644792 785167 654830 496068 6284 779632 691219 845727 579257 93857 322734 890777 87819 622388 703546 141171 454693 614782 197928 207053 782698 255989 567493 867801 877293 457839 42933...
result:
ok 50011 lines
Test #28:
score: 30
Accepted
time: 1061ms
memory: 160604kb
input:
1000000 99995 -1 0 0 0 0 0 0 -1 -1 0 0 -1 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 -1 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0...
output:
49938 656925 571376 117084 108873 663835 572728 543876 588005 268851 640693 536005 302323 637062 897431 630313 312309 341789 334452 270739 157256 370168 210749 573115 718797 40014 218190 135533 592508 298312 484706 641584 759115 505429 755941 40675 801311 390311 767089 44866 425173 208074 512311 593...
result:
ok 99995 lines
Test #29:
score: 30
Accepted
time: 2082ms
memory: 163092kb
input:
1000000 250014 0 0 0 0 -1 0 0 0 0 0 -1 -1 0 -1 -1 0 0 -1 0 0 0 0 0 0 -1 0 0 0 0 0 -1 -1 0 0 0 0 0 0 0 0 0 0 0 -1 0 -1 0 0 0 -1 0 0 0 -1 0 -1 0 0 0 0 0 -1 0 0 0 -1 0 -1 0 0 0 -1 0 0 0 0 -1 0 0 0 0 0 0 -1 -1 -1 0 0 -1 -1 0 0 0 0 0 0 0 0 0 -1 -1 -1 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 ...
output:
40921 70204 315652 460903 134497 226220 501630 19812 381118 621565 7816 743667 199250 553666 45639 158188 511016 63407 102591 351313 399128 482671 215377 630162 92337 733909 723960 246131 679411 584092 157720 705366 527645 261651 331754 62695 61372 232834 34421 624368 509594 73319 125211 463806 2883...
result:
ok 250014 lines
Test #30:
score: 30
Accepted
time: 4119ms
memory: 175504kb
input:
1000000 749994 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 0 -1 0 -1 -1 0 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 0 -1 0 -1 0 -1 -1 -1 -1 0 -1 -1 -1 0 0 -1 -1 -1 -1 0 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 0 -1 0 -1 0 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 0 0 -1 -1 -1 0 -1 -1 0 -1...
output:
37202 190371 245478 62728 240658 239387 229062 249667 26805 148232 170665 110568 101986 185216 170044 174559 193288 103231 225060 37266 9689 8370 53146 244334 199871 239193 15559 150656 213671 234719 110081 66381 147638 111855 17238 62234 246442 1464 72459 146403 4114 208068 22027 213126 17509 69503...
result:
ok 749994 lines
Test #31:
score: 30
Accepted
time: 4622ms
memory: 174268kb
input:
1000000 900008 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 0 -1 -1 0 0 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1...
output:
82776 93285 80511 8834 94224 40408 80193 72272 40314 85291 97626 26414 1234 8449 42393 9918 57434 72138 9062 41307 4444 22216 10885 90238 52708 23209 94641 72376 42168 52947 6083 42366 32978 35270 89535 10005 4409 69687 98726 44374 69542 90082 41662 39137 83058 87287 62048 70126 90490 5569 35674 485...
result:
ok 900008 lines
Test #32:
score: 30
Accepted
time: 4717ms
memory: 178144kb
input:
1000000 950009 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 0 -1 -...
output:
49119 45050 22519 42138 21136 15539 43254 9649 10668 48846 29989 21975 11925 27548 19751 21187 106 9735 23197 10368 22010 47017 16418 24302 21435 14814 48039 19956 33930 17390 33631 40089 29482 49137 47134 19475 34804 39183 12927 17158 101 46801 22929 6943 147 22762 17712 34910 35548 21885 1373 1580...
result:
ok 950009 lines
Subtask #6:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
0%