QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#879268 | #9973. 魔法少女网站第二部 | zlt | AC ✓ | 2239ms | 230276kb | C++14 | 8.4kb | 2025-02-01 23:07:02 | 2025-02-01 23:07:07 |
Judging History
answer
// Problem: P11367 [Ynoi2024] 魔法少女网站第二部
// Contest: Luogu
// URL: https://www.luogu.com.cn/problem/P11367
// Memory Limit: 512 MB
// Time Limit: 3000 ms
//
// Powered by CP Editor (https://cpeditor.org)
#include <bits/stdc++.h>
#define pb emplace_back
#define fst first
#define scd second
#define mkp make_pair
#define uint unsigned
#define mems(a, x) memset((a), (x), sizeof(a))
using namespace std;
typedef long long ll;
typedef double db;
typedef unsigned long long ull;
typedef long double ldb;
typedef pair<int, int> pii;
namespace IO {
const int maxn = 1 << 20;
char ibuf[maxn], *iS, *iT, obuf[maxn], *oS = obuf;
inline char gc() {
return (iS == iT ? iT = (iS = ibuf) + fread(ibuf, 1, maxn, stdin), (iS == iT ? EOF : *iS++) : *iS++);
}
template<typename T = int>
inline T read() {
char c = gc();
T x = 0;
bool f = 0;
while (c < '0' || c > '9') {
f |= (c == '-');
c = gc();
}
while (c >= '0' && c <= '9') {
x = (x << 1) + (x << 3) + (c ^ 48);
c = gc();
}
return f ? ~(x - 1) : x;
}
inline void flush() {
fwrite(obuf, 1, oS - obuf, stdout);
oS = obuf;
}
struct Flusher {
~Flusher() {
flush();
}
} AutoFlush;
inline void pc(char ch) {
if (oS == obuf + maxn) {
flush();
}
*oS++ = ch;
}
template<typename T>
inline void write(T x) {
static char stk[64], *tp = stk;
if (x < 0) {
x = ~(x - 1);
pc('-');
}
do {
*tp++ = x % 10;
x /= 10;
} while (x);
while (tp != stk) {
pc((*--tp) | 48);
}
}
template<typename T>
inline void writesp(T x) {
write(x);
pc(' ');
}
template<typename T>
inline void writeln(T x) {
write(x);
pc('\n');
}
}
using IO::read;
using IO::write;
using IO::pc;
using IO::writesp;
using IO::writeln;
const int maxn = 2000100;
const int inf = 0x3f3f3f3f;
int n, m, a[maxn], b[maxn], d[maxn], f[maxn], g[maxn], pre[maxn], suf[maxn];
pii p[maxn], q[maxn], h[maxn];
struct node {
int l, r;
} c[maxn];
ll ans[maxn];
struct List {
int hd[maxn * 3], len, val[maxn << 1], nxt[maxn << 1];
inline void add(int x, int y) {
val[++len] = y;
nxt[len] = hd[x];
hd[x] = len;
}
} G, T;
namespace BIT {
int n;
ll c[maxn];
inline void init(int _n) {
n = _n;
for (int i = 0; i <= n; ++i) {
c[i] = 0;
}
}
inline void update(int x, int d) {
if (!d) {
return;
}
for (int i = x; i <= n; i += (i & (-i))) {
c[i] += d;
}
}
inline ll query(int x) {
ll res = 0;
for (int i = x; i; i -= (i & (-i))) {
res += c[i];
}
return res;
}
inline ll query(int l, int r) {
return query(r) - query(l - 1);
}
}
int fa[maxn], e[maxn];
bool vis[maxn * 3];
inline int find(int x) {
while (fa[x] != x) {
x = fa[x] = fa[fa[x]];
}
return x;
}
void update(int rt, int l, int r, int ql, int qr, int i) {
vis[rt] = 1;
int mid = (l + r) >> 1;
if (qr <= mid) {
update(rt << 1, l, mid, ql, qr, i);
} else if (ql > mid) {
update(rt << 1 | 1, mid + 1, r, ql, qr, i);
} else {
T.add(rt, i);
}
}
void dfs(int rt, int l, int r) {
if (l == r) {
return;
}
int mid = (l + r) >> 1, tot = r - l + 1;
dfs(rt << 1, l, mid);
dfs(rt << 1 | 1, mid + 1, r);
inplace_merge(p + l, p + mid + 1, p + r + 1);
if (!vis[rt]) {
return;
}
G.len = 0;
for (int i = l; i <= r; ++i) {
G.hd[i] = 0;
}
for (int i = l; i <= r; ++i) {
d[p[i].scd] = i - l + 1;
}
for (int i = l; i <= r; ++i) {
b[d[i]] = i;
}
if (r - l + 1 <= 50) {
for (int i = T.hd[rt]; i; i = T.nxt[i]) {
int j = T.val[i];
int L = c[j].l, R = c[j].r, lst = 0;
for (int k = 1; k <= tot; ++k) {
if (L <= b[k] && b[k] <= R) {
if (lst) {
ans[j] += abs(b[k] - lst);
}
lst = b[k];
}
}
}
return;
}
for (int i = T.hd[rt]; i; i = T.nxt[i]) {
int j = T.val[i];
G.add(c[j].l, j);
G.add(c[j].r, j);
}
ll s = 0;
int mn = inf, mx = 0;
int lst0 = 0, lst1 = 0, mx0 = 0, mn1 = inf;
for (int i = 1; i <= tot; ++i) {
if (b[i] <= mid) {
if (lst0) {
f[b[lst0]] = mn1;
}
mn1 = inf;
lst0 = i;
mx0 = max(mx0, b[i]);
} else {
if (lst1) {
g[b[lst1]] = mx0;
}
mx0 = 0;
lst1 = i;
mn1 = min(mn1, b[i]);
}
}
f[b[lst0]] = inf;
g[b[lst1]] = 0;
for (int i = 1; i <= tot; ++i) {
if (b[i] <= mid) {
fa[i] = e[i] = i;
} else {
fa[i] = fa[i - 1];
e[fa[i]] = i;
}
}
fa[0] = e[0] = 0;
for (int i = l; i <= mid; ++i) {
q[i].scd = e[d[i]] + 1;
int t = find(d[i] - 1);
fa[d[i]] = q[i].fst = t;
h[i].scd = f[i];
e[t] = e[d[i]];
if (t) {
t = b[t];
h[i].fst = f[t];
f[t] = min(f[t], f[i]);
}
}
pre[0] = suf[tot + 1] = inf;
for (int i = 1; i <= tot; ++i) {
pre[i] = min(pre[i - 1], b[i] > mid ? b[i] : inf);
}
for (int i = tot; i; --i) {
suf[i] = min(suf[i + 1], b[i] > mid ? b[i] : inf);
}
BIT::init(r - mid);
for (int i = mid; i >= l; --i) {
mn = min(mn, d[i]);
mx = max(mx, d[i]);
int j = q[i].fst, k = q[i].scd;
if (j) {
s += abs(i - b[j]);
}
if (k <= tot) {
s += abs(i - b[k]);
}
if (j && k <= tot) {
s -= abs(b[j] - b[k]);
if (h[i].fst < h[i].scd) {
if (h[i].fst <= r) {
BIT::update(h[i].fst - mid, (mid - max(i, b[j])) * 2 - (mid - max(b[j], b[k])) * 2);
}
if (h[i].scd <= r) {
BIT::update(h[i].scd - mid, (mid - max(i, b[k])) * 2);
}
} else {
if (h[i].fst <= r) {
BIT::update(h[i].fst - mid, (mid - max(i, b[j])) * 2);
}
if (h[i].scd <= r) {
BIT::update(h[i].scd - mid, (mid - max(i, b[k])) * 2 - (mid - max(b[j], b[k])) * 2);
}
}
} else if (!j && k <= tot && h[i].scd <= r) {
BIT::update(h[i].scd - mid, (mid - max(i, b[k])) * 2);
} else if (j && k > tot && h[i].fst <= r) {
BIT::update(h[i].fst - mid, (mid - max(i, b[j])) * 2);
}
for (int _ = G.hd[i]; _; _ = G.nxt[_]) {
int j = G.val[_];
ans[j] += s + BIT::query(c[j].r - mid);
if (suf[mx + 1] <= c[j].r) {
ans[j] += mid - b[mx];
}
if (pre[mn - 1] <= c[j].r) {
ans[j] += mid - b[mn];
}
}
}
s = mx = 0;
mn = inf;
for (int i = 1; i <= tot; ++i) {
if (b[i] > mid) {
fa[i] = e[i] = i;
} else {
fa[i] = fa[i - 1];
e[fa[i]] = i;
}
}
fa[0] = 0;
for (int i = r; i > mid; --i) {
q[i].scd = e[d[i]] + 1;
int t = find(d[i] - 1);
fa[d[i]] = q[i].fst = t;
h[i].scd = g[i];
e[t] = e[d[i]];
if (t) {
t = b[t];
h[i].fst = g[t];
g[t] = max(g[t], g[i]);
}
}
pre[0] = suf[tot + 1] = 0;
for (int i = 1; i <= tot; ++i) {
pre[i] = max(pre[i - 1], b[i] <= mid ? b[i] : 0);
}
for (int i = tot; i; --i) {
suf[i] = max(suf[i + 1], b[i] <= mid ? b[i] : 0);
}
BIT::init(mid - l + 1);
for (int i = mid + 1; i <= r; ++i) {
mn = min(mn, d[i]);
mx = max(mx, d[i]);
int j = q[i].fst, k = q[i].scd;
if (j) {
s += abs(i - b[j]);
}
if (k <= tot) {
s += abs(i - b[k]);
}
if (j && k <= tot) {
s -= abs(b[j] - b[k]);
if (h[i].fst > h[i].scd) {
if (h[i].fst >= l) {
BIT::update(h[i].fst - l + 1, (min(i, b[j]) - mid) * 2 - (min(b[j], b[k]) - mid) * 2);
}
if (h[i].scd >= l) {
BIT::update(h[i].scd - l + 1, (min(i, b[k]) - mid) * 2);
}
} else {
if (h[i].fst >= l) {
BIT::update(h[i].fst - l + 1, (min(i, b[j]) - mid) * 2);
}
if (h[i].scd >= l) {
BIT::update(h[i].scd - l + 1, (min(i, b[k]) - mid) * 2 - (min(b[j], b[k]) - mid) * 2);
}
}
} else if (!j && k <= tot && h[i].scd >= l) {
BIT::update(h[i].scd - l + 1, (min(i, b[k]) - mid) * 2);
} else if (j && k > tot && h[i].fst >= l) {
BIT::update(h[i].fst - l + 1, (min(i, b[j]) - mid) * 2);
}
for (int _ = G.hd[i]; _; _ = G.nxt[_]) {
int j = G.val[_];
ans[j] += s + BIT::query(c[j].l - l + 1, mid - l + 1);
if (suf[mx + 1] >= c[j].l) {
ans[j] += b[mx] - mid;
}
if (pre[mn - 1] >= c[j].l) {
ans[j] += b[mn] - mid;
}
}
}
}
void solve() {
n = read();
m = read();
for (int i = 1; i <= n; ++i) {
a[i] = read();
p[i] = pii(a[i], i);
}
for (int i = 1; i <= m; ++i) {
c[i].l = read();
c[i].r = read();
if (c[i].l != c[i].r) {
update(1, 1, n, c[i].l, c[i].r, i);
}
}
dfs(1, 1, n);
for (int i = 1; i <= m; ++i) {
writeln(ans[i]);
}
}
int main() {
int T = 1;
// scanf("%d", &T);
while (T--) {
solve();
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 1465ms
memory: 218596kb
input:
1999999 1999998 8 9 6 4 1 7 5 13 3 16 2 20 14 10 12 17 21 11 27 29 19 23 15 18 24 26 22 31 28 37 36 25 38 41 34 43 35 30 33 45 51 32 52 42 50 44 39 40 58 56 48 49 46 59 47 63 60 57 54 55 66 53 65 62 67 61 72 75 68 69 71 79 77 64 85 82 74 73 70 87 76 81 78 88 91 90 84 97 80 89 93 99 83 98 96 86 95 10...
output:
918614 3322452 5149417 6621380 6533731 4094511 1379510 12924019 8157295 207612 6762916 1785007 4192984 2683252 8261655 6023203 9129238 1758632 6933498 3993947 4345067 11514930 5784142 3105482 8690594 6483330 5398139 146567 1726131 678045 7787022 2468410 8925300 2915763 2410040 1092694 568436 3475699...
result:
ok 1999998 numbers
Test #2:
score: 0
Accepted
time: 1459ms
memory: 215112kb
input:
2000000 2000000 1 5 10 6 7 2 16 13 3 8 15 12 4 14 17 11 9 22 20 27 30 24 21 28 18 19 25 35 33 29 23 26 43 41 44 39 32 34 31 36 40 42 45 37 48 54 38 46 59 47 52 62 63 49 50 51 58 56 64 53 60 57 61 66 55 65 77 69 75 70 67 76 80 72 74 85 68 71 89 73 79 78 83 90 86 81 96 94 82 97 93 84 98 100 99 88 87 9...
output:
313920 6698345 2961193 3760894 1903023 549714 5500986 1427297 168364 7880151 7786970 4914863 8011527 5473090 10758103 3603965 1922957 7492511 6241425 8034137 3953170 4224180 10918550 8192854 10607899 564778 493566 2426821 12903222 1008307 1113749 5046569 2226134 403996 4119770 874567 2775979 3062657...
result:
ok 2000000 numbers
Test #3:
score: 0
Accepted
time: 464ms
memory: 117664kb
input:
1997 1993006 687 310 1393 747 1050 349 1814 1842 638 1694 321 1613 1034 1724 1579 1292 1761 1387 1213 463 1884 1882 835 316 1722 8 1743 473 978 1274 403 1617 1711 156 1227 40 1858 851 1625 1787 1779 1289 472 1103 1739 1563 507 1384 1804 1079 199 347 1462 1891 198 583 1112 1399 940 1958 1830 318 1312...
output:
1240830 1253194 1124612 1178272 1124252 1207336 1222464 1067970 1182422 1294456 1081384 1134164 1028222 1303360 1176576 1333256 1217496 1184112 826586 1321466 907642 1200660 1338438 1037922 1150322 1107906 1225848 947268 763606 1312232 1092234 1048136 1276728 1282240 1320450 826070 1150624 1089414 1...
result:
ok 1993006 numbers
Test #4:
score: 0
Accepted
time: 417ms
memory: 107656kb
input:
2000 1999000 7 8 1120 3 2 6 1 5 1118 4 15 1119 14 16 18 17 19 12 10 13 11 9 1125 1126 1124 1128 653 1127 1121 1123 1122 1137 1136 620 1130 1129 598 661 599 1160 654 656 655 608 1159 1157 1158 1153 657 1154 585 1155 584 658 588 586 587 1156 609 1133 1132 621 1131 611 597 660 596 1134 595 659 610 1135...
output:
21604 8101 19995 14882 8432 877 5904 13612 1227 3406 25246 19909 10398 3746 992 6920 7365 3098 9999 12602 13469 5809 9235 5502 18869 2545 20293 9800 9162 22085 629 17750 9312 6800 3584 5285 1665 18997 8614 910 8170 3884 2539 16147 4482 6615 4589 56 14542 5125 2243 8915 11027 17562 901 13603 15113 35...
result:
ok 1999000 numbers
Test #5:
score: 0
Accepted
time: 2221ms
memory: 220024kb
input:
1999998 1999996 1950413 1996247 1995151 1968122 1967590 1953664 1990263 1993028 1840495 1948577 1937627 1996103 1985373 1990286 1941726 1980603 1911368 1997777 1980827 1911708 1857169 1908738 1988483 1981228 1964408 1973964 1988108 1997405 1974863 1955238 1931220 1956903 1979158 1973709 1994885 1927...
output:
23360918224 17249116985 137365596 7383633917 344733205 13693676447 45751450613 41799074078 18749658821 8191544190 21313767745 10345260569 28616032820 24769453037 13508471201 11284312607 46246584 39927786203 32769454327 29036442020 4659551922 13004993101 14277007260 14959218808 41953497036 1454775489...
result:
ok 1999996 numbers
Test #6:
score: 0
Accepted
time: 1491ms
memory: 214916kb
input:
2000000 2000000 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...
output:
562213112 94551420 262159799 602091491 72695579 360317862 329807355 140956386 151337533 659115214 400318102 186031488 207523349 57392693 222407249 352720579 242142491 407723070 20117481 192919246 19846194 71898155 269685332 484339831 112403213 205534120 330882290 437608076 490767271 181662191 455826...
result:
ok 2000000 numbers
Test #7:
score: 0
Accepted
time: 1287ms
memory: 228280kb
input:
2000000 2000000 1995252 1948611 1973950 1976206 1955844 1955912 1996169 1996972 1954774 1996640 1996968 1982313 1990998 1989028 1996551 1997076 1975971 1984519 1968527 1992793 1966604 1996348 1975495 1984452 1987961 1892158 1984326 1989766 1982452 1899841 1992812 1974021 1966972 1907205 1984423 1952...
output:
99198920232 110545019536 36176871359 79529492756 74201219262 73151236992 51014287398 60618273245 53981621748 66773422886 81712780914 74653436956 102721856454 58071021899 56510885872 60061184092 57578487582 83000507008 59640113133 61871930929 74642738564 54032804049 54894094476 31473453995 4718329256...
result:
ok 2000000 numbers
Test #8:
score: 0
Accepted
time: 1467ms
memory: 220024kb
input:
2000000 2000000 2 1 3 7 4 8 2003 764 765 1032 5 769 767 768 766 1037 1036 1034 1035 1033 6 1028 1030 1031 1029 1027 1026 1015 1021 1022 1023 1016 1024 1025 1017 1018 1019 1020 1013 1014 1011 1012 1010 1009 1008 1007 1005 1006 770 771 773 772 774 686 1038 2029 2030 1056 1057 2027 2028 1039 1040 1042 ...
output:
173888 1306856 16467650 5397437 22072736 23788517 1496488 25224093 27624594 32980700 3875395 26560832 6219638 46020178 34863664 9338841 45376438 1574336 22195868 26577385 61316913 9801600 4080597 53217149 8489025 23869293 16335283 30679698 40485034 464955 26084028 1860488 5215924 4767111 43673987 29...
result:
ok 2000000 numbers
Test #9:
score: 0
Accepted
time: 2227ms
memory: 220192kb
input:
1999999 1999999 1999229 1983788 1985038 1921593 1990549 1933372 1995866 1939374 1975680 1978926 1888723 1997207 1959374 1939635 1977884 1959376 1982397 1988493 1904974 1978350 1981682 1950026 1997268 1946338 1993309 1979525 1987557 1878825 1935649 1996862 1929559 1992596 1985390 1921751 1996826 1974...
output:
4925894357 4896310942 774067296 31352634339 83808980 9955732285 12782716001 3912253669 51737997080 17520780254 44627725396 7677895984 14127220676 46595914491 15172014314 12967705758 28691964079 11189785689 50575875372 28536846803 57726352901 35971953715 32451290008 14607111719 15490945147 3264818983...
result:
ok 1999999 numbers
Test #10:
score: 0
Accepted
time: 1468ms
memory: 216772kb
input:
2000000 2000000 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...
output:
18486785 565994488 357992305 324290811 173749872 463288805 327577422 348086484 382579220 132150404 329503732 299633065 23601040 338483775 285797634 40510902 39916011 123112783 61069626 353545436 496348490 679019350 578471236 12746729 322699026 279954358 512489583 494866785 510234978 498991930 367631...
result:
ok 2000000 numbers
Test #11:
score: 0
Accepted
time: 1268ms
memory: 230276kb
input:
2000000 2000000 1976597 1982586 1949576 1932500 1991588 1979675 1903615 1964510 1977449 1993833 1985612 1952946 1980283 1931403 1968748 1977616 1965770 1968991 1955128 1975310 1985203 1953011 1929540 1984740 1992529 1979818 1976250 1974369 1930952 1988564 1889358 1929981 1980760 1975492 1973914 1996...
output:
62299960731 62457645503 108427988855 59730232235 61644581297 37439022602 97940896099 62590089573 95266076479 57244355411 63088847191 47897640566 51213318265 54839923338 62076710864 91643872593 98540780131 66382670525 62106352732 58239266348 57116604803 56281320295 42276085370 89686477933 12628163112...
result:
ok 2000000 numbers
Test #12:
score: 0
Accepted
time: 1474ms
memory: 219884kb
input:
2000000 2000000 1 2 1020 1021 1019 1024 1023 1022 993 994 995 5 4 1018 3 6 989 990 991 1017 992 1015 1014 1016 1013 1012 1009 1010 1008 1011 1007 1027 1026 1000 998 999 1006 1041 1003 1004 1001 997 1005 1025 996 1040 1002 1039 1037 1038 1035 1036 1034 1033 1032 1043 1042 1030 1028 1029 1031 1044 104...
output:
7362728 5901851 43317555 19913544 19158826 51177396 15817696 31399369 6217588 5971688 24194317 39987170 13654960 1278489 9526214 114723 4028623 29715971 31541650 26253442 19909987 13205284 37297254 7683306 34111013 19735919 6127455 6669085 6945638 8848212 9909547 681390 13369163 1256514 22914947 909...
result:
ok 2000000 numbers
Test #13:
score: 0
Accepted
time: 2216ms
memory: 216860kb
input:
1999995 1999999 1936672 1989379 1948029 1990284 1927017 1959739 1997853 1982539 1998959 1974358 1970662 1985295 1982329 1999460 1978155 1997271 1914440 1995945 1996049 1943549 1959542 1950745 1938170 1993031 1992055 1975631 1999390 1999725 1957124 1790325 1866296 1877061 1967550 1944444 1971649 1931...
output:
35950651968 15924280206 42560578945 56813065924 828293122 36481242286 4296141409 14816241029 7826560732 24863886042 39058274006 24216148824 32938674327 32974013597 17817317819 14449840802 44646413604 31266557373 412196878 1686996435 24635693163 609912483 640339072 9421101993 15005673887 14390637036 ...
result:
ok 1999999 numbers
Test #14:
score: 0
Accepted
time: 1477ms
memory: 219212kb
input:
2000000 2000000 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...
output:
48541636 77165175 43499632 454850613 350417271 581991501 435961193 36884013 475126189 137184640 28994774 427929603 122228682 704946051 332053374 25786932 14949071 278752602 200794985 519246142 475365027 61754800 241527349 17618230 460000052 84365204 439852872 764605381 47946907 140109146 449424729 1...
result:
ok 2000000 numbers
Test #15:
score: 0
Accepted
time: 1330ms
memory: 227836kb
input:
2000000 2000000 1992773 1946362 1941792 1961083 1999925 1982386 1971523 1999448 1993704 1993825 1998722 1975132 1963436 1970995 1978628 1997953 1904423 1943613 1983078 1886282 1944015 1951777 1896373 1944238 1938932 1985054 1965267 1998981 1988670 1988739 1989862 1996688 1953416 1987137 1919616 1983...
output:
53072255731 49555714940 54462867910 62450413447 99773650069 60992126123 118612435607 103197159693 100195164935 117125022863 105194352743 62213528893 98686523409 58289204447 57317895701 62097298558 81157286803 53514331312 57653585617 62121301750 49788136229 77216468855 49255612627 59036307590 4301137...
result:
ok 2000000 numbers
Test #16:
score: 0
Accepted
time: 1462ms
memory: 218100kb
input:
2000000 2000000 1 2 3 4 5 6 14 15 7 8 13 16 12 11 10 9 17 455 456 457 458 459 18 454 453 452 451 450 449 448 447 460 19 462 461 42 41 63 62 40 39 47 38 45 46 44 43 61 60 430 35 37 36 34 33 32 48 49 50 56 55 54 53 52 51 57 58 59 431 432 433 434 421 422 440 423 441 427 424 425 426 439 438 419 443 437 ...
output:
21182509 8833822 881337 60874875 6063493 23842280 24803452 16110354 2580479 26147515 15345949 7315215 30178796 5995525 32689522 29678416 4385188 14694989 22501076 18973805 615729 28088461 15179939 8617740 27478348 13078495 24492339 8642588 24394654 53788930 9720722 43489388 4297959 34103438 51252672...
result:
ok 2000000 numbers
Test #17:
score: 0
Accepted
time: 2239ms
memory: 211968kb
input:
1999995 1999998 1979846 1947124 1965946 1953594 1983574 1990659 1929905 1888928 1974444 1998069 1999240 1996891 1975733 1927117 1994851 1987958 1980478 1961408 1992372 1917909 1975636 1988412 1990717 1983126 1923129 1998325 1974081 1995268 1988405 1921058 1998966 1947350 1927897 1937097 1969117 1917...
output:
32287098380 53428024584 44067151576 21883427725 1954928849 40672639080 5475066235 51224942661 42680276748 24205761028 34346528066 4499909900 9596714849 41559896451 13728128953 23796822279 19574455174 12895675188 30129398206 39552064305 15583024420 24878020151 7894033920 32467239927 16163187489 61067...
result:
ok 1999998 numbers
Test #18:
score: 0
Accepted
time: 1498ms
memory: 217188kb
input:
2000000 2000000 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...
output:
44107849 299212237 587192346 412342130 207705679 509268742 254545621 123143925 386528881 235374266 164255979 144652798 161183072 42962269 427075598 103570813 291138270 37291897 26637582 445593136 235610551 453925390 647807572 228904713 627301150 111158021 411196806 155510033 398568110 168715235 5002...
result:
ok 2000000 numbers
Test #19:
score: 0
Accepted
time: 1271ms
memory: 224396kb
input:
2000000 2000000 1994991 1960973 1994201 1931188 1916621 1954707 1978833 1989630 1998865 1997932 1967997 1915620 1918445 1993617 1910602 1999218 1993846 1978670 1982312 1944648 1986274 1976382 1999067 1972806 1968503 1978829 1809727 1998040 1974996 1964273 1992340 1946553 1972483 1948091 1992452 1947...
output:
54625243647 53118288546 62990506963 64344700323 57378382873 56618622821 96455402431 58659363273 60820545629 61247228503 50124408073 59686238034 54394327956 52033356917 61082704289 115119672403 49897003125 102405853351 80042940061 50471093310 89465526389 61150639953 89264894451 112617269869 599563218...
result:
ok 2000000 numbers
Test #20:
score: 0
Accepted
time: 1480ms
memory: 211780kb
input:
2000000 2000000 1 2 4 3 5 6 13 8718 8717 8716 8715 8714 8713 8711 8710 8712 8760 8761 8759 8758 8722 8724 8723 8725 8726 8727 8763 8709 8762 8708 8729 8728 8764 8765 8720 8719 12 8769 8770 8776 8775 8768 8767 8771 8766 14 11 8774 9 10 7 8 8773 8772 8721 8757 8756 8755 8754 8753 8747 8748 8738 8749 8...
output:
43700615 31074881 5698557 52225801 28295216 22696143 12848176 21938424 60549063 31499303 4827015 63422407 67177725 53224341 52178747 35213267 37232084 1937857 43284113 7525362 2921516 45860331 33960048 8081204 55930705 7057285 21957921 54954771 38300625 15607967 26954278 6930152 1085726 34388864 177...
result:
ok 2000000 numbers