QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#282641 | #7616. Jump Graph | light_ink_dots# | TL | 315ms | 99536kb | C++14 | 3.5kb | 2023-12-12 16:51:52 | 2023-12-12 16:51:52 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int maxn = 300010, maxlg = 20;
int lg[maxn], st[maxlg][maxn];
int pre[maxn], nxt[maxn];
int p[maxn], rev[maxn], n;
void solve(int, int);
long long ans[maxn];
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++) scanf("%d", p + i), rev[p[i]] = i, st[0][i] = p[i];
for (int i = 2; i <= n; i++) lg[i] = lg[i >> 1] + 1;
for (int l = 1; l <= lg[n]; l++)
for (int i = 1; i + (1 << l) - 1 <= n; i++)
st[l][i] = max(st[l - 1][i], st[l - 1][i + (1 << (l - 1))]);
for (int i = 1; i <= n; i++) {
if (p[i - 1] > p[i]) {
pre[i] = i - 1;
continue;
}
pre[i] = pre[i - 1];
while (pre[i] && p[pre[i]] < p[i]) pre[i]--;
}
nxt[n + 1] = n + 1;
for (int i = n; i; i--) {
if (p[i + 1] > p[i]) {
nxt[i] = i + 1;
continue;
}
nxt[i] = nxt[i + 1];
while (nxt[i] != n + 1 && p[nxt[i]] < p[i]) nxt[i]++;
}
solve(1, n);
for (int i = 1; i <= n; i++) printf("%lld ", ans[i]);
printf("\n");
return 0;
}
long long c(int l, int r) {
static unordered_map<long long, long long> mp;
if (l > r)
return 0;
if (l == r)
return 1;
long long I = 1ll * l * (n + 1) + r;
if (mp[I])
return mp[I];
if (nxt[l] < r)
return mp[I] = c(l, nxt[l]) + c(nxt[l], r) - 1;
if (pre[r] > l)
return mp[I] = c(l, pre[r]) + c(pre[r], r) - 1;
return mp[I] = c(l + 1, r - 1) + r - l + 1;
}
long long cL(int l) {
static unordered_map<int, long long> mp;
if (l > n)
return 0;
if (mp[l])
return mp[l];
if (nxt[l] == n + 1)
return mp[l] = cL(l + 1) + n - l + 1;
return mp[l] = c(l + 1, nxt[l] - 1) + cL(nxt[l]) + nxt[l] - l;
}
long long cR(int r) {
static unordered_map<int, long long> mp;
if (!r)
return 0;
if (mp[r])
return mp[r];
if (pre[r] == 0)
return mp[r] = cR(r - 1) + r;
return mp[r] = c(pre[r] + 1, r - 1) + cR(pre[r]) + r - pre[r];
}
int rmq(int l, int r) {
int Lg = lg[r - l + 1];
return max(st[Lg][l], st[Lg][r - (1 << Lg) + 1]);
}
void s(int l, int r) {
if (l > r)
return;
int mx = rmq(l, r), p = rev[mx];
auto L = c(p, r + 1) - 1, R = c(l - 1, p) - 1;
ans[l] += L, ans[p] -= L, ans[p + 1] += R, ans[r + 1] -= R;
auto x = c(l - 1, p - 1) + c(p + 1, r + 1) - 2;
ans[p] += x, ans[p + 1] -= x;
s(l, p - 1), s(p + 1, r);
return;
}
void sL(int r) {
if (!r)
return;
int mx = rmq(1, r), p = rev[mx];
auto L = c(p, r + 1) - 1, R = cR(p);
ans[1] += L, ans[p] -= L, ans[p + 1] += R, ans[r + 1] -= R;
auto x = cR(p - 1) + c(p + 1, r + 1) - 1;
ans[p] += x, ans[p + 1] -= x;
sL(p - 1), s(p + 1, r);
return;
}
void sR(int l) {
if (l == n + 1)
return;
int mx = rmq(l, n), p = rev[mx];
auto L = cL(p), R = c(l - 1, p) - 1;
ans[l] += L, ans[p] -= L, ans[p + 1] += R, ans[n + 1] -= R;
auto x = cL(p + 1) + c(l - 1, p - 1) - 1;
ans[p] += x, ans[p + 1] -= x;
s(l, p - 1), sR(p + 1);
return;
}
void solve(int l, int r) {
int mx = rmq(l, r), p = rev[mx];
auto L = cL(p), R = cR(p);
ans[1] += L, ans[p] -= L, ans[p + 1] += R, ans[n + 1] -= R;
auto x = cR(p - 1) + cL(p + 1);
ans[p] += x, ans[p + 1] -= x;
sL(p - 1), sR(p + 1);
for (int i = 1; i <= n; i++) ans[i] += ans[i - 1];
return;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 14340kb
input:
6 1 6 3 2 5 4
output:
11 7 7 7 6 8
result:
ok single line: '11 7 7 7 6 8 '
Test #2:
score: 0
Accepted
time: 0ms
memory: 10256kb
input:
2 1 2
output:
1 1
result:
ok single line: '1 1 '
Test #3:
score: 0
Accepted
time: 2ms
memory: 14076kb
input:
36 9 29 1 3 14 31 24 21 10 18 22 16 8 7 15 12 17 19 25 28 27 34 11 6 32 4 20 13 2 35 23 26 33 36 30 5
output:
92 89 90 90 91 78 73 71 71 71 65 65 64 64 63 65 65 70 74 85 95 91 111 111 109 111 110 110 110 107 136 136 137 136 168 168
result:
ok single line: '92 89 90 90 91 78 73 71 71 71 ...10 107 136 136 137 136 168 168 '
Test #4:
score: 0
Accepted
time: 2ms
memory: 14092kb
input:
63 30 17 34 8 29 57 2 62 35 27 24 22 54 53 60 37 31 19 1 5 20 14 3 36 38 40 56 39 50 32 51 9 15 52 55 45 63 41 6 47 23 7 33 10 26 61 16 58 43 42 44 48 28 12 49 11 59 4 21 25 46 13 18
output:
204 204 202 204 204 204 209 191 197 196 195 195 194 198 179 176 172 170 170 170 170 172 172 172 179 188 186 187 186 187 185 187 187 188 191 193 167 202 202 198 199 199 197 199 199 183 190 183 183 183 183 184 185 185 184 187 181 190 190 191 190 191 191
result:
ok single line: '204 204 202 204 204 204 209 19...87 181 190 190 191 190 191 191 '
Test #5:
score: 0
Accepted
time: 0ms
memory: 18180kb
input:
110 70 59 102 66 81 43 31 26 52 23 88 49 9 7 76 108 25 101 89 73 4 22 77 94 64 24 16 58 47 30 28 45 68 15 84 36 21 78 56 46 32 62 65 55 61 20 74 2 83 33 105 110 50 60 85 42 96 98 6 10 41 51 97 8 72 86 69 93 82 67 100 57 75 1 106 11 40 35 17 39 18 14 34 53 92 12 54 3 95 103 99 80 5 27 37 29 63 13 90 ...
output:
386 386 377 379 375 375 374 374 373 376 372 377 376 376 376 344 359 344 341 339 339 339 340 323 325 324 324 322 321 320 320 320 321 329 315 322 322 313 314 313 313 313 314 317 316 317 316 320 319 331 331 306 357 357 357 358 358 352 354 354 355 356 352 353 353 353 354 353 354 354 352 365 364 365 350 ...
result:
ok single line: '386 386 377 379 375 375 374 37...87 387 386 386 385 389 388 407 '
Test #6:
score: 0
Accepted
time: 2ms
memory: 18140kb
input:
192 186 25 95 115 187 44 154 54 80 121 89 117 68 74 27 137 171 112 22 60 6 109 97 14 101 166 82 126 15 69 92 51 174 162 65 156 132 150 56 138 20 93 85 103 164 26 77 124 170 34 185 188 116 98 120 123 148 16 100 49 53 88 179 102 94 169 96 37 140 48 146 40 125 141 45 129 11 19 175 43 144 184 5 10 7 2 8...
output:
693 693 693 694 649 653 644 645 645 643 644 642 643 642 643 643 639 644 644 643 644 641 642 642 642 640 648 645 646 646 646 647 631 649 649 646 647 643 644 640 641 640 641 641 640 651 651 652 652 665 665 658 708 708 708 710 708 709 706 707 707 708 692 697 697 690 691 691 690 692 688 691 691 689 690 ...
result:
ok single line: '693 693 693 694 649 653 644 64...34 840 839 838 836 836 836 837 '
Test #7:
score: 0
Accepted
time: 2ms
memory: 20340kb
input:
336 3 269 28 151 303 89 230 218 88 70 150 254 173 87 75 247 293 310 32 250 45 276 233 257 315 126 128 104 181 14 11 152 268 258 334 299 109 122 278 226 251 277 98 21 36 67 39 163 259 188 241 326 170 147 153 48 201 246 238 145 162 49 91 192 13 191 59 236 165 167 202 34 210 312 220 194 234 330 282 183...
output:
1475 1473 1474 1474 1463 1467 1465 1463 1462 1462 1462 1460 1464 1463 1463 1463 1466 1470 1487 1486 1487 1485 1487 1487 1480 1504 1503 1504 1501 1502 1502 1502 1503 1508 1367 1396 1396 1396 1388 1389 1389 1382 1380 1380 1380 1380 1381 1381 1384 1387 1387 1365 1379 1379 1378 1379 1379 1376 1367 1367 ...
result:
ok single line: '1475 1473 1474 1474 1463 1467 ... 1426 1449 1449 1448 1486 1486 '
Test #8:
score: 0
Accepted
time: 0ms
memory: 18356kb
input:
588 114 95 54 22 424 384 47 439 9 60 331 317 361 454 86 123 79 417 96 240 208 310 26 113 339 498 291 141 425 169 492 177 191 567 260 279 514 63 27 421 229 482 36 183 326 118 35 426 456 367 55 245 222 287 362 167 533 84 46 313 365 571 464 221 281 503 180 163 522 289 404 548 110 350 159 147 57 323 211...
output:
2271 2270 2269 2269 2268 2271 2271 2266 2273 2273 2273 2274 2274 2267 2280 2279 2280 2273 2275 2274 2275 2273 2275 2275 2276 2274 2298 2298 2297 2299 2297 2300 2300 2275 2308 2308 2298 2298 2298 2297 2299 2292 2295 2295 2295 2295 2295 2295 2293 2291 2291 2290 2291 2291 2292 2294 2290 2309 2309 2309 ...
result:
ok single line: '2271 2270 2269 2269 2268 2271 ... 3252 3252 3252 3250 3252 3252 '
Test #9:
score: 0
Accepted
time: 0ms
memory: 22464kb
input:
1029 97 622 1025 939 297 294 590 710 36 75 492 654 729 722 933 672 194 471 647 456 917 561 356 683 1027 650 873 723 911 986 508 680 384 390 530 179 823 512 884 130 266 343 715 517 524 398 905 855 670 6 354 952 581 16 302 958 60 52 519 810 927 712 258 96 336 185 363 120 999 779 587 61 478 286 614 845...
output:
5001 5001 4992 4980 4979 4979 4979 4977 4979 4979 4980 4981 4981 4986 4979 4979 4979 4979 4979 4980 4977 4981 4981 4981 4835 4859 4858 4859 4859 4831 4833 4830 4831 4831 4831 4832 4831 4836 4831 4835 4835 4836 4835 4836 4835 4836 4835 4842 4840 4840 4840 4839 4846 4846 4846 4842 4849 4849 4849 4851 ...
result:
ok single line: '5001 5001 4992 4980 4979 4979 ... 5271 5271 5270 5270 5270 5270 '
Test #10:
score: 0
Accepted
time: 3ms
memory: 22880kb
input:
1800 766 1174 1086 920 844 1508 1276 441 919 16 1053 1661 1742 1363 1 773 755 1636 84 521 1595 86 1506 724 1375 698 271 800 1696 472 15 1458 542 1662 1343 53 168 917 931 1660 257 19 1084 1684 1597 617 1553 270 1691 1443 1540 410 952 594 963 664 1657 1232 1429 253 1473 905 304 678 515 993 1357 998 18...
output:
9797 9796 9796 9795 9795 9792 9793 9793 9792 9793 9793 9795 9723 9733 9733 9732 9733 9729 9733 9733 9731 9732 9729 9730 9727 9727 9727 9727 9705 9717 9717 9716 9718 9711 9710 9710 9710 9711 9712 9710 9714 9714 9714 9714 9723 9723 9722 9723 9713 9723 9719 9720 9719 9720 9719 9721 9707 9713 9712 9713 ...
result:
ok single line: '9797 9796 9796 9795 9795 9792 ... 9476 9480 9477 9480 9479 9479 '
Test #11:
score: 0
Accepted
time: 5ms
memory: 22736kb
input:
3150 2016 1004 1533 2983 2188 426 737 2057 889 194 2681 613 2955 2104 333 689 2999 1485 1701 1761 29 2888 2328 2642 1585 2730 971 2355 1359 1350 2083 2347 434 2534 1629 2931 1776 969 1323 136 1721 1627 1425 277 3068 1390 614 2370 834 1407 2849 1751 928 292 1637 231 1636 2809 2433 462 1509 191 848 30...
output:
16472 16472 16472 16464 16464 16464 16464 16464 16464 16464 16463 16469 16467 16470 16470 16470 16452 16468 16468 16468 16469 16460 16462 16461 16462 16454 16456 16452 16452 16452 16452 16453 16455 16454 16460 16457 16468 16468 16467 16468 16467 16468 16467 16467 16459 16502 16502 16500 16502 16502 ...
result:
ok single line: '16472 16472 16472 16464 16464 ... 18151 18151 18152 18152 18185 '
Test #12:
score: 0
Accepted
time: 0ms
memory: 25120kb
input:
5512 5122 249 4482 37 1130 342 4012 2911 3534 5000 4910 5329 1780 4651 2673 2255 2130 66 1916 1854 3186 633 4080 2088 4802 3713 3806 2500 2800 4847 1789 5071 3476 2972 2785 3228 95 3989 178 4714 3450 4936 5212 2442 5276 1168 2688 2515 3009 4173 3218 3292 2090 2854 129 391 4120 609 4027 2703 680 1141...
output:
34679 34679 34674 34675 34674 34675 34673 34675 34675 34675 34682 34626 34637 34628 34628 34626 34624 34624 34623 34624 34623 34629 34628 34635 34632 34643 34641 34642 34642 34642 34650 34640 34642 34641 34641 34640 34642 34641 34646 34645 34650 34650 34652 34664 34634 34638 34637 34638 34638 34632 ...
result:
ok single line: '34679 34679 34674 34675 34674 ... 34878 34894 34893 34894 34894 '
Test #13:
score: 0
Accepted
time: 2ms
memory: 12048kb
input:
2 2 1
output:
1 1
result:
ok single line: '1 1 '
Test #14:
score: 0
Accepted
time: 4ms
memory: 25776kb
input:
9646 4083 1911 8250 7773 2595 5073 8165 8693 4036 236 4365 2065 7669 2442 3631 5796 5741 9047 1922 5503 7747 2031 4187 7895 3089 9381 3282 5635 7378 8720 7254 1678 3462 786 4569 7287 3388 5315 4446 9006 3062 3630 1182 7230 8481 7938 8114 1581 3290 4126 5330 2311 7929 227 1457 9607 7240 23 7008 8837 ...
output:
56216 56216 56212 56212 56212 56212 56213 56209 56215 56215 56214 56216 56213 56216 56216 56216 56217 56211 56228 56228 56227 56228 56228 56228 56231 56213 56238 56238 56239 56233 56230 56230 56229 56230 56230 56230 56235 56234 56235 56229 56239 56238 56239 56239 56235 56237 56230 56231 56231 56232 ...
result:
ok single line: '56216 56216 56212 56212 56212 ... 76814 76840 76840 76839 76841 '
Test #15:
score: 0
Accepted
time: 17ms
memory: 28924kb
input:
16880 2620 5517 15317 14624 3162 3872 16556 1032 12526 8373 5617 9938 2396 9520 5386 10125 14441 8334 3564 1734 14365 9674 4994 1584 8939 3039 9744 11195 1039 10794 14520 5616 7740 14885 2305 5122 2334 144 7635 14842 16058 225 8844 11893 10115 12681 7593 15281 10705 1275 11916 5855 10548 16245 3159 ...
output:
126395 126395 126394 126394 126394 126394 126346 126352 126345 126345 126345 126343 126345 126344 126345 126345 126340 126347 126346 126346 126338 126338 126337 126337 126336 126338 126338 126341 126345 126345 126344 126361 126361 126356 126371 126370 126370 126370 126370 126373 126368 126376 126376...
result:
ok single line: '126395 126395 126394 126394 12...78 109082 109095 109094 109095 '
Test #16:
score: 0
Accepted
time: 23ms
memory: 31532kb
input:
29540 21660 2028 12964 6138 24030 20445 10053 17204 20432 863 17996 13607 10819 11136 15689 9902 14559 17935 13982 16518 26375 3516 18377 15190 11520 18426 14397 21421 27432 13490 24097 2332 5574 1451 24688 28254 18558 25985 26192 29067 10134 15556 10078 11734 29033 18604 19513 12836 5044 24817 2381...
output:
225212 225212 225211 225212 225209 225209 225209 225209 225203 225204 225196 225195 225195 225195 225194 225197 225197 225196 225200 225200 225194 225214 225213 225213 225213 225212 225215 225215 225213 225241 225239 225240 225239 225240 225240 225241 225276 225276 225277 225271 225310 225308 225309...
result:
ok single line: '225212 225212 225211 225212 22...47 221047 221048 221048 221050 '
Test #17:
score: 0
Accepted
time: 35ms
memory: 38212kb
input:
51695 25757 46390 46936 35417 38407 50322 34131 45113 48067 40556 43162 38421 18517 22542 34293 39180 16755 38132 44939 5760 21027 4643 41258 22179 40253 14694 6659 18296 47470 19801 7302 45675 31360 9788 33220 33106 26159 28585 35811 13400 37315 18401 23221 22583 7530 47246 38366 49277 25080 50788 ...
output:
391066 391066 391065 391067 391067 391026 391031 391031 391002 391003 390997 390995 390995 390995 390996 390995 390999 390999 390995 391003 391002 391003 391000 391002 390999 390999 390999 390999 390984 390997 390997 390987 390988 390988 390986 390986 390986 390986 390986 390991 390989 390994 390993...
result:
ok single line: '391066 391066 391065 391067 39...84 498084 498083 498085 498085 '
Test #18:
score: 0
Accepted
time: 69ms
memory: 48208kb
input:
90466 29089 23465 25716 3629 50971 22470 48859 55467 72802 49276 70808 9377 69724 57726 69918 26033 4604 66193 155 79747 19849 11388 29639 38214 81901 33586 81767 22269 67108 89312 72587 12737 81405 36261 54036 73876 61084 5386 22093 90119 79588 64897 89069 64078 7067 80737 39378 39754 62061 17827 7...
output:
807940 807940 807939 807940 807938 807942 807942 807943 807946 807954 807949 807950 807949 807950 807947 807948 807948 807947 807949 807945 807963 807963 807963 807965 807964 807988 807986 807987 807987 807983 808011 808011 808008 808010 808010 808009 808008 808008 808008 807132 807170 807170 807094...
result:
ok single line: '807940 807940 807939 807940 80...89 689088 689090 689089 689092 '
Test #19:
score: 0
Accepted
time: 119ms
memory: 58668kb
input:
158315 62178 4434 123737 96786 81926 3922 34992 97731 98678 147622 91816 40832 48627 43111 90353 147554 16042 123199 84597 32319 94149 110323 30035 147659 145023 23971 17026 6722 23884 118418 92184 83560 150010 152570 45000 10337 53681 15818 105963 68507 62496 49670 48658 115914 86541 31751 49111 13...
output:
1277042 1277042 1277036 1277036 1277034 1277034 1277034 1277035 1277039 1277036 1277041 1277041 1277040 1277041 1277041 1277038 1277043 1277039 1277039 1277039 1277039 1277040 1277042 1277039 1277057 1277054 1277053 1277053 1277053 1277054 1277057 1277057 1277057 1277064 1277096 1277096 1277095 1277...
result:
ok single line: '1277042 1277042 1277036 127703...324395 1324393 1324395 1324395 '
Test #20:
score: 0
Accepted
time: 271ms
memory: 81824kb
input:
277051 132642 165514 158003 120016 153522 201662 226711 268617 145665 30979 192592 61026 240472 67380 68422 221783 201493 127374 264150 144250 18261 238987 40974 134787 244832 276228 98112 50224 206799 16649 247375 107624 213918 187954 34950 36807 255977 143136 97230 259959 247959 183983 78607 19162...
output:
2629197 2629195 2629194 2629194 2629194 2629195 2629200 2629191 2629197 2629197 2629196 2629198 2629195 2629198 2629198 2629198 2629198 2629198 2629192 2629198 2629198 2629196 2629198 2629198 2629199 2628422 2628446 2628446 2628445 2628447 2628445 2628448 2628446 2628445 2628445 2628445 2628445 2628...
result:
ok single line: '2629197 2629195 2629194 262919...279650 2279650 2279651 2279651 '
Test #21:
score: 0
Accepted
time: 257ms
memory: 79124kb
input:
262142 170465 225058 248463 155214 235457 208686 37676 172736 204107 181502 161769 171326 90738 123185 45301 109851 85505 229991 70616 250517 248629 171505 11331 90670 135216 250761 236384 141122 138348 108406 192420 74275 215952 113433 146716 115791 160655 178073 138620 184624 257945 206781 207559 ...
output:
2276751 2276751 2276747 2276749 2276736 2276734 2276734 2276734 2276733 2276731 2276731 2276728 2276729 2276727 2276728 2276727 2276728 2276727 2276739 2276738 2276754 2276751 2276751 2276751 2276752 2276748 2276762 2276761 2276760 2276760 2276759 2276762 2276755 2276759 2276758 2276759 2276759 2276...
result:
ok single line: '2276751 2276751 2276747 227674...369712 2369714 2369715 2369716 '
Test #22:
score: 0
Accepted
time: 253ms
memory: 78768kb
input:
262143 104690 24534 218732 138014 100511 185497 214245 5776 216429 169892 27467 176352 2259 215862 201935 4122 199348 66381 221330 249611 95524 167976 248902 109967 101818 202850 31715 139528 26578 224649 223222 235766 4443 156237 229678 41057 140361 110 111176 55338 177637 234749 64915 60304 104561...
output:
2198605 2198605 2198596 2198597 2198597 2198597 2198598 2198600 2198595 2198596 2198596 2198595 2198597 2198595 2198596 2198596 2198595 2198596 2198596 2198604 2198623 2198623 2198609 2198609 2198609 2198607 2198609 2198608 2198609 2198608 2198613 2198602 2198606 2198606 2198601 2198602 2198600 2198...
result:
ok single line: '2198605 2198605 2198596 219859...418295 2418295 2418296 2418302 '
Test #23:
score: 0
Accepted
time: 251ms
memory: 81256kb
input:
262144 214478 58333 173353 144219 144132 109974 63097 90872 34077 11764 139960 110695 198098 247191 49838 91097 195596 234166 23774 82368 198358 71750 201949 160648 129902 84496 86828 87893 84925 104692 63510 149545 31853 213266 97983 261204 134167 1134 182062 191913 46997 208182 136097 261055 13809...
output:
2138945 2138945 2138944 2138942 2138936 2138934 2138934 2138933 2138933 2138933 2138932 2138937 2138937 2138938 2138951 2138951 2138952 2138937 2138938 2138938 2138938 2138939 2138934 2138928 2138923 2138923 2138923 2138923 2138924 2138923 2138925 2138924 2138931 2138930 2138942 2138921 2138955 2138...
result:
ok single line: '2138945 2138945 2138944 213894...189651 2189655 2189654 2189655 '
Test #24:
score: 0
Accepted
time: 1ms
memory: 12296kb
input:
3 1 2 3
output:
2 2 3
result:
ok single line: '2 2 3 '
Test #25:
score: 0
Accepted
time: 225ms
memory: 79548kb
input:
262145 137633 85042 78668 86888 164296 78818 99660 17023 138296 91902 105221 155594 20867 233386 178776 125453 34246 199388 14125 39335 69217 114560 123725 239648 170713 115499 199125 78683 131215 202159 157626 142536 231410 217134 236637 205948 241634 136331 200931 6891 156420 142217 131866 7713 52...
output:
2305742 2305741 2305741 2305741 2305736 2305740 2305739 2305740 2305738 2305740 2305740 2305740 2305744 2305736 2305748 2305747 2305747 2305742 2305745 2305745 2305746 2305747 2305748 2305738 2305760 2305760 2305758 2305760 2305760 2305760 2305763 2305763 2305762 2305766 2305765 2305769 2305758 2305...
result:
ok single line: '2305742 2305741 2305741 230574...379701 2379701 2379702 2379705 '
Test #26:
score: 0
Accepted
time: 222ms
memory: 81072kb
input:
262146 95481 247989 115902 154711 248737 186448 219360 126937 88912 176372 2585 128596 246976 112951 24632 206233 86616 13659 143536 66605 34933 52511 23503 199359 2880 57690 106624 8847 134687 215953 157186 116177 103855 152864 28824 132268 217119 83956 259046 113758 65655 93493 205000 176629 19493...
output:
2121755 2121753 2121754 2121754 2121730 2121734 2121730 2121730 2121730 2121728 2121730 2121730 2121707 2121712 2121712 2121701 2121702 2121702 2121700 2121700 2121700 2121699 2121700 2121695 2121701 2121701 2121701 2121702 2121702 2121702 2121713 2121712 2121712 2121710 2121712 2121712 2121712 2121...
result:
ok single line: '2121755 2121753 2121754 212175...411207 2411207 2411206 2411211 '
Test #27:
score: 0
Accepted
time: 256ms
memory: 84960kb
input:
299997 110211 290304 52567 198511 245392 79155 82217 279881 18934 203294 18871 20938 137230 160056 84518 55725 296273 94773 50586 275945 171481 249827 252924 163275 206989 58868 199567 71622 243840 190814 174920 106404 295338 277115 69484 270150 173661 120412 168097 12268 297280 200375 274813 49868 ...
output:
2752164 2752157 2752158 2752158 2752157 2752158 2752158 2752154 2752157 2752153 2752154 2752154 2752155 2752155 2752155 2752155 2752139 2752154 2752154 2752148 2752150 2752150 2752145 2752146 2752144 2752145 2752144 2752145 2752144 2752147 2752146 2752146 2752144 2752156 2752156 2752154 2752153 2752...
result:
ok single line: '2752164 2752157 2752158 275215...575943 2575943 2575944 2575948 '
Test #28:
score: 0
Accepted
time: 258ms
memory: 86444kb
input:
299998 240166 183171 165015 193616 65824 209177 42607 88749 4592 296562 272668 179523 255687 30360 269077 76531 167248 9030 281782 134643 201939 129347 40381 173669 80180 142144 37965 276710 122758 262376 132933 190340 161526 100139 109633 62702 34801 295282 34467 160410 162383 183881 58257 98179 70...
output:
2685242 2685241 2685241 2685240 2685242 2685240 2685243 2685242 2685243 2685202 2685206 2685206 2685205 2685206 2685204 2685206 2685205 2685206 2685196 2685204 2685200 2685200 2685200 2685198 2685200 2685199 2685200 2685197 2685204 2685202 2685203 2685201 2685200 2685200 2685199 2685199 2685199 2685...
result:
ok single line: '2685242 2685241 2685241 268524...777189 2777187 2777235 2777235 '
Test #29:
score: 0
Accepted
time: 315ms
memory: 85640kb
input:
299999 105930 212862 21071 157050 113702 184087 124574 231608 38277 25763 10690 19888 214129 181674 171613 45263 141098 231952 172852 251745 261985 141691 227700 53264 96105 48865 268621 155281 161558 288366 61371 280278 130126 273509 111673 245641 50661 130042 9204 266706 245914 238704 10493 1506 1...
output:
2499235 2499231 2499232 2499231 2499232 2499231 2499233 2499228 2499233 2499231 2499231 2499231 2499231 2499233 2499231 2499231 2499231 2499231 2499248 2499248 2499264 2499284 2499282 2499283 2499282 2499283 2499281 2499307 2499307 2499301 2499330 2499316 2499317 2499311 2499312 2499310 2499311 2499...
result:
ok single line: '2499235 2499231 2499232 249923...822032 2822032 2822032 2822032 '
Test #30:
score: 0
Accepted
time: 269ms
memory: 86196kb
input:
300000 163822 58989 16780 215522 20501 12024 236573 262652 178873 123608 194105 120608 172509 183878 42132 146797 116759 156880 20102 144103 213635 195920 182228 53103 146480 238295 262599 48890 211538 298143 271113 182177 37283 184583 218820 73054 179455 196972 111684 112927 64407 230534 17226 1417...
output:
2600523 2600522 2600522 2600521 2600523 2600523 2600523 2600509 2600515 2600515 2600510 2600512 2600512 2600508 2600509 2600508 2600509 2600507 2600509 2600509 2600509 2600518 2600516 2600516 2600516 2600517 2600527 2600532 2600532 2600498 2600513 2600512 2600512 2600512 2600510 2600512 2600512 2600...
result:
ok single line: '2600523 2600522 2600522 260052...632471 2632471 2632471 2632502 '
Test #31:
score: 0
Accepted
time: 79ms
memory: 81004kb
input:
300000 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 1...
output:
299999 299999 300000 300002 300005 300009 300014 300020 300027 300035 300044 300054 300065 300077 300090 300104 300119 300135 300152 300170 300189 300209 300230 300252 300275 300299 300324 300350 300377 300405 300434 300464 300495 300527 300560 300594 300629 300665 300702 300740 300779 300819 300860...
result:
ok single line: '299999 299999 300000 300002 30...250005 44999550002 44999850000 '
Test #32:
score: 0
Accepted
time: 62ms
memory: 82164kb
input:
300000 300000 299999 299998 299997 299996 299995 299994 299993 299992 299991 299990 299989 299988 299987 299986 299985 299984 299983 299982 299981 299980 299979 299978 299977 299976 299975 299974 299973 299972 299971 299970 299969 299968 299967 299966 299965 299964 299963 299962 299961 299960 299959...
output:
44999850000 44999550002 44999250005 44998950009 44998650014 44998350020 44998050027 44997750035 44997450044 44997150054 44996850065 44996550077 44996250090 44995950104 44995650119 44995350135 44995050152 44994750170 44994450189 44994150209 44993850230 44993550252 44993250275 44992950299 44992650324 ...
result:
ok single line: '44999850000 44999550002 449992...05 300002 300000 299999 299999 '
Test #33:
score: 0
Accepted
time: 261ms
memory: 99536kb
input:
300000 300000 299997 299993 299991 299990 299989 299988 299986 299985 299983 299982 299977 299975 299974 299973 299971 299969 299967 299966 299965 299964 299962 299961 299960 299956 299955 299954 299950 299949 299945 299944 299940 299931 299928 299927 299925 299919 299917 299915 299913 299912 299910...
output:
14984302490 14984002494 14983702502 14983702501 14983702500 14983702498 14983402511 14983402509 14983102525 14982802544 14982502563 14982202587 14982202586 14982202582 14981902610 14981602640 14981302672 14981302671 14981302670 14981302668 14981002705 14981002704 14980702745 14980402786 14980402785 ...
result:
ok single line: '14984302490 14984002494 149837...302488 14984302489 14984602486 '
Test #34:
score: -100
Time Limit Exceeded
input:
300000 299999 300000 299993 299997 299992 299990 299985 299987 299980 299979 299981 299977 299973 299972 299978 299971 299966 299970 299965 299964 299963 299960 299959 299957 299954 299958 299951 299948 299947 299942 299943 299941 299936 299938 299934 299935 299932 299928 299926 299933 299924 299922...