QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#290675 | #5498. 小园丁与老司机 | MoRanSky | 100 ✓ | 126ms | 23032kb | C++23 | 5.5kb | 2023-12-25 06:24:22 | 2023-12-25 06:24:22 |
Judging History
answer
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <map>
#define pb push_back
#define fi first
#define se second
#define mp make_pair
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int N = 5e4 + 10, INF = 1e9;
int n, pre[N], pos[N];
struct P{
int x, y, id;
bool operator < (const P &b) const {
if (y == b.y) return x < b.x;
return y < b.y;
}
} e[N];
PII inline max(PII x, PII y) {
return x > y ? x : y;
}
void inline upd(PII &x, PII y) {
if (y > x) x = y;
}
PII operator + (PII x, int y) {
return mp(x.fi + y, x.se);
}
int a[N];
int head[N], numE = 1;
struct E{
int next, v, w;
} g[(N + N * 3 * 2) * 2];
void inline addE(int u, int v, int w) {
g[++numE] = (E) { head[u], v, w };
head[u] = numE;
g[++numE] = (E) { head[v], u, 0 };
head[v] = numE;
}
void inline addEdge(int u, int v, int L, int U) {
a[v] += L, a[u] -= L;
addE(u, v, U - L);
}
void inline add(int u, int v) {
++u, ++v;
addEdge(u, v, 1, INF);
}
namespace t1{
PII f[N], g[N], h[N], nf[N], ng[N];
bool v1[N], v2[N], v3[N];
map<int, PII> H, L, R;
int Le[N], Re[N];
map<int, int> X, Y, Z;
void print(int x, int o) {
int k = 0;
int la = f[x].se, Lf = Le[la], Rf = Re[la];
if (!x) return;
if (!o) print(h[x].se, 1);
else {
if (f[x] == h[x]) print(f[x].se, 1);
else {
k = 1;
print(f[x].se, 0);
}
}
if (k) {
if (la > x) {
for (int i = la + 1; i <= Rf; i++) printf("%d ", pos[i]);
for (int i = la - 1; i > x; i--) printf("%d ", pos[i]);
} else {
for (int i = la - 1; i >= Lf; i--) printf("%d ", pos[i]);
for (int i = la + 1; i < x; i++) printf("%d ", pos[i]);
}
}
printf("%d ", pos[x]);
}
void inline work() {
PII ans = mp(0, 0);
L[0] = H[0] = R[0] = ans;
for (int i = 1; i <= n; i++) {
int j = i;
while (j < n && e[j + 1].y == e[i].y) j++;
PII v = mp(-INF, 0);
for (int k = i; k <= j; k++) {
Le[k] = i, Re[k] = j;
int x = e[k].x, y = e[k].y;
f[k] = g[k] = mp(-INF, 0);
if (H.count(x)) upd(f[k], H[x] + 1);
if (H[x] == mp(0, 0)) v1[k] = 1;
if (L.count(x + y)) upd(f[k], L[x + y] + 1);
if (L[x + y] == mp(0, 0)) v2[k] = 1;
if (R.count(x - y)) upd(f[k], R[x - y] + 1);
if (R[x - y] == mp(0, 0)) v3[k] = 1;
upd(g[k], v + (k - i));
upd(v, mp(f[k].fi, k));
}
v = mp(-INF, 0);
for (int k = j; k >= i; k--) {
int x = e[k].x, y = e[k].y;
PII t = mp(f[k].fi, k);
h[k] = f[k];
g[k] = max(g[k], v + (j - k));
upd(f[k], g[k]);
v = max(v, t);
H[x] = mp(f[k].fi, k);
L[x + y] = mp(f[k].fi, k);
R[x - y] = mp(f[k].fi, k);
upd(ans, mp(f[k].fi, k));
}
i = j;
}
int Ans = ans.fi;
printf("%d\n", Ans);
print(ans.se, 1);
puts("");
L.clear(), H.clear(), R.clear();
for (int j = n; j; j--) {
int i = j;
while (i > 1 && e[i - 1].y == e[j].y) i--;
PII v = mp(-INF, 0);
for (int k = i; k <= j; k++) {
int x = e[k].x, y = e[k].y;
nf[k] = mp(1, 0);
ng[k] = mp(-INF, 0);
if (H.count(x)) upd(nf[k], H[x] + 1);
if (L.count(x + y)) upd(nf[k], L[x + y] + 1);
if (R.count(x - y)) upd(nf[k], R[x - y] + 1);
upd(ng[k], v + j);
upd(v, mp(nf[k].fi - k, k));
}
v = mp(-INF, 0);
for (int k = j; k >= i; k--) {
int x = e[k].x, y = e[k].y;
PII t = mp(nf[k].fi, k);
ng[k] = max(ng[k], v + (-i));
upd(nf[k], ng[k]);
v = max(v, t + k);
if (H.count(x) && H[x].fi + f[k].fi == Ans) add(k, H[x].se);
if (L.count(x + y) && L[x + y].fi + f[k].fi == Ans) add(k, L[x + y].se);
if (R.count(x - y) && R[x - y].fi + f[k].fi == Ans) add(k, R[x - y].se);
if (nf[k].fi == Ans && ((x == 0 && v1[k]) || (x + y == 0 && v2[k]) || (x - y == 0 && v3[k]))) add(0, k);
H[x] = mp(nf[k].fi, k);
L[x + y] = mp(nf[k].fi, k);
R[x - y] = mp(nf[k].fi, k);
upd(ans, mp(nf[k].fi, k));
}
j = i;
}
}
}
namespace t2{
int S, T;
int q[N], d[N], cur[N];
bool bfs() {
int hh = 0, tt = 0;
memset(d, 0, sizeof d);
d[S] = 1, q[0] = S;
while (hh <= tt) {
int u = q[hh++]; cur[u] = head[u];
if (u == T) return 1;
for (int i = head[u]; i; i = g[i].next) {
int v = g[i].v;
if (!d[v] && g[i].w) {
d[v] = d[u] + 1;
q[++tt] = v;
}
}
}
return 0;
}
int dinic(int u, int flow) {
if (u == T) return flow;
int rest = flow;
for (int i = cur[u]; i && rest; i = g[i].next) {
cur[u] = i;
int v = g[i].v;
if (g[i].w && d[u] + 1 == d[v]) {
int k = dinic(v, min(rest, g[i].w));
if (!k) d[v] = 0;
g[i].w -= k, rest -= k, g[i ^ 1].w += k;
}
}
return flow - rest;
}
void inline work() {
++n;
int s, t;
s = n + 1, t = n + 2;
for (int i = 1; i <= n; i++) addE(s, i, INF), addE(i, t, INF);
S = t + 1, T = S + 1;
int tot = 0;
for (int i = 1; i <= n; i++) {
if (a[i] > 0) addE(S, i, a[i]);
else if (a[i] < 0) addE(i, T, -a[i]);
}
addE(t, s, INF);
int ans = 0, res;
while (bfs())
while (res = dinic(S, INF)) ans += res;
ans = g[numE].w;
g[numE].w = g[numE - 1].w = 0;
S = t, T = s;
while (bfs())
while (res = dinic(S, INF)) ans -= res;//, cout << res << "???";
printf("%d\n", ans);
}
}
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++) scanf("%d%d", &e[i].x, &e[i].y), e[i].id = i;
sort(e + 1, e + 1 + n);
for (int i = 1; i <= n; i++) pos[i] = e[i].id;
t1::work();
t2::work();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 5
Accepted
time: 1ms
memory: 8236kb
input:
5 -2 1 -1 1 0 1 1 1 2 1
output:
5 4 3 2 1 5 3
result:
ok Correct.
Test #2:
score: 5
Accepted
time: 19ms
memory: 9352kb
input:
10000 -987 987 1974 1974 0 2961 -3948 3948 0 4935 0 5922 6909 6909 0 7896 0 8883 0 9870 -2961 10857 11844 11844 -12831 12831 9870 13818 14805 14805 -15792 15792 2961 16779 0 17766 -12831 18753 -19740 19740 0 20727 0 21714 6909 22701 23688 23688 24675 24675 -12831 25662 17766 26649 -27636 27636 28623...
output:
303 5993 7144 5087 5248 5504 1 5707 8820 8198 5543 9076 3 6149 7 12 15 24 25 9335 8548 9727 27 5326 7925 31 9407 9966 9337 7754 33 5712 6638 5209 9503 5069 7346 41 8736 9218 8932 45 49 6410 8804 77 5577 8682 8387 8099 81 8163 6323 6131 7309 6406 88 91 94 9530 9221 7048 5998 108 110 117 126 138 144 1...
result:
ok Correct.
Test #3:
score: 5
Accepted
time: 3ms
memory: 8336kb
input:
5000 19 3 7 41 -19 1 -13 31 -5 31 -17 9 -50 9 12 21 1 21 -33 28 -43 13 -34 29 -26 35 17 15 -24 41 -12 1 -22 43 -34 3 -30 10 -18 37 8 36 39 1 22 7 -31 25 22 25 -22 47 32 1 43 23 -35 11 -3 41 -40 13 -15 1 -26 21 -46 21 6 45 9 4 -43 4 -24 37 -30 21 29 37 -8 31 41 33 -13 29 -25 36 -33 9 -32 47 -1 41 30 ...
output:
5000 622 1057 199 734 118 1310 1153 888 819 303 446 423 271 16 652 1000 32 134 904 956 3 156 213 431 187 95 440 380 502 555 132 691 969 69 285 492 253 120 1263 334 169 278 1030 58 516 183 526 111 494 705 407 214 681 757 536 910 316 1526 389 663 206 724 312 725 73 86 491 702 895 107 1133 414 954 241 ...
result:
ok Correct.
Test #4:
score: 5
Accepted
time: 81ms
memory: 12152kb
input:
50000 76 485 249 177 -20 159 -385 441 319 461 475 67 -343 80 110 251 339 346 347 73 301 213 179 1 -197 421 -225 437 -91 396 356 365 -136 269 20 326 387 21 -500 317 -227 329 -90 321 116 141 -300 299 81 333 -126 406 -447 191 377 161 179 405 72 95 116 325 424 169 -269 303 -84 351 -250 469 -93 357 -256 ...
output:
48252 47630 22341 9190 16107 27542 35643 13383 903 16561 13054 1565 22365 2583 30699 35996 5864 4609 31012 49907 32174 1392 3513 48878 14129 19521 41863 27843 739 31697 13420 2839 7075 1150 14647 18840 38868 46533 4090 6847 46087 2475 20368 9009 40151 28257 36483 21486 16462 10484 13778 3684 4170 12...
result:
ok Correct.
Test #5:
score: 5
Accepted
time: 10ms
memory: 8924kb
input:
5000 0 1 -2 2 -3 3 0 4 5 5 0 6 0 7 7 8 3 9 6 10 -11 11 -12 12 3 13 0 14 -15 15 -16 16 11 17 14 18 -19 19 -10 20 15 21 -22 22 -15 23 14 24 -25 25 22 26 26 27 0 28 9 29 0 30 -15 31 28 32 -1 33 -4 34 -25 35 32 36 31 37 -6 38 39 39 -30 40 0 41 36 42 43 43 44 44 -13 45 40 46 -47 47 -2 48 0 49 6 50 -15 51...
output:
99 5 39 43 44 52 56 57 60 64 69 84 90 93 96 124 129 215 221 223 252 269 276 286 297 356 419 423 426 450 459 497 513 540 607 613 697 705 720 724 730 760 835 939 994 996 1008 1025 1048 1168 1178 1280 1357 1430 1525 1526 1656 1732 1736 1795 1800 1827 1887 2201 2204 2270 2370 2422 2604 2688 2726 2763 27...
result:
ok Correct.
Test #6:
score: 5
Accepted
time: 1ms
memory: 8100kb
input:
100 1 1 -2 2 -3 3 -4 4 5 5 0 6 -7 7 -8 8 0 9 2 10 11 11 -7 12 -7 13 14 14 -5 15 8 16 1 17 -1 18 0 19 12 20 0 21 22 22 0 23 24 24 -2 25 18 26 23 27 28 28 18 29 -13 30 -7 31 23 32 0 33 7 34 0 35 -7 36 4 37 -7 38 -13 39 40 40 20 41 -42 42 -8 43 44 44 2 45 -29 46 -6 47 39 48 49 49 -13 50 4 103 -8 105 -1...
output:
59 2 3 4 7 12 18 19 21 23 25 34 37 47 96 75 58 71 66 61 63 89 59 55 74 65 98 92 91 73 54 85 80 70 60 51 79 62 56 78 87 72 99 100 67 82 81 64 52 68 76 77 84 88 83 95 94 69 53 57 10
result:
ok Correct.
Test #7:
score: 5
Accepted
time: 68ms
memory: 12548kb
input:
30000 0 987 1974 1974 -2961 2961 3948 3948 -987 4935 5922 5922 987 6909 0 7896 -8883 8883 9870 9870 -2961 10857 11844 11844 12831 12831 0 13818 -14805 14805 11844 15792 2961 16779 0 17766 -18753 18753 0 19740 20727 20727 -2961 21714 9870 22701 11844 23688 987 24675 0 25662 -26649 26649 -19740 27636 ...
output:
237 3 5 7 8 11 14 18 20 31 39 41 63 69 72 74 84 114 117 153 168 204 224 226 303 315 320 328 356 373 383 386 391 399 400 406 408 626 627 640 646 680 690 702 721 730 789 820 850 891 900 914 928 944 1021 1027 1068 1144 1197 1200 1345 1358 1428 1502 1586 1613 1642 1716 1743 1774 1776 1803 1814 1817 1844...
result:
ok Correct.
Test #8:
score: 5
Accepted
time: 0ms
memory: 8228kb
input:
10 -1 1 1 1 -2 2 0 8 0 9 0 10 5 5 99 99 -3 3 0 7
output:
4 1 2 7 8 4
result:
ok Correct.
Test #9:
score: 5
Accepted
time: 7ms
memory: 10272kb
input:
5000 3 1 35 1 28 29 -5 11 -40 7 34 1 13 9 40 1 -45 13 -35 1 42 13 -24 29 -10 41 -17 47 28 23 15 37 -24 45 -27 25 -3 31 33 25 13 21 -7 41 -34 2 35 37 -13 35 24 41 23 21 33 23 -33 13 -11 21 -27 21 -50 9 7 48 13 23 -19 41 40 5 -45 31 -49 31 -25 1 38 43 -22 41 -24 47 6 31 -24 25 33 11 22 1 17 25 22 21 -...
output:
5000 1262 841 1436 476 932 486 423 434 282 738 148 549 1144 450 833 131 552 492 308 98 92 77 631 425 879 1054 39 986 186 725 118 101 323 821 50 1309 10 379 444 428 483 274 223 86 227 115 1069 437 802 870 265 388 675 1 1671 1045 112 276 201 779 630 671 764 747 1411 656 699 392 334 144 327 64 46 564 4...
result:
ok Correct.
Test #10:
score: 5
Accepted
time: 58ms
memory: 11728kb
input:
30000 -987 987 0 1974 0 2961 0 3948 4935 4935 0 5922 0 6909 -7896 7896 0 8883 9870 9870 0 10857 -3948 11844 -3948 12831 -11844 13818 5922 14805 9870 15792 -8883 16779 -17766 17766 0 18753 0 19740 20727 20727 -1974 21714 -3948 22701 -23688 23688 0 24675 25662 25662 -18753 26649 23688 27636 26649 2862...
output:
425 15143 1 15802 20123 18024 19403 15070 15725 2 3 4 6 16 21780 23872 25784 21 24840 19877 28 18883 28420 29 25682 18513 21637 31 37 25592 19061 49 27061 26071 19967 21886 27101 27284 27594 51 21595 52 28750 21679 57 25647 23536 81 22527 15290 21130 105 108 15408 27851 22754 151 27029 17283 182 233...
result:
ok Correct.
Test #11:
score: 5
Accepted
time: 126ms
memory: 17220kb
input:
50000 1 1 -2 2 -2 3 4 4 -5 5 2 6 -7 7 0 8 -9 9 0 10 0 11 -4 12 -5 13 0 14 15 15 16 16 -9 17 12 18 19 19 2 20 -20 21 -14 22 5 23 0 24 -3 25 12 26 16 27 4 28 -5 29 0 30 7 31 -8 32 -9 33 -12 34 17 35 -28 36 37 37 30 38 12 39 2 40 33 41 4 42 -43 43 0 44 -35 45 33 46 -17 47 4 48 3 49 -40 50 51 51 8 52 0 ...
output:
232 1 4 6 8 10 11 14 24 30 44 53 54 56 97 132 139 176 190 239 297 302 318 358 376 392 408 472 484 506 546 639 780 800 819 868 930 1083 1110 1155 1157 1201 1211 1232 1290 1305 1312 1361 1433 1480 1509 1527 1634 1682 1686 1732 1734 1896 1932 2210 2269 2436 2515 2612 2708 2744 2780 2830 2903 3029 3048 ...
result:
ok Correct.
Test #12:
score: 5
Accepted
time: 82ms
memory: 12300kb
input:
50000 -122 242 -486 221 293 93 -141 393 322 353 -111 269 -118 390 -291 77 -302 239 347 285 -353 75 -97 89 490 1 -487 435 -500 265 147 499 -129 450 -49 499 -38 9 301 230 402 51 410 417 319 321 -292 316 -248 301 72 421 379 181 5 431 278 105 -367 65 -409 103 -248 37 -81 465 -423 1 -360 61 67 1 395 61 3...
output:
48586 183 3758 2138 10659 38128 6618 12556 9300 16440 28902 9325 5056 49174 2158 40329 18726 7067 16438 19141 10955 6797 26713 301 42240 24340 20374 27337 55 4212 21515 2052 14246 26251 30386 30375 38278 3053 1674 18327 49747 14136 37141 34666 11503 32086 30513 38957 38103 29856 1566 19267 14306 139...
result:
ok Correct.
Test #13:
score: 5
Accepted
time: 117ms
memory: 16588kb
input:
50000 -987 987 -1974 1974 2961 2961 3948 3948 -4935 4935 0 5922 -1974 6909 0 7896 0 8883 0 9870 -10857 10857 -11844 11844 2961 12831 2961 13818 -5922 14805 7896 15792 -1974 16779 -17766 17766 2961 18753 0 19740 -11844 20727 -13818 21714 -11844 22701 0 23688 -15792 24675 25662 25662 2961 26649 -7896 ...
output:
556 25299 38765 25610 25426 38103 34013 30329 1 28705 48624 34186 35654 25880 37510 30280 33217 7 44159 47626 41615 9 28920 10 37486 13 14 31630 39586 19 31639 35422 24 45816 27 30 34 41 46326 34117 32183 38500 48412 33183 25924 44 49 37583 29507 32419 37585 47899 57 31057 68 45242 48169 76 78 44107...
result:
ok Correct.
Test #14:
score: 5
Accepted
time: 0ms
memory: 9424kb
input:
5000 -1 1 -2 1 -3 1 -4 1 -5 1 -6 1 -7 1 -8 1 -9 1 -10 1 -11 1 -12 1 -13 1 -14 1 -15 1 -16 1 -17 1 -18 1 -19 1 -20 1 -21 1 -22 1 -23 1 -24 1 -25 1 -26 1 -27 1 -28 1 -29 1 -30 1 -31 1 -32 1 -33 1 -34 1 -35 1 -36 1 -37 1 -38 1 -39 1 -40 1 -41 1 -42 1 -43 1 -44 1 -45 1 -46 1 -47 1 -48 1 -49 1 -50 1 -51 ...
output:
2500 5000 4999 4998 4997 4996 4995 4994 4993 4992 4991 4990 4989 4988 4987 4986 4985 4984 4983 4982 4981 4980 4979 4978 4977 4976 4975 4974 4973 4972 4971 4970 4969 4968 4967 4966 4965 4964 4963 4962 4961 4960 4959 4958 4957 4956 4955 4954 4953 4952 4951 4950 4949 4948 4947 4946 4945 4944 4943 4942 ...
result:
ok Correct.
Test #15:
score: 5
Accepted
time: 2ms
memory: 6364kb
input:
1000 0 1 -1 2 -3 3 -3 4 -5 5 0 6 0 7 -3 8 9 9 0 10 0 11 11 12 7 13 14 14 8 15 -16 16 0 17 18 18 -19 19 -20 20 0 21 1 22 23 23 24 24 -15 25 0 26 -4 27 0 28 -9 29 30 30 0 31 21 32 -33 33 26 34 0 35 36 36 30 37 -38 38 -1 39 8 40 15 41 42 42 -17 43 -44 44 8 45 2 46 0 47 -48 48 -5 49 -49 50 48 51 -36 52 ...
output:
83 1 2 4 7 10 11 17 21 26 28 31 35 47 53 62 68 79 83 88 117 125 155 167 183 230 253 280 283 292 308 314 316 332 346 426 462 474 517 530 546 526 520 528 534 522 545 512 541 519 544 539 536 550 533 511 537 523 527 518 504 531 509 532 540 515 502 506 535 516 542 538 549 505 547 510 548 525 507 503 501 ...
result:
ok Correct.
Test #16:
score: 5
Accepted
time: 20ms
memory: 9520kb
input:
10000 -987 987 -1974 1974 -2961 2961 3948 3948 -4935 4935 0 5922 -6909 6909 -7896 7896 -8883 8883 0 9870 -10857 10857 -5922 11844 -12831 12831 -1974 13818 4935 14805 -15792 15792 987 16779 -1974 17766 -987 18753 -19740 19740 20727 20727 -21714 21714 -16779 22701 23688 23688 -7896 24675 -25662 25662 ...
output:
298 1 2 3 6 7104 6408 9180 9807 7938 9092 8340 8763 7 7212 9 12 9117 7534 18 19 5771 8957 29 30 32 37 7137 44 52 8695 7758 54 68 7444 7325 8467 72 6012 9364 9900 80 85 8135 8773 8726 8171 161 7497 9705 184 5030 8722 9109 5058 198 232 9671 6194 5944 9424 239 8681 8359 7498 260 8272 6945 9285 9305 684...
result:
ok Correct.
Test #17:
score: 5
Accepted
time: 5ms
memory: 9472kb
input:
5000 0 1 1 1 2 2 3 2 4 3 5 3 6 4 7 4 8 5 9 5 10 6 11 6 12 7 13 7 14 8 15 8 16 9 17 9 18 10 19 10 20 11 21 11 22 12 23 12 24 13 25 13 26 14 27 14 28 15 29 15 30 16 31 16 32 17 33 17 34 18 35 18 36 19 37 19 38 20 39 20 40 21 41 21 42 22 43 22 44 23 45 23 46 24 47 24 48 25 49 25 50 26 51 26 52 27 53 27...
output:
5000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101...
result:
ok Correct.
Test #18:
score: 5
Accepted
time: 121ms
memory: 17096kb
input:
50000 1 1 0 2 3 3 -4 4 -5 5 6 6 -7 7 8 8 6 9 0 10 -11 11 6 12 6 13 2 14 5 15 0 16 -5 17 -8 18 -3 19 18 20 21 21 5 22 21 23 -8 24 9 25 0 26 24 27 1 28 -27 29 8 30 23 31 32 32 23 33 -4 34 0 35 4 36 -2 37 -4 38 39 39 40 40 15 41 -13 42 29 43 15 44 24 45 -28 46 -17 47 26 48 0 49 -16 50 6 51 -52 52 6 53 ...
output:
252 4 5 7 11 52 61 81 92 109 130 140 156 198 204 240 243 252 268 323 337 343 350 362 393 417 418 428 488 489 530 587 636 723 791 793 812 897 910 925 934 943 957 1097 1125 1135 1172 1218 1242 1250 1320 1341 1500 1519 1617 1628 1650 1716 1772 1851 1897 1936 1951 1959 2069 2099 2101 2165 2468 2492 2548...
result:
ok Correct.
Test #19:
score: 5
Accepted
time: 121ms
memory: 16612kb
input:
50000 0 987 -1974 1974 2961 2961 -1974 3948 987 4935 0 5922 -6909 6909 -7896 7896 -6909 8883 5922 9870 4935 10857 -1974 11844 12831 12831 0 13818 0 14805 -15792 15792 1974 16779 -17766 17766 -12831 18753 -1974 19740 0 20727 21714 21714 -20727 22701 0 23688 -22701 24675 0 25662 -26649 26649 21714 276...
output:
575 45336 35404 40822 32907 28561 30556 36659 26589 26881 28626 40066 3 35815 35895 38654 40949 5 28078 42950 7 12 14 45466 25229 21 24 27111 29 32 32346 42939 36 48148 43911 38 42 41071 45 35474 48077 48 41901 51 29570 49318 58 32146 38814 45723 36956 36768 64 40047 25242 39789 43207 43263 81 104 2...
result:
ok Correct.
Test #20:
score: 5
Accepted
time: 105ms
memory: 23032kb
input:
50000 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 ...
output:
50000 1 25000 25001 2 3 25002 25003 4 5 25004 25005 6 7 25006 25007 8 9 25008 25009 10 11 25010 25011 12 13 25012 25013 14 15 25014 25015 16 17 25016 25017 18 19 25018 25019 20 21 25020 25021 22 23 25022 25023 24 25 25024 25025 26 27 25026 25027 28 29 25028 25029 30 31 25030 25031 32 33 25032 25033 ...
result:
ok Correct.
Extra Test:
score: 0
Extra Test Passed