QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#152738 | #440. 时代的眼泪 | hos_lyric | 100 ✓ | 3387ms | 898080kb | C++14 | 7.9kb | 2023-08-28 19:02:27 | 2023-08-28 19:02:28 |
Judging History
answer
#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
using Int = long long;
template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << "(" << a.first << ", " << a.second << ")"; };
template <class T> ostream &operator<<(ostream &os, const vector<T> &as) { const int sz = as.size(); os << "["; for (int i = 0; i < sz; ++i) { if (i >= 256) { os << ", ..."; break; } if (i > 0) { os << ", "; } os << as[i]; } return os << "]"; }
template <class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << " "; cerr << endl; }
template <class T> bool chmin(T &t, const T &f) { if (t > f) { t = f; return true; } return false; }
template <class T> bool chmax(T &t, const T &f) { if (t < f) { t = f; return true; } return false; }
#ifdef LOCAL_
constexpr int MAX_N = 100;
constexpr int B = 3;
constexpr int MAX_A = MAX_N / B;
#else
constexpr int MAX_N = 100'000;
constexpr int B = 400;
constexpr int MAX_A = MAX_N / B;
#endif
int N, A;
vector<int> P, invP;
#define P do_not_use_P
#define invP do_not_use_invP
struct Solver {
vector<int> ps;
int cntLess[MAX_A + 1][MAX_N + 1];
int inside[MAX_A + 1][B + 1][B + 1];
int section[MAX_A + 1][MAX_N + 1];
void build(const vector<int> &ps_) {
ps = ps_;
for (int a = 0; a <= A; ++a) {
const int len = min(B, N - a * B);
fill(cntLess[a], cntLess[a] + (N + 1), 0);
for (int b = 0; b < len; ++b) {
++cntLess[a][ps[a * B + b] + 1];
}
for (int y = 0; y < N; ++y) {
cntLess[a][y + 1] += cntLess[a][y];
}
for (int b = 0; b < len; ++b) {
copy(inside[a][b], inside[a][b] + (B + 1), inside[a][b + 1]);
for (int e = cntLess[a][ps[a * B + b]] + 1; e <= B; ++e) {
++inside[a][b + 1][e];
}
}
}
for (int a = 0; a < A; ++a) {
for (int y = 0; y <= N; ++y) {
section[a + 1][y] = section[a][y] + cntLess[a][y];
}
}
}
Int calcInside(int a, int b0, int b1, int y0, int y1) const {
assert(0 <= a); assert(a <= A);
assert(0 <= b0); assert(b0 <= b1); assert(b1 <= min(B, N - a * B));
Int ret = 0;
for (int b = b0; b < b1; ++b) {
const int y = ps[a * B + b];
if (y0 <= y && y < y1) {
// [a B + b0, a B + b) * [y0, y)
const int e0 = cntLess[a][y0];
const int e = cntLess[a][y];
ret += (inside[a][b][e] - inside[a][b][e0] - inside[a][b0][e] + inside[a][b0][e0]);
}
}
return ret;
}
Int calc(int x0, int x1, int y0, int y1) const {
assert(0 <= x0); assert(x0 <= x1); assert(x1 <= N);
const int a0 = x0 / B + 1;
const int a1 = x1 / B;
Int ret = 0;
if (a0 <= a1) {
// left, left
ret += calcInside(a0 - 1, x0 - (a0 - 1) * B, B, y0, y1);
// left, block
for (int x = x0; x < a0 * B; ++x) if (y0 <= ps[x] && ps[x] < y1) {
// [a0 B, a1 B) * (ps[x], y1)
ret += (section[a1][y1] - section[a1][ps[x] + 1] - section[a0][y1] + section[a0][ps[x] + 1]);
}
// left, right
for (int x = a1 * B; x < x1; ++x) if (y0 <= ps[x] && ps[x] < y1) {
// [x0, a0 B) * [y0, ps[x])
const int b0 = x0 - (a0 - 1) * B;
const int e0 = cntLess[a0 - 1][y0];
const int e = cntLess[a0 - 1][ps[x]];
ret += (inside[a0 - 1][B][e] - inside[a0 - 1][B][e0] - inside[a0 - 1][b0][e] + inside[a0 - 1][b0][e0]);
}
// block, block: ignore
// block, right
for (int x = a1 * B; x < x1; ++x) if (y0 <= ps[x] && ps[x] < y1) {
// [a0 B, a1 B) * [y0, ps[x])
ret += (section[a1][ps[x]] - section[a1][y0] - section[a0][ps[x]] + section[a0][y0]);
}
// right, right
ret += calcInside(a1, 0, x1 - a1 * B, y0, y1);
} else {
ret += calcInside(a1, x0 - a1 * B, x1 - a1 * B, y0, y1);
}
return ret;
}
};
Solver solverP, solverInvP;
#undef P
#undef invP
Int f[MAX_A + 1][MAX_A + 1][MAX_A + 1];
int g[MAX_A + 1][MAX_A + 1][MAX_A + 1];
void build() {
invP.assign(N, -1);
for (int x = 0; x < N; ++x) invP[P[x]] = x;
A = N / B;
solverP.build(P);
solverInvP.build(invP);
vector<int> cs(N);
for (int x = 0; x < N; ++x) cs[x] = P[x] / B;
// f[a0][a1][c]: inside [a0 B, a1 B) * [0, c B)
for (int a0 = 0; a0 < A; ++a0) {
for (int a = a0; a < A; ++a) {
fill(f[a0][a + 1], f[a0][a + 1] + (A + 1), 0);
for (int b = 0; b < B; ++b) {
const int y = P[a * B + b];
const int c = cs[a * B + b];
// [a0 B, a B) * [0, y)
f[a0][a + 1][c + 1] += (solverP.section[a][y] - solverP.section[a0][y]);
// [a B, a B + b) * [0, y)
f[a0][a + 1][c + 1] += solverP.inside[a][b][solverP.cntLess[a][y]];
}
for (int c = 0; c < A; ++c) {
f[a0][a + 1][c + 1] += f[a0][a + 1][c];
}
for (int c = 0; c < A; ++c) {
f[a0][a + 1][c + 1] += f[a0][a][c + 1];
}
}
}
// g[a][c0][c1]: [a B, (a+1) B) * [0, c0 B) vs [a B, (a+1) B) * [c0 B, c1 B)
for (int a = 0; a < A; ++a) {
for (int c0 = 0; c0 < A; ++c0) {
fill(g[a][c0] + c0, g[a][c0] + (A + 1), 0);
for (int b = 0; b < B; ++b) {
const int c = cs[a * B + b];
if (c0 <= c) {
g[a][c0][c + 1] += solverP.inside[a][b][solverP.cntLess[a][c0 * B]];
}
}
for (int c = c0; c < A; ++c) {
g[a][c0][c + 1] += g[a][c0][c];
}
}
}
}
Int calc(int x0, int x1, int y0, int y1) {
assert(0 <= x0); assert(x0 <= x1); assert(x1 <= N);
assert(0 <= y0); assert(y0 <= y1); assert(y1 <= N);
Int ret = 0;
ret += solverP.calc(x0, x1, y0, y1);
const int a0 = x0 / B + 1;
const int a1 = x1 / B;
#define x0 do_not_use_x0
#define x1 do_not_use_x1
if (a0 < a1) {
ret += solverInvP.calc(y0, y1, a0 * B, a1 * B);
const int c0 = y0 / B + 1;
const int c1 = y1 / B;
#define y0 do_not_use_y0
#define y1 do_not_use_y1
if (c0 < c1) {
ret += f[a0][a1][c1];
ret -= f[a0][a1][c0];
for (int a = a0; a < a1; ++a) {
ret -= g[a][c0][c1];
}
for (int a = a0; a < a1; ++a) {
// [a B, (a+1) B) * [0, c0 B) vs [(a+1) B, a1 B) * [c0 B, c1 B)
ret -= (Int)(solverP.section[a + 1][c0 * B] - solverP.section[a][c0 * B]) *
(Int)(solverP.section[a1][c1 * B] - solverP.section[a1][c0 * B] - solverP.section[a + 1][c1 * B] + solverP.section[a + 1][c0 * B]);
}
}
}
return ret;
}
#undef x0
#undef x1
#undef y0
#undef y1
int main() {
int Q;
for (; ~scanf("%d%d", &N, &Q); ) {
P.resize(N);
for (int x = 0; x < N; ++x) {
scanf("%d", &P[x]);
--P[x];
}
build();
#ifdef LOCAL
if(N<=10){
for(int x0=0;x0<=N;++x0)for(int x1=x0;x1<=N;++x1)
for(int y0=0;y0<=N;++y0)for(int y1=y0;y1<=N;++y1)
{
Int brt=0;
{
const int a0=x0/B+1;
const int a1=x1/B;
const int c0=y0/B+1;
const int c1=y1/B;
for(int x2=x0;x2<x1;++x2)for(int x3=x2+1;x3<x1;++x3)if(y0<=P[x2]&&P[x2]<P[x3]&&P[x3]<y1){
// if(x2<a0*B||a1*B<=x3)++brt;
// if(x2<a0*B||a1*B<=x3||P[x2]<c0*B||c1*B<=P[x3])++brt;
++brt;
}
}
const Int ans=calc(x0,x1,y0,y1);
if(brt!=ans)cerr<<P<<" ["<<x0<<", "<<x1<<") * ["<<y0<<", "<<y1<<"): "<<brt<<" "<<ans<<endl;
assert(brt==ans);
}
}
#endif
for (int q = 0; q < Q; ++q) {
int x0, x1, y0, y1;
scanf("%d%d%d%d", &x0, &x1, &y0, &y1);
--x0;
--y0;
const Int ans = calc(x0, x1, y0, y1);
printf("%lld\n", ans);
}
}
return 0;
}
詳細信息
Test #1:
score: 4
Accepted
time: 2ms
memory: 7852kb
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: 0ms
memory: 7772kb
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: 0ms
memory: 7784kb
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: 19ms
memory: 31120kb
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 5...
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...
result:
ok 3000 lines
Test #5:
score: 4
Accepted
time: 30ms
memory: 47240kb
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 15...
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 102...
result:
ok 4000 lines
Test #6:
score: 4
Accepted
time: 42ms
memory: 56068kb
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 3...
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...
result:
ok 5000 lines
Test #7:
score: 4
Accepted
time: 582ms
memory: 233856kb
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...
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...
result:
ok 50000 lines
Test #8:
score: 4
Accepted
time: 1238ms
memory: 458480kb
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 486...
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 2...
result:
ok 100000 lines
Test #9:
score: 4
Accepted
time: 2365ms
memory: 682604kb
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 792...
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 22553874...
result:
ok 150000 lines
Test #10:
score: 4
Accepted
time: 3154ms
memory: 897684kb
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 6998...
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 23763...
result:
ok 200000 lines
Test #11:
score: 4
Accepted
time: 301ms
memory: 545584kb
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 257...
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...
result:
ok 120000 lines
Test #12:
score: 4
Accepted
time: 441ms
memory: 726220kb
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 ...
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 ...
result:
ok 160000 lines
Test #13:
score: 4
Accepted
time: 514ms
memory: 897336kb
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...
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 ...
result:
ok 200000 lines
Test #14:
score: 4
Accepted
time: 159ms
memory: 193252kb
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 150...
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 844...
result:
ok 19260 lines
Test #15:
score: 4
Accepted
time: 768ms
memory: 280176kb
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 1...
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 ...
result:
ok 60000 lines
Test #16:
score: 4
Accepted
time: 1115ms
memory: 368160kb
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 1...
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...
result:
ok 80000 lines
Test #17:
score: 4
Accepted
time: 1417ms
memory: 457368kb
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 4...
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 16...
result:
ok 100000 lines
Test #18:
score: 4
Accepted
time: 1823ms
memory: 546660kb
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 517...
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...
result:
ok 120000 lines
Test #19:
score: 4
Accepted
time: 2104ms
memory: 634124kb
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 38...
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 1321...
result:
ok 140000 lines
Test #20:
score: 4
Accepted
time: 1244ms
memory: 898048kb
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 9...
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...
result:
ok 200000 lines
Test #21:
score: 4
Accepted
time: 1232ms
memory: 896916kb
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 9...
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 4329...
result:
ok 200000 lines
Test #22:
score: 4
Accepted
time: 1226ms
memory: 898048kb
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 9...
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 ...
result:
ok 200000 lines
Test #23:
score: 4
Accepted
time: 3218ms
memory: 862196kb
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...
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 ...
result:
ok 190000 lines
Test #24:
score: 4
Accepted
time: 3244ms
memory: 897344kb
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...
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 75138...
result:
ok 200000 lines
Test #25:
score: 4
Accepted
time: 3387ms
memory: 898080kb
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 9941...
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 72...
result:
ok 200000 lines
Extra Test:
score: 0
Extra Test Passed