QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#4892 | #440. 时代的眼泪 | Qingyu | 100 ✓ | 2459ms | 166396kb | C++11 | 6.3kb | 2020-10-15 11:28:29 | 2021-12-19 05:33:21 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int read() {
int a = 0;
char c = getchar();
while (!isdigit(c)) c = getchar();
while (isdigit(c)) {
a = a * 10 + c - 48;
c = getchar();
}
return a;
}
const int _ = 1e5 + 2007, T = 318;
int N, M, P[_], RP[_];
long long ans[_ << 1];
struct query {
int l, r, L, R, id, flag;
} now[_];
namespace inone {
vector<query> now;
void push(query cur) { now.push_back(cur); }
void brute() {
sort(now.begin(), now.end(), [&](query p, query q) { return p.l < q.l; });
static int pre = -1, sum[T + 1][T + 1], pos[T + 1];
vector<int> pot;
for (auto t : now) {
if (t.l / T != pre) {
pre = t.l / T;
pot.clear();
for (int i = pre * T; i < (pre + 1) * T; ++i) pot.push_back(P[i]);
pot.push_back(-1);
sort(pot.begin(), pot.end());
memset(sum, 0, sizeof(sum));
for (int i = pre * T, id = 1; i < (pre + 1) * T; ++i, ++id)
for (int t = pos[id] = lower_bound(pot.begin(), pot.end(), P[i]) - pot.begin(), j = 1; j <= T;
++j)
sum[id][j] = sum[id - 1][j] + sum[id][j - 1] - sum[id - 1][j - 1] + (j == t);
}
int qlow = lower_bound(pot.begin(), pot.end(), t.L) - pot.begin() - 1;
for (int i = t.l; i <= t.r; ++i)
if (P[i] >= t.L && P[i] <= t.R)
ans[t.id] += (sum[i - pre * T][pos[i - pre * T + 1]] - sum[i - pre * T][qlow]) -
(sum[t.l - pre * T][pos[i - pre * T + 1]] - sum[t.l - pre * T][qlow]);
}
}
} // namespace inone
namespace scrat {
int sum[T][_], rk[_];
void prepare() {
for (int i = 1; i <= N; ++i) ++sum[i / T][P[i]];
for (int i = 0; i < T; ++i)
for (int j = 1; j <= N; ++j) sum[i][j] += sum[i][j - 1];
for (int i = 1; i < T; ++i)
for (int j = 1; j <= N; ++j) sum[i][j] += sum[i - 1][j];
for (int i = 0; i < T; ++i) {
static int tmp[T];
for (int j = 0; j < T; ++j) tmp[j] = i * T + j;
sort(tmp, tmp + T, [&](int p, int q) { return P[p] < P[q]; });
for (int j = 0; j < T; ++j) rk[tmp[j]] = j;
}
}
void work(int l, int r, int L, int R, int id) {
int bl = l / T, br = r / T;
inone::push((query){ l, bl * T + T - 1, L, R, id });
inone::push((query){ br * T, r, L, R, id });
for (int i = l; i < bl * T + T; ++i)
if (P[i] >= L && P[i] <= R)
ans[id] += (sum[br - 1][R] - sum[br - 1][P[i]]) - (sum[bl][R] - sum[bl][P[i]]);
for (int i = br * T; i <= r; ++i)
if (P[i] >= L && P[i] <= R)
ans[id] += (sum[br - 1][P[i]] - sum[br - 1][L - 1]) - (sum[bl][P[i]] - sum[bl][L - 1]);
static int ptl[T + 1], ptr[T + 1];
int pl = 0, pr = 0;
ptl[T] = ptr[T] = -1;
for (int i = l; i < bl * T + T; ++i)
if (P[i] >= L && P[i] <= R)
ptl[rk[i]] = i;
for (int i = br * T; i <= r; ++i)
if (P[i] >= L && P[i] <= R)
ptr[rk[i]] = i;
auto move = [&](int &pos, int *pot) {
while (!pot[pos]) ++pos;
};
move(pl, ptl);
move(pr, ptr);
int cnt = 0;
while (pl != T || pr != T)
if (pl != T && (pr == T || P[ptl[pl]] < P[ptr[pr]])) {
++cnt;
ptl[pl++] = 0;
move(pl, ptl);
} else {
ans[id] += cnt;
ptr[pr++] = 0;
move(pr, ptr);
}
}
} // namespace scrat
namespace solve1 {
vector<query> now;
void push(query cur) { now.push_back(cur); }
int pot[T + 1][T + 1], cnt[T + 1];
void solve() {
sort(now.begin(), now.end(), [&](query p, query q) { return p.R < q.R; });
int pn = 0;
for (int i = 1; i <= N; ++i) {
int p = RP[i], id = p / T;
for (int j = id; j; --j) pot[id][j] -= pot[id][j - 1];
for (int j = 0; j < id; ++j) pot[id][j] += cnt[j];
for (int j = id * T; j < p; ++j) pot[id][id] += P[j] < i;
for (int j = 1; j <= id; ++j) pot[id][j] += pot[id][j - 1];
++cnt[id];
while (pn < now.size() && now[pn].R == i) {
for (int i = now[pn].l; i <= now[pn].r; ++i)
ans[now[pn].id] += now[pn].flag * (pot[i][i] - (now[pn].l ? pot[i][now[pn].l - 1] : 0));
++pn;
}
}
}
} // namespace solve1
namespace solve2 {
vector<query> now;
void push(query cur) { now.push_back(cur); }
long long cnt[_ << 1], tans[T + 1][T + 1];
int pre[_];
void solve() {
for (int i = 0; i < T; ++i) {
static int tmp[T];
for (int j = 0; j < T; ++j) tmp[j] = i * T + j;
sort(tmp, tmp + T, [&](int p, int q) { return P[p] < P[q]; });
memset(pre, 0, sizeof(pre));
for (int j = 0; j < T; ++j) ++pre[P[i * T + j]];
for (int i = 1; i <= N; ++i) pre[i] += pre[i - 1];
static int sum[T];
memset(sum, 0, sizeof(sum));
for (int j = 0; j < T; ++j) {
for (int k = tmp[j] - i * T; k < T; ++k) ++sum[k];
for (int k = j + 1; k < T; ++k) tans[j][k] = tans[j][k - 1] + sum[tmp[k] - i * T];
}
for (int j = 0; j < now.size(); ++j)
if (now[j].l <= i && i <= now[j].r) {
int pl = pre[now[j].L], pr = pre[now[j].R];
ans[now[j].id] -= (pr - pl) * cnt[now[j].id];
cnt[now[j].id] += pl;
if (pl)
ans[now[j].id] -= tans[pl - 1][pr - 1];
}
}
}
} // namespace solve2
int main() {
N = read();
M = read();
for (int i = 1; i <= N; ++i) RP[P[i] = read()] = i;
scrat::prepare();
for (int i = 1; i <= M; ++i) {
int l = read(), r = read(), L = read(), R = read();
if (l / T == r / T)
inone::push((query){ l, r, L, R, i });
else {
scrat::work(l, r, L, R, i);
l = l / T + 1;
r = r / T - 1;
if (l > r)
continue;
solve1::push((query){ l, r, 1, R, i, 1 });
if (L != 1) {
solve1::push((query){ l, r, 1, L - 1, i, -1 });
solve2::push((query){ l, r, L - 1, R, i });
}
}
}
inone::brute();
solve1::solve();
solve2::solve();
for (int i = 1; i <= M; ++i) printf("%lld\n", ans[i]);
return 0;
}
详细
Test #1:
score: 4
Accepted
time: 20ms
memory: 34888kb
input:
10 10 7 6 3 5 9 1 10 8 4 2 2 7 6 8 2 5 4 10 6 9 8 9 6 9 7 9 4 5 6 7 4 9 8 8 2 9 3 5 3 7 4 8 4 6 1 10 6 7 8 9
output:
0 2 0 0 0 0 2 0 1 0
result:
ok 10 lines
Test #2:
score: 4
Accepted
time: 20ms
memory: 34932kb
input:
10 10 3 6 8 10 7 9 4 1 5 2 1 10 2 8 1 9 4 9 5 7 6 10 2 2 5 5 7 9 5 8 2 6 3 5 1 1 4 8 4 9 1 5 5 8 4 7 8 10 5 8
output:
8 6 1 0 0 0 0 2 0 0
result:
ok 10 lines
Test #3:
score: 4
Accepted
time: 23ms
memory: 34412kb
input:
10 10 5 4 7 1 10 9 6 2 3 8 2 3 3 9 5 8 7 8 8 8 1 8 6 8 7 8 3 7 3 6 2 10 5 5 3 4 5 10 4 10 4 5 6 9 2 4 3 4 4 6
output:
1 0 0 0 0 0 0 0 1 0
result:
ok 10 lines
Test #4:
score: 4
Accepted
time: 35ms
memory: 38072kb
input:
3000 3000 275 74 2540 1606 1717 239 793 2424 1923 2498 2871 870 2448 1189 2987 2962 42 2216 2876 730 2139 1609 1380 1438 1616 1186 1213 1362 2904 1672 2271 2857 1163 2026 2333 2977 2497 2082 2819 1120 1932 1539 2798 2006 1389 539 2168 2676 2742 1316 2899 874 2453 2672 15 2143 1399 160 630 138 1483 545 1135 2888 2411 1259 252 2463 1516 2680 2671 2172 1996 1063 611 1208 402 1236 2760 292 1191 720 18 1918 1847 506 746 1501 1364 1632 2288 1725 677 1808 1463 1994 1489 301 1289 1216 942 1000 197 1949 ...
output:
150753 25868 290 124866 897067 724 0 70078 184626 0 6 156 46367 154700 115976 272420 23594 75019 9790 51 27446 1517 36710 4015 19999 14 55774 109476 2948 47562 48916 5857 71029 16843 73224 32910 90101 90 5664 342 130 368886 441 2063 169675 55810 35507 27901 278 5988 2193 11909 50642 1672 54247 25837 4093 609 22717 17812 0 97136 25468 0 58191 119597 38441 12441 0 520 4260 51792 48762 773 301345 24970 11063 43217 12848 21092 240 1521 85 516208 6939 453 20 2980 1642 1426 63 14343 12718 146036 14344...
result:
ok 3000 lines
Test #5:
score: 4
Accepted
time: 36ms
memory: 39048kb
input:
4000 4000 1813 3333 1943 2840 1554 1070 1167 2683 3987 229 1883 1490 1031 2800 3882 2316 2640 1411 2032 2675 2093 401 3534 3627 2982 143 1080 1259 771 658 306 1580 2154 3482 2984 3551 215 2009 170 3377 932 2335 1368 2788 1191 3006 3223 3060 3924 2075 372 481 797 295 3465 2079 714 3139 33 1524 457 1597 695 3445 778 1577 2424 2624 2056 547 1165 1561 2085 2317 1887 810 1781 3949 1822 877 2898 2738 2672 124 339 3248 902 2437 2713 1404 3336 1869 1834 1133 552 278 1207 987 2141 3358 1038 3829 479 3033...
output:
101368 695 338802 3587 16990 23 37325 433 59932 7569 87 236695 9292 625 214 43196 11570 73267 34835 8 43764 227721 5821 12737 14 2073 19379 2 1589 585 246196 39250 1085 77766 1860 31184 106892 5890 41848 3393 1713 21877 152927 42253 120551 365718 4 2525 66256 3323 2196 14786 2646 165 2349 183925 1026 54540 16105 18 956663 83 766 17436 110 130018 798 149298 16950 31731 47166 1260 705 303033 42 1225400 69581 5191 2934 164416 30433 73 15931 3672 30912 14367 5051 275273 45953 118465 16298 6769 21005...
result:
ok 4000 lines
Test #6:
score: 4
Accepted
time: 45ms
memory: 40332kb
input:
5000 5000 4584 3973 1352 4671 419 4060 2422 1887 1113 4149 3583 511 2168 3996 963 870 1871 1972 2974 3771 2725 2276 4578 194 4600 114 4297 1714 3530 3353 2904 4842 366 744 116 1785 3646 2473 1421 4245 1366 4483 1555 4595 1179 1394 3648 3066 4024 1935 2263 4237 4268 29 2148 4647 4515 2135 4131 4589 3314 2550 1592 4519 1091 1351 2752 537 3879 1597 437 1508 4178 3778 269 2029 3606 4758 3001 3821 984 3259 335 224 2751 1087 4693 4904 2047 425 3742 1389 729 1178 852 2295 2581 4358 2003 2905 2342 3654 ...
output:
4780 792 124699 64326 8561 164490 7301 24121 36709 32759 3204 249940 176215 134871 7241 65159 28557 1 0 9989 216642 2986 375 1406776 639 115857 14 23645 125671 4625 407343 131116 1390 1996578 5150 23 5959 6715 2562 250255 640 20942 6382 3134 6218 461 0 22 19913 35924 176308 4351 235171 30928 79 2003 8084 4546 0 283716 565523 13920 264792 127 6517 2612807 0 3612 569249 177 92621 303267 220227 9427 618062 43698 8093 746619 39457 1378526 132151 80657 25656 1443709 32 109651 774 50153 138041 97 3231...
result:
ok 5000 lines
Test #7:
score: 4
Accepted
time: 327ms
memory: 64660kb
input:
25000 50000 17933 12647 4126 561 20565 17721 3237 20956 23810 15182 1371 1964 19155 23873 16313 20143 23077 15413 14837 23101 15220 2217 22784 2221 17865 11528 9072 23426 15666 9562 23566 7278 11913 6636 10360 8741 13378 13274 515 17382 15017 11838 24731 10977 643 23193 24811 18852 20273 17879 16016 2687 19350 21046 5999 9646 13503 21097 17534 3154 20295 18642 10639 4204 12778 12748 20383 7613 11436 7956 7329 3663 16443 24542 18858 11635 4417 14698 14405 21719 19057 12693 3719 18039 10949 6132 2...
output:
4718718 63789917 38019203 3478646 10434678 8411216 16384465 3347278 1046457 117450666 10512079 65064601 1942523 36670336 14927967 64208380 1401054 45566293 352016 7364184 34900823 26854299 279153 29351592 2484422 39769235 21811702 21217156 8123867 2807588 41928739 6779645 47354518 107544652 25203384 6586078 6335730 6881435 52109346 134584598 50104025 68233493 709402 17486325 36706505 1258260 2667960 102298010 110932 23148 9817689 5950816 6445026 1466871 66818386 74313982 4522260 4536303 38547799...
result:
ok 50000 lines
Test #8:
score: 4
Accepted
time: 1013ms
memory: 95008kb
input:
50000 100000 34190 30883 11333 45339 39327 7782 31720 17826 49088 48395 26423 1963 15006 13296 31887 39411 41575 47505 26979 39758 29082 5053 35619 36746 28511 45672 37295 30506 46420 36833 48283 34088 32552 48561 22638 32469 22093 49328 21194 8280 24202 26909 49400 11332 12274 29937 15451 42485 48625 40526 12539 41329 7135 49558 23569 28473 22364 27197 48674 10768 39671 12751 48884 15848 7159 47074 18127 37140 47245 21859 43805 3255 27775 15349 34645 41742 31829 2701 47108 29824 1069 25636 3912...
output:
37863428 1295597 29943678 126664876 3911440 338059817 450026960 38777862 1118962 152246 24709849 163084008 10674162 430721 55211011 35929751 17199958 409346985 158519381 7285528 41865472 398734305 447907721 93208778 20852920 100855887 178457289 88021209 238975826 117706868 2673284 660447 171625695 2907387 31379725 4039474 157500505 266918238 316594969 119030242 172706036 10558195 14395448 214433346 6907938 403809041 43454747 6134438 210082031 54357840 119830577 98654888 347876278 88115242 599255...
result:
ok 100000 lines
Test #9:
score: 4
Accepted
time: 1737ms
memory: 126912kb
input:
75000 150000 30149 54180 3798 34212 67897 28067 50060 44816 38037 27530 70405 68069 16326 14256 66092 36541 72536 72996 63812 65847 23781 72137 39834 29700 11212 11156 41911 9140 57560 21211 39159 53063 71051 45303 39914 9566 32134 69835 24071 7055 58777 70053 69284 73900 53302 28963 74142 46429 7921 57247 74580 2049 33031 66344 70808 49530 71120 33854 72748 28363 68635 72456 45469 46157 64461 24247 43227 28140 39905 69717 57037 67924 18563 57002 61232 71569 69584 29184 22659 29735 34678 40762 7...
output:
174259304 3348579 28497163 339191113 39371728 185218292 33086871 70516557 976407591 41958758 160694969 22797960 570235465 27397379 410554 5620782 4203869 12694401 17246305 1715255 72166453 493948656 9647789 218033623 313880736 21022591 25608005 525294519 286016745 90693329 33580996 37515799 225538749 231484 985728 267864082 7528783 345095840 151637577 170460709 18716715 21863241 68131213 458618 80744141 375881876 194297475 354202237 123936601 83975952 103162790 93611537 38705910 30342246 1630598...
result:
ok 150000 lines
Test #10:
score: 4
Accepted
time: 2459ms
memory: 156776kb
input:
100000 200000 47534 82358 90198 90311 86971 78138 57685 92820 95572 82397 45779 74859 67319 89881 76297 71344 68227 55217 75262 94126 96422 87581 94223 87931 88679 42475 75545 30649 91491 96694 85088 94656 24494 69871 78199 69331 99352 18668 74574 78408 79693 61591 99297 49169 83870 93128 88383 69981 66151 86378 41034 94944 79342 98144 87274 94637 87689 11845 80770 73455 77935 36341 79522 73810 72379 94036 16027 53245 61241 99629 94638 66793 44659 48516 96784 99445 72890 98260 79623 14889 75593 ...
output:
602065448 735033221 1362516482 70624069 61374041 141022179 551054645 6086443 30209985 84950365 5406301 145290747 294740513 380446592 549845670 747200677 656638810 355813396 7569397 42291643 235788343 13866777 5764511 903571789 7281037 928447043 572529173 731423589 1579439 1883416560 1092532513 237637068 66217623 48531466 36036514 2536479 4709 752402 1122865244 283117404 187661568 102749847 343474835 2164968060 516138291 847111018 100952784 746319351 1108413727 693208094 279551479 1813174284 4810...
result:
ok 200000 lines
Test #11:
score: 4
Accepted
time: 278ms
memory: 102764kb
input:
60000 120000 55906 54576 34973 43550 27137 16914 48320 13154 45299 33624 22807 18737 45915 39093 25737 38507 198 31416 35416 59392 20151 4701 42665 52467 45908 27531 16407 38855 37382 19685 35572 43031 27903 49191 25509 17411 7293 20341 23414 34224 22012 28138 53083 57765 32612 44127 45575 45576 25765 20537 54927 16865 42795 35022 32885 51505 24884 56644 59183 34980 5711 17618 24912 56165 46177 8127 56786 33387 13735 45933 46870 14872 53629 28154 26760 36865 14165 39272 23720 14841 53272 59657 2...
output:
0 0 0 0 19 1 0 0 5 0 1378 4 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 421 0 0 0 0 0 0 0 127 0 0 0 1494 0 0 16 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 2 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 6 0 0 0 0 214 16 0 11 0 0 0 6899 3 0 0 0 0 0 2 1 0 0 9 0 0 0 0 0 0 0 0 0 0 0 13 0 0 0 9 0 0 0 0 0 0 1151 0 0 0 0 0 0 0 3 0 0 0 562 0 0 0 18 0 0 0 0 2 0 0 0 0 0 1265 0 0 0 1 0 0 0 0 0 47 0 0 0 0 0 36 32 0 0 7 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 527765 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 11 0 0 0 0 0 26 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0...
result:
ok 120000 lines
Test #12:
score: 4
Accepted
time: 371ms
memory: 126664kb
input:
80000 160000 10198 4604 1327 11423 66261 30105 42184 30866 47473 1330 31892 60909 62567 71904 12724 46276 28865 71787 44630 47976 76446 9910 75574 9540 69676 75531 10411 62125 70843 43627 44229 49730 45411 48262 35241 49880 20876 57304 3639 23968 6048 34167 59093 37783 50369 62696 31078 16927 47356 36606 1888 64961 65075 75786 65226 72527 69491 1129 67334 29855 69005 41456 74839 59811 20661 29360 34882 17530 35954 43714 22305 67705 78211 45585 79324 48479 35931 29835 24289 44623 62330 32330 6531...
output:
0 0 0 0 0 0 0 1 0 0 0 0 0 0 7 0 0 0 0 0 0 6 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 67 0 0 0 0 0 12 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 11 0 0 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 752 0 28 1 13383 0 0 0 0 0 0 0 0 0 0 1 0 0 0 6 0 0 0 22 0 0 0 0 24 0 0 0 0 3 0 0 0 0 0 0 1 0 4 0 796 0 0 0 0 0 0 0 0 0 0 0 0 11 0 0 0 0 0 0 1 0 0 0 0 0 0 8 0 0 0 0 7 0 0 0 0 2 0 0 0 0 24 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 184 0 0 0 0 0 0 0 41 0 0 0 0 0 3 0 0 40563 84 0 945 0 0 0 0 84 0 0 0 0 0 0 0 0...
result:
ok 160000 lines
Test #13:
score: 4
Accepted
time: 440ms
memory: 156128kb
input:
100000 200000 3001 2999 2754 2995 2994 4 2992 2990 2988 2987 2986 2984 2983 11801 13 14 15 2977 2976 16 88077 19 2973 2971 24674 53095 2969 2968 80415 22 2965 2964 2962 2960 2958 2957 2956 2955 2954 2951 28 29 30 33 34 35 2946 2945 36 38 39 2942 2941 42 44 45 2939 2938 17182 49 2934 2933 50 52 24901 54 2926 56 2925 2923 2922 57 84107 2921 2920 62 2917 63 2916 2915 64 65 20247 2912 87544 2909 98256 2906 69 71 34211 2901 72 59118 2900 2899 2897 74 2896 2895 76 77 2894 2892 78 2887 80 72892 39206 2...
output:
1420333 0 1420333 0 1420333 0 1420333 0 1417926 0 1415520 0 1415329 0 1415329 0 1415329 0 1415329 0 1415329 0 1415329 0 1412930 0 1410532 0 1410532 0 1410532 0 1410532 0 1410532 0 1410532 0 1410532 0 1410532 0 1410532 0 1408142 0 1408142 0 1408142 0 1408142 0 1408142 0 1405757 0 1405757 0 1405757 0 1405757 0 1405757 0 1403376 0 1400996 0 1398617 0 1396239 0 1396239 0 1393862 0 1393862 0 1391486 0 1391486 0 1391486 0 1389113 0 1389113 0 1386741 0 1386741 0 1384371 0 1382002 0 1382002 0 1379635 0 ...
result:
ok 200000 lines
Test #14:
score: 4
Accepted
time: 139ms
memory: 57844kb
input:
20000 19260 8075 16966 10721 18323 13760 16546 8500 4931 2710 4070 4939 3934 442 16813 2702 6006 12079 19539 6984 5646 3024 15789 4508 11676 15036 16563 824 10150 18948 6418 6421 9916 11984 11580 17053 683 14236 17896 11307 4769 10225 19109 15416 16258 14897 5795 14886 13848 2561 7846 13555 2988 15080 7798 4561 19043 3748 15153 17146 9213 10814 3123 10904 3516 15052 14784 8839 13183 15270 13961 16594 13352 8812 1845 12822 2058 8837 5513 12204 13897 9287 15626 3028 14701 5056 16666 13484 17473 16...
output:
73953667 77869923 81007411 78560413 81152054 73424881 75246642 77194299 73895423 73931218 75549782 81405290 76740635 72321985 82655727 86665639 76896933 76614731 75254280 76841820 80663242 83856274 86414220 88835620 75559849 77274841 78020378 71502558 79346696 93181550 73222310 83916497 70693808 84422505 78955786 86972108 73363565 71145100 76304612 79407271 76172725 74929096 80547790 88688628 77734149 82632051 75859006 80647551 80051573 81393009 83242195 74131405 74126768 78929965 71163738 71579...
result:
ok 19260 lines
Test #15:
score: 4
Accepted
time: 461ms
memory: 73880kb
input:
30000 60000 18100 17984 29616 26532 16351 25306 28940 17968 12149 21623 10913 25728 7504 1694 18649 20697 12374 28510 28482 24090 23186 26948 24342 8516 28375 24474 26716 10580 18582 25290 29675 5255 22335 21818 28936 918 11068 8231 14805 25816 29904 26304 12336 12440 28867 27898 20999 18451 17788 10485 22697 12260 23838 20524 18822 9097 9758 15681 1678 8809 28309 27361 27546 13466 11031 19499 16251 4173 28602 21526 7143 7984 9189 23073 24922 27235 29562 23881 3539 7596 16380 22255 14823 9919 19...
output:
5616635 268767 67149 33831788 24760 5654768 135868 3952186 33516 34593746 748958 628513 6333725 2000117 2050974 96427 865572 15180825 42188 1025674 5064786 4930417 9418480 5267 68563477 225104 17384 1891957 175658 2589505 99923 17289 67815 45448 3736168 890908 32179606 5167265 210433 4716038 187108 831407 241024 224490 13 136110 1032634 38291488 8664759 12535 192992 2997731 251435 3440 4408974 50395240 4384532 46384036 6140523 1005482 4437404 21303 918716 33190624 15861182 894818 30578793 193651...
result:
ok 60000 lines
Test #16:
score: 4
Accepted
time: 629ms
memory: 87836kb
input:
40000 80000 6155 33310 18982 32436 23117 11936 23625 36826 24896 18185 2373 31232 5057 20465 18997 36213 39297 32273 32461 29674 18962 13728 30106 33069 4625 35639 28937 32955 36807 31210 12487 33040 26415 13758 38447 20070 16135 32305 34756 22396 24672 32400 28184 22671 5895 5628 7054 27520 28612 17575 28577 22882 10320 29251 12269 2639 34073 19065 10368 15161 37847 18857 2307 5337 2360 3052 39408 30766 27466 8761 9973 20901 27473 7907 32875 39070 28899 36499 19996 39805 32937 29857 30335 7016 ...
output:
2482912 3989810 2769849 61327113 1941 430688 2265362 13734472 841573 876749 1964893 1871085 58135 341014 1283806 251147 336822 1881637 1759 55220 54636306 89273293 3507762 150 481259 60713662 29805710 528588 28797 15556420 152834 3031161 6281519 3447319 3484 1007874 12024770 45238668 111546 63461564 1851094 26320676 12577 482420 168809 397985 109717710 57699 466833 3718929 70456 24414923 7274638 339485 73975 4248971 664837 17544443 1372613 7798 391417 19021576 1026337 21377223 4094565 900687 178...
result:
ok 80000 lines
Test #17:
score: 4
Accepted
time: 847ms
memory: 100004kb
input:
50000 100000 38469 24525 32217 24789 47311 24293 3571 14829 26717 913 21309 8308 37327 8734 17912 43870 48997 10733 2270 26728 7330 16464 40796 11288 47560 48672 46090 18389 25933 46137 41744 48976 38039 41118 38084 40612 47921 45345 45410 48851 31754 38299 27413 23608 24009 31513 40500 49878 8252 41404 10073 44759 40975 29382 14301 8736 22798 18831 39004 25940 45829 25764 24499 46445 30254 2959 8009 39980 32017 33722 7545 36390 16953 24470 36167 38406 4417 20377 47356 48620 31491 45425 31704 13...
output:
12576436 0 32713667 0 0 8600646 0 0 1 3392613 112442 1363510 1837462 16730090 15496184 0 8376293 47519 13815 136015 11128838 0 19206597 593088 219225916 93028559 108768 127361 2147519 7752211 8651523 1394136 2020729 94978224 175434 140061 6946246 10979281 9030509 15007149 355416 0 16729298 781478 161567 274177 208721980 8429405 87800637 8419673 0 3039752 0 0 0 30599 34120 10538685 12038451 24389262 1323059 1422708 442945 914095 40639430 23673627 187319 141320 974930 23216067 2331248 0 5715172 12...
result:
ok 100000 lines
Test #18:
score: 4
Accepted
time: 1048ms
memory: 112812kb
input:
60000 120000 28929 27272 6259 45423 15780 40321 15580 4868 47291 3546 27936 45710 20567 26606 30216 52113 50838 55739 49818 56542 31288 49488 50806 8957 57695 52604 58066 14076 38002 58344 26180 36232 22180 32879 34138 51711 34760 25593 43389 31396 51616 13814 58547 40038 55058 48403 34408 25186 51758 51633 46917 54195 34534 51882 3135 54265 44453 58535 55529 47804 23505 30184 55140 53148 58718 49981 54401 58710 32518 31597 26819 41898 43874 53161 53203 52648 30592 59863 45483 23038 41353 46772 ...
output:
40147837 0 51566690 0 0 13220254 0 0 0 4030325 31586 1057561 4122040 22338675 28401522 148717 12477764 25267590 123865 106476 18079642 0 230 269436 279649802 8146344 119074 21619 3802353 20191494 9412057 3069672 6894123 15496172 359109 299071 1553726 432529 16596413 22834900 108266 0 26402289 689929 107443 17134533 241467267 8716225 125267174 3250690 0 5119642 0 0 0 140221 49935 17765669 5003551 30572215 1917300 3361783 33365615 440462 60300176 32346478 322748 267159 1671454 29233449 4313080 0 2...
result:
ok 120000 lines
Test #19:
score: 4
Accepted
time: 1216ms
memory: 128896kb
input:
70000 140000 52924 17320 66317 8157 30299 14111 65609 39835 21071 62191 51780 53198 44998 54574 66213 14371 58818 68483 39851 47765 42611 69393 63471 60519 9205 11577 69131 61430 13885 29809 66714 44006 62051 58921 12599 53974 40692 64816 36682 3519 24905 52640 10114 68493 49109 41844 48600 66776 38530 43368 68225 47665 39460 12930 15851 54200 53240 49585 38072 53279 9993 65792 40980 33223 65371 53712 68512 5776 25826 37274 27288 49034 42729 41421 28791 47925 16153 33387 31043 26099 2945 14018 4...
output:
0 71168260 0 0 10568172 0 0 0 6088047 113 1148444 9325891 37773605 47103219 241450 20159460 193961 772110 51361 31312522 0 351128607 737922 338220816 26600575 196883 0 4841669 34708647 10142188 4411511 4894816 17480487 186770 59261234 14598820 31761435 22231195 24858756 747914 0 45723576 871925 132151 50222973 335109510 11765312 138918623 1853971 0 6110844 0 0 0 108982 54493 23239996 39431003 50096417 1755375 5516620 35571674 76258 63216768 46040109 314730 6262616 2323263 41177179 4175026 0 3238...
result:
ok 140000 lines
Test #20:
score: 4
Accepted
time: 978ms
memory: 164944kb
input:
100000 200000 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 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 14...
output:
0 137721903 0 0 194133638 44250527 0 4471544 910129753 72771 176917433 310465818 0 3496690 0 0 0 124875303 174237759 1814217937 123048818 0 33670 1044085030 0 0 0 2362051 199071076 0 15045346 164103768 0 0 190876473 60538504 0 29571894 0 27261 47838862 116403 15576 0 0 0 194015430 0 1006680857 53301 105582243 120551625 0 9686601 7282835 1360254532 700336 20234340 134997078 53380260 1407003 197796089 239356238 25436278 7775596 216476005 682696 127544387 0 15733236 0 8341570 0 0 5237466 177425701 ...
result:
ok 200000 lines
Test #21:
score: 4
Accepted
time: 938ms
memory: 165792kb
input:
100000 200000 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 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 14...
output:
135243672 445436620 105771238 3638253 341558310 7938114 139152881 0 1657814543 0 491865906 11165173 0 271899527 33166438 207173180 0 44514328 0 989969225 13382550 33837649 0 877993543 0 606163955 315595119 5552778 1059725674 0 566649265 0 0 81032803 51577245 0 549610411 0 14680052 303084497 0 0 432988871 162838068 265432317 8588440 472581387 0 364783532 157641 478811961 1810786077 195317728 171374819 1708990381 23171027 51323643 0 6762002 177972402 64382876 32236415 597110393 0 0 0 395604 243040...
result:
ok 200000 lines
Test #22:
score: 4
Accepted
time: 957ms
memory: 165504kb
input:
100000 200000 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 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 121 120 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 14...
output:
0 0 1203662559 0 0 96445210 1 0 0 0 0 125666725 0 306145130 2922153 0 295986605 2476425 2122830 0 278468190 0 2025756693 18274033 2207169989 765089386 0 0 47516622 846188073 44495457 0 0 133179354 0 0 0 0 0 295524505 17431558 1 218812731 57926462 57636211 298620131 2486781990 212891284 1027291106 0 0 72896768 1277601 0 0 0 0 138569619 0 428820243 163651180 154027568 30011876 0 851255673 674491342 0 0 0 762509810 100146621 5299138 0 0 0 64598656 0 0 305156150 106791799 0 0 0 785962112 2195889553 ...
result:
ok 200000 lines
Test #23:
score: 4
Accepted
time: 1793ms
memory: 159540kb
input:
95000 190000 54869 89685 84021 77335 29643 94178 67158 60183 31735 63706 79776 89995 89643 62925 35391 76241 81318 59689 94539 42088 29258 71464 41104 76091 24922 72978 89700 92047 64960 12525 70519 82967 85527 88068 85048 89273 19561 66101 53150 88863 43065 94970 41214 71260 82429 52175 75847 14693 94497 70798 73241 93047 91046 48410 67940 66488 442 85983 76035 1442 73183 62607 21206 75433 66927 79991 82374 85433 54160 80910 57504 90940 51050 85122 84313 94218 65849 77248 39382 73119 61756 1870...
output:
47 30689895 267124620 78216351 63087704 3333976 41526889 584018017 728108 597788 109571 35350 70304877 133574783 5943297 1476137 255079616 19002613 387858933 29 93586621 3301382 41269247 115240 1 13810 1553857 62095869 542821361 5191367 73253734 781863 4662341 7695371 23650076 138362 52849 0 104351 113049 117643194 38 71684517 0 993380 265047216 10025783 1738 160590361 259 971764 279925 59464356 33360412 0 105061364 54095386 209219 58681731 14586838 158975390 347254 1414611 2441293 47769407 8667...
result:
ok 190000 lines
Test #24:
score: 4
Accepted
time: 1831ms
memory: 166396kb
input:
100000 200000 85963 54232 81192 62832 86584 80503 31766 74547 68821 73102 73096 72267 89495 33829 99520 43962 54837 89342 84555 71099 98465 64321 69793 39525 70934 87510 76927 85543 80068 25394 93361 4064 75959 51666 98914 15652 80946 90768 98387 88616 95082 44075 76628 84428 90891 63623 85280 43215 12888 71512 85062 58672 11091 76687 71731 85274 95627 73632 93059 68396 73599 92246 99091 67156 39234 98572 74933 89666 72662 80974 25802 68108 77335 55067 82685 75240 86857 90627 60129 77802 56348 6...
output:
36093846 0 1675690837 31114627 2140378 1050874940 0 1 94607712 4946271 0 28697963 214972326 0 0 0 6207822 35627739 397699411 8002461 696467 17655604 26094681 19639152 54935823 511379 7809617 2271102 325946 81249458 2863 6973334 0 9284653 740101920 1862135 20401 6705308 1283407 71418076 6748091 75138523 0 620439 0 0 0 634709 0 20167900 2734425 80127807 2510995 0 8694147 147299756 3625502 546456536 0 589134 116994753 0 47819350 38865024 23319206 0 0 735818272 0 4173700 132566 407992136 0 0 2109345...
result:
ok 200000 lines
Test #25:
score: 4
Accepted
time: 1862ms
memory: 164020kb
input:
100000 200000 90787 49393 38459 68555 92570 80827 83843 39871 57205 59948 85227 96519 94578 78479 78947 89776 58887 21176 89863 99298 44414 29776 25867 88717 53798 75196 76719 87201 71049 86356 44186 47657 77140 74621 90681 81634 99004 97417 67801 73807 30440 47271 98457 50945 68642 92999 98340 99414 14611 87733 87862 70270 94594 83525 96330 98551 46317 44334 95906 63245 84077 94541 86172 18146 39811 82927 2883 78497 43030 42911 21250 28569 61777 67803 95170 49645 76736 77995 68090 92805 77398 4...
output:
0 0 608987425 0 0 3909175 6819715 38000652 0 1008098686 0 7696064 7708109 38712 15755716 0 41430219 0 0 576312728 76467695 0 74246325 2493471 8151930 735782171 7204 0 57952877 442383283 4287677 0 1202139 60051291 0 0 18671099 24659536 35333040 22872720 1002187 1 97724144 1929567 5774836 148319839 728379640 26954831 247162260 9795797 0 22492899 0 0 0 0 0 90257 59507887 71062282 0 0 59688137 0 172394575 237911117 0 0 143236557 145875733 9039238 0 532686 49010483 0 1053433 968247 0 5086327 45009340...
result:
ok 200000 lines
Extra Test:
score: 0
Extra Test Passed