QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#672612 | #9513. 环上排序信息最优分割 | JWRuixi | 100 ✓ | 969ms | 45920kb | C++20 | 6.6kb | 2024-10-24 17:46:31 | 2024-10-24 17:46:33 |
Judging History
answer
#ifdef LOCAL
#include "stdafx.h"
#else
#include <bits/stdc++.h>
#define IL inline
#define LL long long
#define eb emplace_back
#define sz(v) ((int) (v).size())
#define me(f, x) memset(f, x, sizeof(f))
#define mc(f, g) memcpy(f, g, sizeof(g))
#define L(i, j, k) for (int i = (j); i <= (k); ++i)
#define R(i, j, k) for (int i = (j); i >= (k); --i)
#define FIO(FILE) freopen(FILE".in", "r", stdin), freopen(FILE".out", "w", stdout)
using namespace std;
using vi = vector<int>;
#endif
namespace vEB_tree_impl {
#ifdef _WIN32
using uint = unsigned;
#endif
using ull = unsigned long long;
template<int LG, class T = void>
struct vEB_tree_t {
static constexpr uint shf = LG * 3;
static constexpr uint bas = (1U << shf) - 1;
using _vEB_tree_t = vEB_tree_t<LG / 2>;
_vEB_tree_t msk;
std::array<_vEB_tree_t, 1 << shf> ch;
int mn, mx;
vEB_tree_t () : mn(1 << 30), mx(-1) {}
bool empty () const {
return mx == -1;
}
int min () const {
return mn;
}
int max () const {
return mx;
}
void insert (int x) {
if (max() == -1) {
mn = mx = x;
return;
}
if (x == min()) {
return;
}
if (x < min()) {
std::swap(x, mn);
}
mx = std::max(mx, x);
int p = x >> shf;
if (ch[p].empty()) {
msk.insert(p);
}
ch[p].insert(x & bas);
}
void erase (int x) {
if (x == min()) {
if (x == max()) {
mn = 1U << 30, mx = -1;
} else {
int p = msk.min();
mn = (p << shf) | ch[p].min();
ch[p].erase(ch[p].min());
if (ch[p].empty()) {
msk.erase(p);
}
}
} else {
int p = x >> shf;
if (ch[p].empty()) {
return;
}
ch[p].erase(x & bas);
if (ch[p].empty()) {
msk.erase(p);
}
if (x == max()) {
p = msk.max();
mx = ~p ? (p << shf) | ch[p].max() : min();
}
}
}
bool contain (int x) {
if (x == min()) {
return true;
}
int p = x >> shf;
return !ch[p].empty() && ch[p].contain(x & bas);
}
int find_next (int x) {
if (x > max()) {
return -1;
}
if (x <= min()) {
return min();
}
int p = x >> shf;
x &= bas;
if (x <= ch[p].max()) {
return (p << shf) | ch[p].find_next(x);
}
int y = msk.find_next(p + 1);
return ~y ? (y << shf) | ch[y].min() : -1;
}
int find_prev (int x) {
if (x <= min()) {
return -1;
}
if (x > max()) {
return max();
}
int p = x >> shf;
x &= bas;
if (x > ch[p].min()) {
return (p << shf) | ch[p].find_prev(x);
}
int y = msk.find_prev(p);
return ~y ? (y << shf) | ch[y].max() : min();
}
};
inline constexpr uint lb (ull x) {
return x ? __builtin_ctzll(x) : -1;
}
inline constexpr uint hb (ull x) {
return x ? 63 - __builtin_clzll(x) : -1;
}
template<int LG>
struct vEB_tree_t<LG, typename std::enable_if<LG == 1>::type> {
ull msk;
vEB_tree_t () : msk(0) {}
bool empty () {
return msk == 0;
}
int min () const {
return msk ? __builtin_ctzll(msk) : 1U << 30;
}
int max () const {
return hb(msk);
}
bool contain (int x) {
return msk >> x & 1;
}
void insert (int x) {
msk |= 1ULL << x;
}
void erase (int x) {
msk &= ~(1ULL << x);
}
int find_next (int x) {
return lb(msk & ~((1ULL << x) - 1));
}
int find_prev (int x) {
return hb(msk & ((1ULL << x) - 1));
}
};
}
using vEB_tree = vEB_tree_impl::vEB_tree_t<4>;
vEB_tree ds;
constexpr int N = 2e5 + 9;
constexpr int inf = 2e6;
int n, M, val[N * 3], tot;
vi a[N];
IL constexpr LL sq (int x) {
return (LL)x * x;
}
struct calculator {
int l, r;
LL s;
vi A, B;
void init (int p) {
int q = p ? p - 1 : n - 1;
l = sz(a[q]);
r = -1;
vector<pair<int, int>> C;
L (i, 0, sz(a[p]) - 1) {
C.eb(a[p][i], i + 1);
}
L (i, 0, sz(a[q]) - 1) {
C.eb(a[q][i], -i - 1);
}
sort(C.begin(), C.end());
A.resize(sz(a[p]));
B.resize(sz(a[q]));
val[tot] = 0;
ds.insert(tot++);
L (i, 0, sz(C) - 1) {
val[tot] = C[i].first;
if (C[i].second > 0) {
A[C[i].second - 1] = tot++;
} else {
B[-C[i].second - 1] = tot++;
}
}
val[tot] = inf;
ds.insert(tot++);
s = (LL)inf * inf;
}
void ins (int x) {
int a = ds.find_prev(x), b = ds.find_next(x);
s += sq(val[x] - val[a]) + sq(val[x] - val[b]) - sq(val[a] - val[b]);
ds.insert(x);
}
void era (int x) {
ds.erase(x);
int a = ds.find_prev(x), b = ds.find_next(x);
s += sq(val[a] - val[b]) - sq(val[x] - val[a]) - sq(val[x] - val[b]);
}
LL gt (int ql, int qr) {
while (l > ql) {
ins(B[--l]);
}
while (r < qr) {
ins(A[++r]);
}
while (l < ql) {
era(B[l++]);
}
while (r > qr) {
era(A[r--]);
}
return s;
}
} c[N];
vector<LL> f[N];
vi g[N];
void DP (int k, int l, int r, int L, int R) {
if (l > r || L > R) {
return;
}
int m = (l + r) / 2;
LL mn = 0;
int p = -1;
L (i, L, R) {
LL w = f[k ? k - 1 : n - 1][i] + c[k].gt(i, m - 1);
if (p == -1 || w < mn) {
mn = w;
p = i;
}
}
f[k][m] = mn;
g[k][m] = p;
DP(k, l, m - 1, L, p);
DP(k, m + 1, r, p, R);
}
struct inter {
int L, R;
inter (int a = 0, int b = 0) {
L = a, R = b;
}
};
LL ans;
void conq (vector<inter> q) {
if (q[0].L > q[0].R) {
return;
}
int m = (q[0].L + q[0].R) / 2;
L (i, q[1].L, q[1].R) {
f[1][i] = c[1].gt(m, i - 1);
}
L (i, 2, n - 1) {
DP(i, q[i].L, q[i].R, q[i - 1].L, q[i - 1].R);
}
LL mn = 0;
int p = -1;
L (i, q[n - 1].L, q[n - 1].R) {
LL w = f[n - 1][i] + c[0].gt(i, m - 1);
if (p == -1 || w < mn) {
mn = w;
p = i;
}
}
ans = min(ans, mn);
auto ql = q, qr = q;
R (i, n - 1, 1) {
ql[i].R = qr[i].L = p;
p = g[i][p];
}
ql[0].R = m - 1;
qr[0].L = m + 1;
conq(ql);
conq(qr);
}
int main () {
cin >> n;
L (i, 0, n - 1) {
int m;
cin >> m;
a[i].resize(m);
L (j, 0, m - 1) {
cin >> a[i][j];
}
}
int idx = 0;
L (i, 1, n - 1) {
if (sz(a[i]) < sz(a[idx])) {
idx = i;
}
}
rotate(a, a + idx, a + n);
vector<inter> init;
L (i, 0, n - 1) {
c[i].init(i);
f[i].resize(sz(a[i]));
g[i].resize(sz(a[i]));
init.eb(0, sz(a[i]) - 1);
}
ans = LONG_LONG_MAX;
conq(init);
cout << ans << '\n';
}
// I love WHQ!
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 0ms
memory: 21716kb
input:
7 2 141209 1121811 2 812367 1802201 2 977174 168547 2 1687591 770753 2 383640 1117793 2 976813 1295653 2 1204905 1272531
output:
11670772336006
result:
ok single line: '11670772336006'
Test #2:
score: 10
Accepted
time: 0ms
memory: 20932kb
input:
2 3 747473 498147 966660 4 140021 1580273 1406494 1082158
output:
2048229359670
result:
ok single line: '2048229359670'
Test #3:
score: 10
Accepted
time: 0ms
memory: 21728kb
input:
3 2 1728062 1099010 2 681240 1097031 3 1641021 1511445 589879
output:
4172471577572
result:
ok single line: '4172471577572'
Test #4:
score: 10
Accepted
time: 0ms
memory: 20080kb
input:
5 16 584133 1584872 154106 1620031 591988 744576 1145492 27159 242511 670507 1070239 967255 904906 1001126 1473498 476319 6 854977 1522388 1715546 755137 1587176 1693529 10 1712058 1021608 56261 1457152 501427 1834297 1045836 1646715 1286280 1705780 13 1970970 641553 1429549 1002213 510656 1957451 1...
output:
1733588007714
result:
ok single line: '1733588007714'
Test #5:
score: 10
Accepted
time: 4ms
memory: 21660kb
input:
5 34 1566025 85940 278880 454649 787234 1305849 154207 1474698 1600192 503961 365771 1482441 1547432 161149 264902 261751 1808604 1742906 421948 1700417 1130148 1895614 1845604 1982079 1809962 570006 806643 1147674 642303 1639211 71572 504934 1645348 777213 12 891780 864141 142718 810549 1837977 156...
output:
1998774012376
result:
ok single line: '1998774012376'
Test #6:
score: 10
Accepted
time: 5ms
memory: 20560kb
input:
8 12 1661582 42963 825548 905766 1396233 1586762 1462654 1109305 494915 350916 1873040 393645 13 345398 1885409 1256560 1894290 1491080 1621530 227733 1736972 1628382 1484099 800971 57243 477341 12 188280 1756126 1032009 615335 993454 1177927 1940147 533378 483231 360286 2257 140152 12 1166895 98911...
output:
4213902956250
result:
ok single line: '4213902956250'
Test #7:
score: 10
Accepted
time: 2ms
memory: 21496kb
input:
2 53 302846 1295542 24845 1212574 1304172 104285 703874 84915 1712705 1244300 1414005 1987829 453192 1608635 1118210 1309012 1277168 507531 1409701 1910782 396566 1922014 606343 1790716 1330747 226808 1781210 1977352 1075232 1056760 882341 497105 1552080 1341875 607475 298838 1823003 970560 1613243 ...
output:
307847818150
result:
ok single line: '307847818150'
Test #8:
score: 10
Accepted
time: 4ms
memory: 21284kb
input:
5 19 219089 505437 1310185 184027 898555 1116029 87339 217421 1309381 519629 1288544 1712726 339398 1854776 86798 318778 1150968 142049 889486 19 1165430 1587268 19293 1800520 372004 508331 916039 98568 1733119 46813 734281 188087 1898878 1387285 1203403 1880278 985595 382635 1809272 20 1472954 1533...
output:
1692696172628
result:
ok single line: '1692696172628'
Test #9:
score: 10
Accepted
time: 0ms
memory: 21112kb
input:
6 21 357771 315599 1460430 818532 214122 1172906 1734280 1500944 1018238 1714578 1521590 1446805 1232828 1586122 1658707 1391658 1587342 123447 18944 222566 1208967 10 564921 713032 1585614 1192233 698056 1182537 1019254 360882 985272 202180 13 815939 1021021 1857909 1535469 415946 1834538 85776 173...
output:
2597658447248
result:
ok single line: '2597658447248'
Test #10:
score: 10
Accepted
time: 5ms
memory: 21288kb
input:
8 12 380229 1846517 1793452 533237 803179 1861650 1346185 1016991 1854367 185486 1269069 1523331 15 1404393 1476051 1296740 124511 1599551 597438 983996 1530258 1027553 206078 329015 485189 1899261 1724574 364569 9 400122 370232 1501910 662275 1393909 1996150 140566 1329516 500584 9 891866 416021 17...
output:
3875073703894
result:
ok single line: '3875073703894'
Subtask #2:
score: 20
Accepted
Dependency #1:
100%
Accepted
Test #11:
score: 20
Accepted
time: 0ms
memory: 22000kb
input:
147 2 1372901 772129 4 1020221 971692 1168518 159062 3 984910 1258846 1235276 3 878312 143829 1298333 3 1621632 1328072 1757948 2 1974623 996846 6 1868536 553403 1996068 1295727 653126 1805160 2 432938 1048701 3 917584 771455 856917 3 1907080 1449811 328103 2 236480 1908319 2 1049603 1624504 4 50589...
output:
211627731592048
result:
ok single line: '211627731592048'
Test #12:
score: 20
Accepted
time: 0ms
memory: 21372kb
input:
152 5 174207 387280 690833 15287 439714 5 1201407 681555 1745531 469616 1228449 6 1556243 63257 952534 1647801 318933 653183 6 111530 1644663 733744 909159 499759 632269 9 765943 1385423 1088518 452880 441111 1547494 141731 954414 231825 6 767182 1911649 213321 1316021 1833365 951382 5 141116 693885...
output:
133043790176918
result:
ok single line: '133043790176918'
Test #13:
score: 20
Accepted
time: 3ms
memory: 21968kb
input:
500 2 28558 973575 2 1327149 1966676 2 1171935 232590 2 1124942 1569805 2 1132550 481012 2 1046320 419786 2 170580 971835 2 1974155 1252285 2 1882588 1340878 2 1414318 244813 2 1678309 1687898 2 810989 522410 2 1351481 1145851 2 1222091 1312777 2 1405614 1951551 2 1412654 1305216 2 726188 975503 2 9...
output:
949657455192700
result:
ok single line: '949657455192700'
Test #14:
score: 20
Accepted
time: 2ms
memory: 20628kb
input:
13 26 183835 1891616 1615510 1115306 94917 1550834 1403382 961362 991619 78890 569339 1515129 1642042 1443476 1609830 1844840 1816400 79821 1761506 1958708 1718252 1056795 816456 443329 248678 1087100 29 910626 215950 202302 1896290 222131 1572381 300318 1562003 1371685 1910953 827189 1190876 114324...
output:
3045699033828
result:
ok single line: '3045699033828'
Test #15:
score: 20
Accepted
time: 5ms
memory: 21908kb
input:
12 35 1519590 1118678 348919 1562990 1635196 107142 354301 1211746 592044 1461695 1111253 1944129 585161 1019360 127379 78918 1516682 1397269 472897 425684 428563 1301155 753806 730032 257014 315928 158460 1339523 231995 52208 1058915 384596 1261092 145361 1977113 23 1996527 588975 1991450 333699 15...
output:
2921188180374
result:
ok single line: '2921188180374'
Test #16:
score: 20
Accepted
time: 0ms
memory: 21396kb
input:
8 106 619845 415875 1180231 865280 1261241 201769 1440032 17964 1760503 918240 1703582 299378 552068 120435 1978938 1812433 1269028 580880 776182 823782 1204815 8254 1269067 1101930 821568 294579 1990010 1674046 1401068 1043644 1021208 1572673 1875570 66848 1954973 1565086 1795614 226955 105912 5345...
output:
546063113910
result:
ok single line: '546063113910'
Test #17:
score: 20
Accepted
time: 4ms
memory: 20208kb
input:
6 67 1593561 1867013 1897744 400384 1379411 988245 332730 72836 1745322 1512852 1599136 871114 382156 830357 591119 602302 1559705 1381038 284137 1498930 1957808 997229 984856 778052 533770 49586 1442939 164977 825944 1274277 746673 1427605 1066662 477527 772149 622435 866958 1470924 1422824 469315 ...
output:
665979693344
result:
ok single line: '665979693344'
Test #18:
score: 20
Accepted
time: 0ms
memory: 20460kb
input:
4 49 405746 1310767 985218 1991780 372660 23694 1012019 265171 1430937 895711 817568 840481 1926131 888517 583746 715878 796716 390880 716208 892518 221955 656717 1580779 1821336 194784 147463 1273321 933532 1260914 830969 354223 1037231 1031226 1549253 985278 777463 1616733 505225 861272 1991357 86...
output:
483524689300
result:
ok single line: '483524689300'
Test #19:
score: 20
Accepted
time: 0ms
memory: 21988kb
input:
2 489 667060 1206168 830362 618705 1754699 805678 1628114 1294906 1181309 234274 511717 209261 1083043 1084337 278905 448634 1596547 296527 754468 12051 1292691 1727566 857327 111731 1496346 225644 1027512 617993 1982528 1011736 1691594 1827258 214842 1094832 1266439 536677 489047 908699 1674558 148...
output:
29590375960
result:
ok single line: '29590375960'
Test #20:
score: 20
Accepted
time: 0ms
memory: 23116kb
input:
101 500 680975 1073719 1260045 727434 1969443 881554 887155 265680 743000 501780 832393 491668 1461183 259277 1462302 567298 661416 1242399 528598 1942294 1357628 1143582 575136 1349443 685466 697061 990721 861526 912438 253251 1147533 1476595 759162 275759 1917376 1539539 1300395 427565 696869 7447...
output:
97198282311676
result:
ok single line: '97198282311676'
Subtask #3:
score: 30
Accepted
Dependency #2:
100%
Accepted
Test #21:
score: 30
Accepted
time: 23ms
memory: 24268kb
input:
8939 4 440419 1525753 1278622 1808699 4 1240278 1221809 1631010 1039993 3 257623 295999 245115 5 1712418 475483 1945140 1186946 1128196 9 286697 681022 1290690 955835 1106275 356865 1088437 1708186 1133709 4 964107 755534 389869 1584440 9 956222 586056 532557 885142 1447326 186875 1750458 479704 163...
output:
8850587435529910
result:
ok single line: '8850587435529910'
Test #22:
score: 30
Accepted
time: 23ms
memory: 25780kb
input:
18597 2 657704 1413374 2 1470465 331541 3 326590 1997246 1960707 2 1767851 1089614 3 1065552 1421319 1895675 2 436303 976454 2 241011 190085 2 129761 617449 2 843279 1524283 3 1573915 923937 519877 3 916852 1511407 1390655 2 1970044 565080 2 1692696 178911 2 1982339 609105 2 926810 383341 3 42575 10...
output:
29867464659234470
result:
ok single line: '29867464659234470'
Test #23:
score: 30
Accepted
time: 27ms
memory: 27452kb
input:
24853 2 1706709 956169 2 1425751 361083 2 926805 765711 2 1530127 1143833 2 1019912 141132 2 1157205 1656940 2 1327168 80870 2 673072 800659 2 13998 1327785 2 396492 265664 2 1483276 946587 2 1633689 977951 2 753205 1637465 2 317375 1286056 2 1571045 1739635 2 1169182 1353681 2 1996995 103875 2 1303...
output:
46395909376832160
result:
ok single line: '46395909376832160'
Test #24:
score: 30
Accepted
time: 97ms
memory: 22960kb
input:
3 16404 1269204 29553 1942477 419399 1613856 1268725 539416 1311717 1041552 851511 3374 902734 1668047 434566 403074 911653 1325267 283101 1504205 212082 248200 1705529 928395 442312 1064689 1636750 1265349 221137 1228821 1158221 989913 1676502 662119 66991 775131 337073 1890426 1080858 902189 17499...
output:
1449608404
result:
ok single line: '1449608404'
Test #25:
score: 30
Accepted
time: 160ms
memory: 23112kb
input:
15 3281 1987794 62602 340090 635485 1451574 381758 579900 706541 1952142 1199391 25796 1491568 1459151 1747299 456385 921356 864811 1667206 116637 1124311 627090 855176 1565591 157995 1086712 1191042 162361 1719350 1967958 675756 647058 892332 1288872 1903979 995861 1794983 500431 834137 486579 1472...
output:
35971489098
result:
ok single line: '35971489098'
Test #26:
score: 30
Accepted
time: 165ms
memory: 22184kb
input:
20 2504 1329147 791952 527553 449667 1987072 439925 396898 872177 770334 378235 1228775 822114 1120110 1386390 1778632 151775 559887 212887 213707 1752512 1098613 871485 221560 1193055 703404 1031207 10052 403326 611071 601734 128327 521003 410319 1435871 1698822 844346 46540 251526 1622714 1088448 ...
output:
62964957526
result:
ok single line: '62964957526'
Test #27:
score: 30
Accepted
time: 113ms
memory: 23328kb
input:
18 1253 1017692 514310 1062669 740703 712203 1072102 629689 798920 1775933 1629927 1897816 1634190 1741023 916346 1909811 1958451 361438 311569 1735197 268722 764513 933324 362793 1535228 805210 885878 526814 696879 854201 1223643 570948 1915047 1540545 989525 1251484 1289415 591192 1072798 1383650 ...
output:
78461851184
result:
ok single line: '78461851184'
Test #28:
score: 30
Accepted
time: 170ms
memory: 23208kb
input:
19 1842 1965361 1597208 1657471 1054534 1357195 581507 1025511 1374687 1091889 392889 1687488 252864 1403160 99808 850576 1915518 350501 1142227 693119 544656 574488 1571734 875001 1849905 1166103 1036518 1138114 1495588 225433 589646 105695 1346730 1154176 38084 1558607 1474598 374070 490966 138649...
output:
57272843736
result:
ok single line: '57272843736'
Test #29:
score: 30
Accepted
time: 24ms
memory: 27268kb
input:
12501 25000 986657 210610 179407 1189889 1649466 126259 1011320 15232 1846237 1736017 1482170 1369531 278012 745437 1291403 1788129 743220 120788 136313 1421713 1046057 821414 1851414 1532097 70078 1307799 245604 125313 19609 1597628 814750 1292327 1418495 299186 1951116 618786 866326 452653 1451471...
output:
23357917547018690
result:
ok single line: '23357917547018690'
Test #30:
score: 30
Accepted
time: 41ms
memory: 24108kb
input:
2 24900 1177717 52282 905612 1927900 495700 1894546 655321 545819 1303440 1072479 1573321 955948 467394 224899 1240378 1051744 436932 161640 266192 1092641 1784637 543382 604819 1776107 1641178 600596 1098760 68162 862703 1904695 537871 161351 142588 1281356 1132699 115447 45784 782929 1380886 15834...
output:
637590014
result:
ok single line: '637590014'
Subtask #4:
score: 40
Accepted
Dependency #3:
100%
Accepted
Test #31:
score: 40
Accepted
time: 93ms
memory: 45920kb
input:
87826 2 1078902 182985 2 188604 111380 2 1109427 968204 2 47538 293121 2 1130491 63263 2 1441441 1989044 2 1831042 1175594 2 917599 147619 3 972531 190266 1573209 2 174086 1455773 2 500828 362796 2 366007 1292479 3 1993053 955523 782175 2 589255 1159339 2 660813 695358 2 649504 360126 2 546604 33114...
output:
157028170845733340
result:
ok single line: '157028170845733340'
Test #32:
score: 40
Accepted
time: 126ms
memory: 27832kb
input:
4985 20 278786 1881552 1761266 558725 564762 756192 533184 395856 1648828 399561 1318445 1805245 629273 1360314 253804 348123 1108608 502493 455692 530080 25 625256 1901900 987569 1440962 579567 141334 1382850 1262201 1756190 53246 1731314 459133 1013298 920274 1816439 298493 316025 1021518 1428091 ...
output:
1144034465739590
result:
ok single line: '1144034465739590'
Test #33:
score: 40
Accepted
time: 969ms
memory: 27188kb
input:
15 14978 853407 49345 1038930 1017820 559218 1340429 560527 1355339 1092739 931625 1041216 624153 1418079 1493684 1338143 1587434 654932 673668 523026 1018805 1508566 5333 487453 762057 220775 1047863 710567 935365 1637912 627569 1676745 832977 1042247 1773580 773618 429867 785162 1910759 250501 375...
output:
9094414490
result:
ok single line: '9094414490'
Test #34:
score: 40
Accepted
time: 853ms
memory: 26908kb
input:
18 10754 625068 966087 587042 899966 323307 99550 208013 1140366 1002762 1713026 1332587 875010 1915668 1302645 1543520 39194 1208130 197683 667890 1707866 668911 736985 1852557 1374198 180904 37127 211673 445096 747207 775017 1343816 956431 1821864 1471777 1765926 1324247 996701 815663 555591 72833...
output:
13439359770
result:
ok single line: '13439359770'
Test #35:
score: 40
Accepted
time: 859ms
memory: 27204kb
input:
12 13320 375560 1258488 127653 1628281 292511 459024 104147 1840217 1491831 460665 243343 63637 50362 1342093 687173 1013783 796357 1607516 1885078 114352 158627 1011180 1480797 1486593 125965 291593 213562 1045713 483288 1087547 1824280 509644 1133361 1836538 1297164 1481263 1753748 1025919 620036 ...
output:
6165582256
result:
ok single line: '6165582256'
Test #36:
score: 40
Accepted
time: 520ms
memory: 28544kb
input:
3 66635 318274 408562 834996 1781403 827886 871929 1285851 285314 415754 1385441 718026 394037 1250705 1100019 1666595 680693 419672 1675417 1207687 465150 1476591 620462 1297037 1050779 1012840 721875 453638 1759331 218357 258528 87115 1683950 1106042 1048176 1272911 1116207 1989032 1235205 36592 1...
output:
360257234
result:
ok single line: '360257234'
Test #37:
score: 40
Accepted
time: 911ms
memory: 27448kb
input:
11 17905 1564031 622469 1751204 1306045 960035 1074860 1787662 479146 253106 885916 856921 587599 471603 1229989 1157476 495035 1348108 1488727 39558 1429851 774873 1876843 1308993 1740111 746794 1363844 1892984 759096 323456 197749 899144 1336647 1437290 1106350 1325060 297563 1980537 1086016 50680...
output:
4899731914
result:
ok single line: '4899731914'
Test #38:
score: 40
Accepted
time: 618ms
memory: 27396kb
input:
4 48287 298522 731414 1191189 76846 402731 541922 1938304 1196857 512197 934713 1733628 1658549 300972 980189 1634723 444311 252200 988205 1542985 974853 1161192 64911 1432957 1809347 797685 868939 1826875 1720970 1009954 231009 565526 667214 1345950 1402752 1486218 1384921 1990027 340548 1189391 16...
output:
660112460
result:
ok single line: '660112460'
Test #39:
score: 40
Accepted
time: 184ms
memory: 28336kb
input:
2 95123 1129856 1290777 1706458 368225 1826469 1121016 1833248 1348931 731644 1975576 187156 1592817 210772 68442 1007521 1237262 1509677 524081 132470 192644 522840 1514313 1692089 1921644 283918 972672 391630 1179329 1149306 1736717 1753351 413268 1391118 1155471 846914 279758 900177 1058832 84856...
output:
167532628
result:
ok single line: '167532628'
Test #40:
score: 40
Accepted
time: 102ms
memory: 37968kb
input:
50001 100000 511773 115521 401699 1963394 18176 1418401 282930 43768 1348796 1864356 1057789 1027115 480373 913495 73248 833038 249500 6555 299110 487423 804381 1251306 907765 1179712 1881818 1054301 858326 1960950 630327 114383 273565 1541960 602600 507852 1033483 1353982 1449834 351151 688831 2099...
output:
93303733894279528
result:
ok single line: '93303733894279528'