ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#199776 | #2244. 优化 | UperFicial | 100 | 37278ms | 50116kb | C++11 | 3.9kb | 2023-12-21 08:20:26 | 2023-12-21 12:00:36 |
answer
#include <bits/stdc++.h>
#define eb emplace_back
#define in read<int>()
#define rep(i, x, y) for(int i = (x); i <= (y); i++)
#define per(i, x, y) for(int i = (x); i >= (y); i--)
using namespace std;
using ll = long long;
using pii = pair < int, int >;
using vec = vector < int >;
using veg = vector < pii >;
template < typename T > T read() {
T x = 0; bool f = 0; char ch = getchar();
while(!isdigit(ch)) f |= ch == '-', ch = getchar();
while(isdigit(ch)) x = x * 10 + (ch ^ 48), ch = getchar();
return f ? -x : x;
}
const int N = 5e4 + 10;
const int inf = 0x3f3f3f3f;
vec pot[N << 2][2][2];
int pos[N << 2][2][2], n, m, a[N];
void merge(const vec &a, const vec &b, vec &c) {
const int *ia = a.data() + 1, *ib = b.data() + 1, *ea = a.data() + a.size(), *eb = b.data() + b.size();
c.resize(a.size() + b.size() - 1);
int *ic = c.data(); int ca = a[0], cb = b[0];
while(ia != ea || ib != eb) {
*ic = ca == -inf || cb == -inf ? -inf : ca + cb; ic++;
if(ia != ea && (ib == eb || *ia - ca > *ib - cb)) ca = *ia, ia++;
else cb = *ib, ib++;
} *ic = ca == -inf || cb == -inf ? -inf : ca + cb;
}
void shift(const vec &a, vec &b) {
rep(i, 1, a.size() - 1) b[i - 1] = max(a[i], b[i - 1]);
} vec ret;
void build(int o = 1, int l = 1, int r = n) {
if(l == r) {
pot[o][0][1] = pot[o][1][0] = pot[o][1][1] = { -inf, a[l] };
pot[o][0][0] = { 0, a[l] }; return;
} int mid = l + r >> 1; build(o << 1, l, mid); build(o << 1 | 1, mid + 1, r);
rep(x, 0, 1) rep(y, 0, 1) {
merge(pot[o << 1][x][0], pot[o << 1 | 1][0][y], pot[o][x][y]);
merge(pot[o << 1][x][1], pot[o << 1 | 1][1][y], ret);
shift(ret, pot[o][x][y]);
//cerr << pot[o][x][y].size() << endl;
}
}
ll ares[2], atot[2], tk;
ll nres[2], ntot[2];
void ask(int xl, int xr, int o = 1, int l = 1, int r = n) {
if(xl <= l && r <= xr) {
nres[0] = nres[1] = -0x3f3f3f3f3f3f3f3f; ntot[0] = ntot[1] = 0;
rep(x, 0, 1) rep(y, 0, 1) {
int &pos = ::pos[o][x][y]; //cerr << pos << endl;
while(pos + 1 < pot[o][x][y].size() && pot[o][x][y][pos + 1] - pot[o][x][y][pos] > tk) pos++;
//cerr << pos << endl; cerr << pot[o][x][y].size() << endl;
if(pot[o][x][y][pos] == -inf) continue;
ll val = pot[o][x][y][pos] - (pos - (x == 1)) * tk + ares[x];
if(val > nres[y] || (val == nres[y] && pos + atot[x] - (x == 1) <= ntot[y]))
ntot[y] = pos + atot[x] - (x == 1),
nres[y] = val;
} ares[0] = nres[0]; ares[1] = nres[1]; atot[0] = ntot[0]; atot[1] = ntot[1];
return;
} int mid = l + r >> 1;
if(xl <= mid) ask(xl, xr, o << 1, l, mid); if(xr > mid) ask(xl, xr, o << 1 | 1, mid + 1, r);
}
int tid, nid;
int cl[N], cr[N], nl[N], nr[N];
int l[N], r[N], K[N], ctot[N];
ll ans[N];
vec vp[N], np[N];
int main() {
n=in;n = in, m = in; rep(i, 1, n) a[i] = in; rep(i, 1, m) l[i] = in, r[i] = in, K[i] = in, vp[1].eb(i);
build(); tid = 1; cl[1] = - 100 * N; cr[1] = 100 * N;
while(tid) {
nid = 0;
rep(i, 1, n << 2) pos[i][0][0] = pos[i][0][1] = pos[i][1][0] = pos[i][1][1] = 0;
per(i, tid, 1) {
if(cl[i] == cr[i]) {
for(auto v : vp[i]) {
ares[0] = 0; ares[1] = -0x3f3f3f3f3f3f3f3f; atot[0] = atot[1] = 0;
tk = cl[i]; ask(l[v], r[v]); ans[v] = ares[0] + tk * K[v];
} vp[i].clear();
} else {
for(auto v : vp[i]) {
tk = cl[i] + cr[i] >> 1;
ares[0] = 0; ares[1] = -0x3f3f3f3f3f3f3f3f; atot[0] = atot[1] = 0;
ask(l[v], r[v]); ctot[v] = atot[0];
}
}
}
rep(i, 1, tid) if(vp[i].size()) {
tk = (cl[i] + cr[i]) >> 1;
vec pot1, pot2;
for(auto v : vp[i]) {
if(ctot[v] > K[v]) pot2.eb(v);
else pot1.eb(v);
} vec().swap(vp[i]);
if(pot1.size()) np[++nid] = pot1, nl[nid] = cl[i], nr[nid] = tk;
if(pot2.size()) np[++nid] = pot2, nl[nid] = tk + 1, nr[nid] = cr[i];
}
rep(i, 1, nid) vp[i] = np[i], vec().swap(np[i]), cl[i] = nl[i], cr[i] = nr[i];
tid = nid;
} rep(i, 1, m) printf("%lld\n", ans[i]);
return 0;
}
详细
小提示:点击横条可展开更详细的信息
Subtask #1:
score: 15
Accepted
Test #1:
score: 15
Accepted
time: 3ms
memory: 22372kb
input:
1 50 50 3 -6 8 -4 1 -3 9 -1 9 -4 10 -7 7 -6 2 -1 4 -8 1 -6 5 -7 5 -4 7 -9 8 -2 2 -6 1 -2 7 -3 1 -10 ...
output:
11 67 31 27 4 6 63 15 80 2 -1 20 0 -10 20 60 39 17 11 14 44 32 32 38 4 22 -2 27 1 18 25 0 39 15 -1 2...
result:
ok 50 lines
Test #2:
score: 0
Accepted
time: 10ms
memory: 22368kb
input:
1 50 50 -273 683 -3688 1 30 9996 624 9748 -4247 604 2 7 -3 -7 -3 -2 9229 -876 9 -10 4 31 -646 -8 -43...
output:
-11109 804 22365 25979 2769 20427 3285 2468 2468 24487 30285 844 9273 20447 10 9278 54 30225 10077 2...
result:
ok 50 lines
Test #3:
score: 0
Accepted
time: 3ms
memory: 22368kb
input:
1 50 50 -2 -7 8 10 -3 -9 -9 3 -3 -4 -3 8 -6 2 6 1 -2 7 -2 5 4 7 10 2 -9 9 -7 1 -10 5 -9 4 6 -8 4 10 ...
output:
-6 2 9 16 29 33 67 85 57 42 93 25 16 35 12 107 75 34 72 83 26 -10 67 64 15 14 12 6 42 61 10 13 88 94...
result:
ok 50 lines
Test #4:
score: 0
Accepted
time: 0ms
memory: 22368kb
input:
1 50 50 2 -4 5 -1821 10 -30 15 -15 2 -12 16 -14 16 -4 4 -10 9 -2 6 -3 17 -4 52 -5 15 -5 117 -11 6 -6...
output:
362 16 259 -5 203 36 -1834 63 214 99 292 60 10 245 338 84 103 237 26 235 51 53 91 58 326 207 -1851 2...
result:
ok 50 lines
Test #5:
score: 0
Accepted
time: 3ms
memory: 22372kb
input:
1 50 50 -193 -8 3 -8 91 -7 -1 -4 18 7 49 -9 11 -6 -34 4 -20 2 7 -11 -1 8 -7 9 50 -17 5 -76 5 18 3 1 ...
output:
156 164 142 60 27 178 157 75 92 -23 59 86 18 72 27 -15 76 25 260 166 149 77 -4 93 287 167 12 125 90 ...
result:
ok 50 lines
Test #6:
score: 0
Accepted
time: 3ms
memory: 22372kb
input:
1 50 50 7 -2 27 -56 3 -93 2 -150 17 -7 49 -34 3 -1057 5 -4 864 -23 5 -179 5 -7 8 -1 10 -940 7 -98 35...
output:
3 17 4867 -23 955 1149 -123 -1842 -865 1078 3624 1063 1129 380 4757 3699 3831 -55 3602 16 1124 30 -1...
result:
ok 50 lines
Test #7:
score: 0
Accepted
time: 4ms
memory: 22372kb
input:
1 50 50 9 -2 4 20 -177 -7 -944 6 -10 1 22 -36 19 -7 3 6 6 -9 -5354 -9 -48 18 231 -7 -9 -9 -68 8 -190...
output:
771 277 84 320 180 -38 475 300 311 259 25 332 655 488 276 306 249 57 559 339 337 -7 144 29 231 647 6...
result:
ok 50 lines
Test #8:
score: 0
Accepted
time: 9ms
memory: 22372kb
input:
1 50 50 49 -71 6 -8565 26 -4 17 -4 891 -654 5 -7 551 -3 83 -88 242 -9 200 -8 10 -1 15 -9 1818 -2 2 -...
output:
22 200 4235 4263 2286 352 -8282 1845 274 1910 444 5653 3789 1444 1857 1818 2292 939 4165 2699 2681 2...
result:
ok 50 lines
Test #9:
score: 0
Accepted
time: 0ms
memory: 22368kb
input:
1 50 50 8 -3 -999 -7936 -64 -35 10 441 -9 -4741 11 1 9 7 -113 -90 4087 9 531 95 9 1 -91 -14 296 -3 2...
output:
6573 15843 451 -1093 4729 1731 14835 15837 9181 371 5507 4748 1191 7574 831 6732 460 19810 2998 5507...
result:
ok 50 lines
Test #10:
score: 0
Accepted
time: 11ms
memory: 22372kb
input:
1 50 50 6 -6 5 -9836 307 -134 1964 -629 8649 -893 324 -3648 8 -42 9978 -9 849 -1 7097 -3 7 -9 342 -5...
output:
29179 41431 29554 41102 479 29504 18 12549 32036 475 1534 -3640 11422 29158 28872 40458 37158 342 12...
result:
ok 50 lines
Subtask #2:
score: 17
Accepted
Test #11:
score: 17
Accepted
time: 16ms
memory: 27168kb
input:
2 10000 1 2 -7 5 -6 10 -10 5 -4 3 -2 5 -10 5 -4 5 -10 7 -3 2 -9 6 -3 1 -6 1 -3 1 -2 2 -3 3 -9 1 -1 8...
output:
574
result:
ok single line: '574'
Test #12:
score: 0
Accepted
time: 26ms
memory: 27168kb
input:
2 10000 1 8 -1 -9 -6096 476 9 10 -1 4625 -10 476 4402 -160 3 675 4 -3569 -159 7 3 -4 -4985 3197 -3 7...
output:
6409167
result:
ok single line: '6409167'
Test #13:
score: 0
Accepted
time: 12ms
memory: 27172kb
input:
2 10000 1 5 2 7 -5 3 -9 -6 6 -4 9 1 8 -10 -1 2 6 10 -2 -8 -9 4 -5 -6 3 6 7 4 -9 -9 -8 -6 -5 4 2 1 4 ...
output:
1211
result:
ok single line: '1211'
Test #14:
score: 0
Accepted
time: 12ms
memory: 27168kb
input:
2 10000 1 12 -20 4 -7 7 -34 2 -58 8 -14 7 -9 8 -2 17 -15 36 -2 8 -6 130 -11 9 -9 3 -1 15 -1 20 -4 12...
output:
66462
result:
ok single line: '66462'
Test #15:
score: 0
Accepted
time: 15ms
memory: 27172kb
input:
2 10000 1 -4 -20 23 3 -7 5 -17 -3 10 -8 18 -38 68 6 -39 -11 376 -8 -7 -3 10 -21 -4 -20 3 -54 -10 5 9...
output:
43868
result:
ok single line: '43868'
Test #16:
score: 0
Accepted
time: 21ms
memory: 27168kb
input:
2 10000 1 2 -666 15 -6 43 -26 26 -9 8 -10 141 -10 257 -3 5586 -15 13 -8 17 -9 1 -24 28 -10 3 -4 4 -4...
output:
1585208
result:
ok single line: '1585208'
Test #17:
score: 0
Accepted
time: 16ms
memory: 27168kb
input:
2 10000 1 -38 9 118 7 -7 -1 8 6 58 -59 -21 7 42 -38 -914 -7 5 2 -5 12 -236 8 -12 3 -3 -1086 -154 -36...
output:
1518251
result:
ok single line: '1518251'
Test #18:
score: 0
Accepted
time: 20ms
memory: 27172kb
input:
2 10000 1 1 -55 1 -1 9 -8 5 -6 55 -428 7 -50 202 -169 7 -8 817 -9 8 -5 10 -6 16 -41 2 -7 2661 -10 9 ...
output:
3156178
result:
ok single line: '3156178'
Test #19:
score: 0
Accepted
time: 26ms
memory: 27172kb
input:
2 10000 1 -9 10 -3 -44 8 3 -76 8 -51 -3 289 3 -3 -84 -1 3062 -8 4 3 36 4555 -640 -1 -1 -485 76 2 -10...
output:
2985522
result:
ok single line: '2985522'
Test #20:
score: 0
Accepted
time: 28ms
memory: 27172kb
input:
2 10000 1 8545 -1117 52 -6426 4964 -4185 7 -8872 797 -811 714 -746 7 -859 7190 -831 3 -8 636 -261 91...
output:
6674464
result:
ok single line: '6674464'
Subtask #3:
score: 9
Accepted
Test #21:
score: 9
Accepted
time: 46ms
memory: 27536kb
input:
3 10000 10000 10 -9 2 -3 3 -7 2 -1 8 -9 8 -7 8 -7 4 -10 2 -5 4 -4 6 -2 9 -1 7 -2 1 -7 8 -9 10 -1 3 -...
output:
197 335 461 552 635 708 777 844 908 971 1027 1082 1136 1188 1239 1288 1336 1382 1428 1473 1518 1562 ...
result:
ok 10000 lines
Test #22:
score: 0
Accepted
time: 50ms
memory: 27572kb
input:
3 10000 10000 7 507 -7325 5 5 4 964 7348 8057 8281 5 -7 -1 5 -2 -4 -712 900 3 9448 -798 513 5 10 1 -...
output:
263778 453939 545867 632917 700130 765627 829283 888355 943684 994766 1044958 1094445 1140819 118601...
result:
ok 10000 lines
Test #23:
score: 0
Accepted
time: 45ms
memory: 27536kb
input:
3 10000 10000 -4 6 -5 4 -1 5 -2 5 -9 2 1 8 5 4 5 -3 8 3 -8 -4 -2 -10 -6 -2 -2 3 5 8 -8 -7 -2 10 -10 ...
output:
1017 1216 1412 1600 1775 1934 2092 2246 2397 2544 2674 2789 2902 3013 3119 3225 3328 3430 3525 3620 ...
result:
ok 10000 lines
Test #24:
score: 0
Accepted
time: 50ms
memory: 27544kb
input:
3 10000 10000 9 -9 8 -53 1 -2 5 -16 1 -15 10 -36 16 -19 20 -8 3 -3 3 -9 13 -2 10 -4 30 -7 1 -5 9 -12...
output:
12527 23016 32660 36979 40606 43858 46784 49167 51516 53541 55333 56868 58357 59777 61122 62178 6309...
result:
ok 10000 lines
Test #25:
score: 0
Accepted
time: 41ms
memory: 27540kb
input:
3 10000 10000 -17 -5 304 1 9 8 6 -6 -103 20 -9 -10 -10 72 -1 3 20 737 -3 -10 19 -6 -22 14 -2 -7 -7 1...
output:
13517 24732 30058 33241 35837 38347 40231 41900 43314 44691 46048 47397 48601 49747 50875 51967 5303...
result:
ok 10000 lines
Test #26:
score: 0
Accepted
time: 49ms
memory: 27552kb
input:
3 10000 10000 1 -10 36 -3 65 -5 24 -31 8 -9 7 -22 36 -8 1 -2 24 -10 5 -21 1 -34 4697 -6 7 -197 43 -1...
output:
166823 283281 332920 380898 425254 466701 504113 540610 569823 597473 622126 643060 662692 681571 70...
result:
ok 10000 lines
Test #27:
score: 0
Accepted
time: 26ms
memory: 27552kb
input:
3 10000 10000 -27 -4 -9 -39 -4 -10 50 3 -235 56 38 1 26 25 8 -494 23 17 306 -3796 1 10 3 10 -14 2 -4...
output:
257438 323180 385483 439856 474534 508551 528643 547341 565265 582644 599913 616538 632936 649316 66...
result:
ok 10000 lines
Test #28:
score: 0
Accepted
time: 29ms
memory: 27560kb
input:
3 10000 10000 10 -9 6 -6 78 -4 8457 -319 35 -51 8 -10 990 -62 11 -4 980 -10 7 -6 2 -5 36 -3 6 -9 827...
output:
135990 241148 320520 388918 450205 501416 548233 591214 630046 667242 702075 736547 770229 802659 83...
result:
ok 10000 lines
Test #29:
score: 0
Accepted
time: 30ms
memory: 27556kb
input:
3 10000 10000 8 -713 -70 10 -5 -6882 -9 -976 -4 -43 3 -1711 -56 51 -6 -30 -5 -6 -1 -2 -4 -9 -27 325 ...
output:
174964 283037 349845 412338 467924 523165 569902 615865 659826 701520 742580 781828 820701 859245 89...
result:
ok 10000 lines
Test #30:
score: 0
Accepted
time: 36ms
memory: 27588kb
input:
3 10000 10000 834 -10 6 -95 334 -2539 1 -7 1 -4 5 -9 6160 -5 1 -4 8 -3 2 -5 3 -135 515 -1 7 -1 7 -8 ...
output:
117941 216731 311630 399428 483028 561232 634886 706477 774505 841164 906527 964165 1021030 1074834 ...
result:
ok 10000 lines
Subtask #4:
score: 16
Accepted
Test #31:
score: 16
Accepted
time: 48ms
memory: 26612kb
input:
4 8192 10000 4 -10 2 -2 9 -4 9 -2 5 -5 8 -1 3 -1 1 -4 2 -5 9 -4 4 -3 1 -1 7 -7 4 -1 7 -2 1 -10 1 -3 ...
output:
4860 59 79 2157 45 2796 1 149 50 2460 9 30 9577 11 24 1 1167 166 202 56 91 2143 181 103 8 103 275 9 ...
result:
ok 10000 lines
Test #32:
score: 0
Accepted
time: 51ms
memory: 26652kb
input:
4 8192 10000 4368 7391 -1 -226 -2 601 -2 -9 -732 -9 2227 -4003 10 544 -5 4178 -4 1530 -10 -867 -2 21...
output:
442800 44536 662627 -3 -873 -1 11758 12139 2702521 -6136 211918 328131 672490 64569 1395135 -5048 20...
result:
ok 10000 lines
Test #33:
score: 0
Accepted
time: 57ms
memory: 26624kb
input:
4 8192 10000 3 7 5 10 8 -10 -1 6 2 -8 5 -9 -8 8 -7 -9 -7 -5 -3 -6 5 -1 3 -8 10 -5 8 -6 5 5 9 -3 5 -1...
output:
117 776 20 20 39 294 -2 533 1822 221 1512 2972 681 -6 574 1321 303 18 247 22235 188 8137 27 228 702 ...
result:
ok 10000 lines
Test #34:
score: 0
Accepted
time: 55ms
memory: 26624kb
input:
4 8192 10000 1 -1 29 -7 9 -2 8 -6 17 -17 3 -9 1 -61 38 -6 21 -2 3 -4 9 -8 7 -39 27 -9 17 -10 1 -10 9...
output:
13689 46 2831 31 181 43410 1871 -8 22738 105565 22599 68 18413 97 3772 7 93 -12 40945 5002 27937 213...
result:
ok 10000 lines
Test #35:
score: 0
Accepted
time: 60ms
memory: 26620kb
input:
4 8192 10000 14 -4 -2 -9 -19 -73 4 -7 -7 8 -6 -40 550 -7 -7 -10 -8 -3 -14 8 -21 -6 -3 11 10 -5 -6 30...
output:
-13 35332 12931 118 2573 12109 47044 1984 6193 9098 4095 59 2909 26650 386 22236 43 13020 1156 9 26 ...
result:
ok 10000 lines
Test #36:
score: 0
Accepted
time: 59ms
memory: 26620kb
input:
4 8192 10000 3571 -16 10 -10 40 -10 9 -2149 44 -3 71 -3 6 -112 41 -1 930 -27 36 -5 16 -6 215 -1 1 -6...
output:
143042 14364 9325 2842 -28 3427 404 11009 -486 19973 10412 4 14 252 -5837 1102888 5 37700 1002222 20...
result:
ok 10000 lines
Test #37:
score: 0
Accepted
time: 48ms
memory: 26636kb
input:
4 8192 10000 -8 -48 -60 -2 9 -10 -5 -4 -7 -10 1 5 -30 2 -4 -10 10 -793 4 10 -9 -6 -728 -28 -7 -40 32...
output:
340377 120376 23806 289684 1396388 29 6438 36556 146424 327387 257970 713410 -34 25379 4 25511 238 1...
result:
ok 10000 lines
Test #38:
score: 0
Accepted
time: 50ms
memory: 26628kb
input:
4 8192 10000 80 -7120 3 -100 7 -93 22 -388 73 -732 6 -35 422 -72 2 -5959 10 -1 4590 -7 2 -3 86 -918 ...
output:
18403 29189 16399 8581 733 6 27767 108892 91 42097 149704 73 586559 39 232554 2771 -6408 26311 32285...
result:
ok 10000 lines
Test #39:
score: 0
Accepted
time: 48ms
memory: 26640kb
input:
4 8192 10000 44 -1 3 5 7 -9 8 -10 7 -1 -8 365 -325 409 -6 3 9 767 -9 5 -109 -1387 6 46 -7 1 57 -8 66...
output:
49064 74 613336 77 51869 -1 5 130231 144626 158043 236874 105370 1977647 545678 142489 225364 302 67...
result:
ok 10000 lines
Test #40:
score: 0
Accepted
time: 59ms
memory: 26640kb
input:
4 8192 10000 6 -924 7539 -10 3 -775 2 -2 5276 -1237 322 -764 9175 -569 50 -626 5 -5155 7 -10 1 -316 ...
output:
2557600 164876 18945 3028301 21493 281452 53796 3173 563373 164989 224758 10 623 462858 1168 67938 8...
result:
ok 10000 lines
Subtask #5:
score: 27
Accepted
Test #41:
score: 27
Accepted
time: 227ms
memory: 27548kb
input:
5 10000 10000 5 -1 8 -4 9 -10 10 -2 7 -7 2 -1 1 -9 8 -10 2 -5 10 -8 3 -6 4 -7 9 -8 6 -4 2 -5 3 -6 5 ...
output:
200 164 535 916 649 7275 3632 949 147 8747 217 1927 2419 1862 2082 565 11114 427 7662 1162 648 14036...
result:
ok 10000 lines
Test #42:
score: 0
Accepted
time: 307ms
memory: 27544kb
input:
5 10000 10000 -8809 -8130 1906 -4 -6 -5973 9 685 -8 362 7821 839 33 -228 9 -2 -9 3 7 5 -657 -10 -658...
output:
311458 2153649 682112 21665 493992 1222174 1099560 246425 775749 181514 1023680 679424 359916 515209...
result:
ok 10000 lines
Test #43:
score: 0
Accepted
time: 392ms
memory: 27516kb
input:
5 10000 10000 10 -10 -1 7 3 10 -2 4 9 9 2 -9 -6 -2 4 4 -10 9 7 -7 -10 -1 5 10 -4 4 1 -2 9 6 10 9 4 2...
output:
2518 516 1345 141 4536 1953 6404 925 1228 9859 5697 460 1072 3771 11047 1384 1337 2694 13182 5468 15...
result:
ok 10000 lines
Test #44:
score: 0
Accepted
time: 398ms
memory: 27556kb
input:
5 10000 10000 5 -63 1 -9 9 -30 10 -9 60 -1 1 -8 9 -5 14 -16 10 -20 18 -2 5 -4 3 -1 1 -6 2 -17 42 -6 ...
output:
41061 4704 40708 22968 29745 10131 27260 12545 47735 10418 6230 46450 1237 36106 15400 41786 37204 5...
result:
ok 10000 lines
Test #45:
score: 0
Accepted
time: 318ms
memory: 27540kb
input:
5 10000 10000 2 6 6 31 -10 -14 -6 13 -8 -44 5 6 5 14 3 5 5 20 -6 -7 -9 3 7 7 4 -9 5 -5 2 -9 2 -10 -9...
output:
25359 6115 74444 9808 21015 48934 4880 14465 16339 16976 17573 16678 27382 20827 14593 29593 531 809...
result:
ok 10000 lines
Test #46:
score: 0
Accepted
time: 241ms
memory: 27560kb
input:
5 10000 10000 4 -200 36 -3 9 -5 312 -1 3 -28 7 -5 31 -1 10 -46 25 -7 6 -10 591 -5 763 -39 10 -6 35 -...
output:
114458 192252 296692 615929 713097 211212 387140 295326 249523 108708 697248 391 4759 93135 26996 60...
result:
ok 10000 lines
Test #47:
score: 0
Accepted
time: 228ms
memory: 27528kb
input:
5 10000 10000 -2 401 -8 5 10 9 225 22 -10 -6 -40 -38 -16 -37 6 3 -23 5 -7873 6 18 -3 17 43 -6 -165 -...
output:
82982 539520 125639 321239 128060 182575 440488 416966 110060 510784 625366 148525 587782 556872 401...
result:
ok 10000 lines
Test #48:
score: 0
Accepted
time: 289ms
memory: 27572kb
input:
5 10000 10000 2672 -44 5 -4 1 -10 6 -4 2 -4 7 -3 7 -51 2733 -10 152 -5075 49 -50 14 -88 8131 -414 1 ...
output:
2151980 698920 884176 616643 1998345 454692 412209 350806 73883 193958 607842 1100453 822015 280524 ...
result:
ok 10000 lines
Test #49:
score: 0
Accepted
time: 413ms
memory: 27552kb
input:
5 10000 10000 -1 10 10 3 -9 8128 -350 -799 -5 76 -8 -3710 5 7 4 -5058 -5947 3 4 -8 22 4 -3913 -22 41...
output:
849900 243987 2001885 83047 388453 583806 768287 75961 301285 599010 4618 243392 482554 2416506 5118...
result:
ok 10000 lines
Test #50:
score: 0
Accepted
time: 387ms
memory: 27576kb
input:
5 10000 10000 9 -4 7 -1862 2698 -968 579 -310 9 -3 766 -8933 1 -851 2 -3938 3 -6 8 -724 6547 -5222 5...
output:
138692 752908 785422 299759 405564 464320 84022 3264431 570930 1884321 2712407 328259 1600577 737316...
result:
ok 10000 lines
Subtask #6:
score: 3
Accepted
Test #51:
score: 3
Accepted
time: 1721ms
memory: 50020kb
input:
6 50000 50000 5 5 2 1 9 9 7 7 5 4 3 10 3 1 5 2 7 7 3 9 3 8 7 10 7 8 3 5 4 5 1 1 6 8 4 7 9 5 4 9 1 3 ...
output:
132895 63325 28338 76001 10779 159228 77341 133148 25542 47571 29711 67121 38703 74361 117673 46740 ...
result:
ok 50000 lines
Test #52:
score: 0
Accepted
time: 2251ms
memory: 50016kb
input:
6 50000 50000 122 1 89 4 9 7 115 4 8 8 10 70 4 7 10 7 17 8 10 4 271 34 29 1 9 11 3 6 10 17 34 4 223 ...
output:
251008 114075 715698 90572 357240 218782 453232 237492 452741 29183 534999 511204 625252 169527 5789...
result:
ok 50000 lines
Test #53:
score: 0
Accepted
time: 1515ms
memory: 50072kb
input:
6 50000 50000 3 34 6 8 17 3 742 3 26 2 41 1 4 161 5 1 35 117 1 12 10 10 1356 846 30 67 217 446 6 49 ...
output:
4429497 1313321 1681264 4238036 5710020 3719196 1577616 4249919 5059511 822717 1363996 4147512 41228...
result:
ok 50000 lines
Test #54:
score: 0
Accepted
time: 1610ms
memory: 50016kb
input:
6 50000 50000 70 65 8 52 985 4 1 6211 6 1 694 10 74 10 5 6 607 329 1 2100 949 2 98 11 9 8 45 1 2 2 5...
output:
1872213 5719067 10718570 11668374 4664657 15280887 14213915 9130344 10039664 7891907 7717084 76667 7...
result:
ok 50000 lines
Test #55:
score: 0
Accepted
time: 2233ms
memory: 50020kb
input:
6 50000 50000 2 2 1 1 4 92 194 1 5 3 9064 6 3 8655 2 523 9954 7 1802 7758 3 652 10 819 2 10 10 416 4...
output:
36651532 2063089 13161919 5355225 16211431 2448718 4844689 14648121 34085764 27507829 20079241 17654...
result:
ok 50000 lines
Subtask #7:
score: 13
Accepted
Test #56:
score: 13
Accepted
time: 1987ms
memory: 50104kb
input:
7 50000 50000 8 -2 3 -6 3 -3 7 -10 5 -8 5 -1 10 -5 9 -3 2 -9 7 -6 3 -2 7 -7 7 -8 7 -4 3 -8 7 -7 8 -1...
output:
35060 3067 6071 24402 9083 2490 6394 5997 9840 9839 5453 3509 33522 17557 5543 3674 10421 2214 12635...
result:
ok 50000 lines
Test #57:
score: 0
Accepted
time: 2575ms
memory: 50084kb
input:
7 50000 50000 578 1 6 3823 400 -8215 -612 1461 -2516 482 5 8 5 5 -8 -8057 -4888 10 3 751 -6 5677 437...
output:
13153325 1020807 513946 462377 14823590 10242270 7714050 1351993 2762652 3372163 3472788 2287026 514...
result:
ok 50000 lines
Test #58:
score: 0
Accepted
time: 2551ms
memory: 50092kb
input:
7 50000 50000 7 4 7 -7 7 9 1 10 8 7 -10 -10 -5 -10 -3 -7 7 5 9 -7 -7 -6 -8 9 8 -6 -9 -8 -5 5 2 3 9 1...
output:
18163 6878 13477 5176 12322 1159 4480 2529 12744 7557 365 11064 6382 3423 9361 635 1959 583 22438 44...
result:
ok 50000 lines
Test #59:
score: 0
Accepted
time: 2444ms
memory: 50100kb
input:
7 50000 50000 4 -2 6 -2 4 -1 8 -5 67 -6 20 -3 2 -4 16 -18 10 -2 3 -2 4 -5 8 -60 19 -5 9 -7 25 -13 10...
output:
64349 41387 51484 144181 219966 121409 87651 125286 29953 90218 440614 172476 40507 18031 23129 1438...
result:
ok 50000 lines
Test #60:
score: 0
Accepted
time: 2376ms
memory: 50088kb
input:
7 50000 50000 5 -6 3 -5 -6 5 -25 28 -24 -4 4 -13 9 -1 -31 -3 10 -4 9 17 -10 12 -3 -34 8 -3 14 10 6 -...
output:
258357 62625 21205 89270 337588 241843 54812 137728 35415 83371 130867 49112 104287 42759 26104 5115...
result:
ok 50000 lines
Test #61:
score: 0
Accepted
time: 2489ms
memory: 50100kb
input:
7 50000 50000 43 -4 2 -1079 3 -580 8 -8 2 -1 45 -2 177 -7087 3 -10 386 -612 36 -2 9 -3 8 -9 36 -9 13...
output:
1498 3227874 1748291 464709 377709 683282 343235 988663 152022 1421177 248838 269682 1040565 371405 ...
result:
ok 50000 lines
Test #62:
score: 0
Accepted
time: 2635ms
memory: 50092kb
input:
7 50000 50000 2 -6250 -23 1 -2425 -36 -3 -12 49 5 -2 7 -3 6 -5 3 126 22 2 -15 -21 945 -9597 8 -5 2 -...
output:
65419 1149595 2359958 2472187 1394505 3097007 401110 150506 992942 3092095 1269612 2568048 2662202 2...
result:
ok 50000 lines
Test #63:
score: 0
Accepted
time: 2110ms
memory: 50116kb
input:
7 50000 50000 5813 -3 668 -82 723 -5 2225 -95 1278 -10 85 -5 5 -15 67 -1 2220 -6 6 -5 82 -1 8 -10 56...
output:
4578212 2598166 6328238 2372615 3926510 4755931 595490 7918020 1729363 4198024 4643772 5303988 43281...
result:
ok 50000 lines
Test #64:
score: 0
Accepted
time: 2169ms
memory: 50092kb
input:
7 50000 50000 -529 16 -2 2 -6 5256 15 1 -1 4 -811 4 3 -1 832 -22 1 -7 87 7 8 85 -62 447 -8 4 7 -7 49...
output:
2602348 1733812 768356 2089642 1138629 1700702 3266891 1042465 2539115 747502 483423 662633 5819101 ...
result:
ok 50000 lines
Test #65:
score: 0
Accepted
time: 2237ms
memory: 50108kb
input:
7 50000 50000 9 -3017 756 -3904 1 -8 1814 -9 6 -7 9 -6183 9 -1457 2 -8 2749 -8 2466 -2345 6 -1 8 -6 ...
output:
931733 733331 1397162 566451 1701099 817890 11816180 6439864 441533 1271133 1087499 8006252 1432514 ...
result:
ok 50000 lines
Extra Test:
score: 0
Extra Test Passed