QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#266535 | #7742. Suffix Structure | ucup-team052 | AC ✓ | 198ms | 189820kb | C++14 | 7.4kb | 2023-11-26 15:14:42 | 2024-08-17 16:40:31 |
Judging History
answer
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define per(i, a, b) for (int i = a; i >= b; i--)
using namespace std;
typedef unsigned long long ull;
typedef pair <int, int> pii;
typedef long long ll;
template <typename _T>
inline void read(_T &f) {
f = 0; _T fu = 1; char c = getchar();
while (c < '0' || c > '9') { if (c == '-') { fu = -1; } c = getchar(); }
while (c >= '0' && c <= '9') { f = (f << 3) + (f << 1) + (c & 15); c = getchar(); }
f *= fu;
}
template <typename T>
void print(T x) {
if (x < 0) putchar('-'), x = -x;
if (x < 10) putchar(x + 48);
else print(x / 10), putchar(x % 10 + 48);
}
template <typename T>
void print(T x, char t) {
print(x); putchar(t);
}
const int N = 4e5 + 5;
struct seg_t {
int lc[N * 20], rc[N * 20], val[N * 20];
int tot;
void reset() {
for (int i = 1; i <= tot; i++) {
lc[i] = rc[i] = val[i] = 0;
}
tot = 0;
}
void ins(int &u, int pre, int l, int r, int x, int y) {
u = ++tot; lc[u] = lc[pre]; rc[u] = rc[pre];
if (l == r) {
val[u] = y;
return;
}
int mid = (l + r) >> 1;
if (mid >= x) ins(lc[u], lc[pre], l, mid, x, y);
else ins(rc[u], rc[pre], mid + 1, r, x, y);
}
int query(int u, int l, int r, int x) {
if (!u) return 0;
if (l == r) return val[u];
int mid = (l + r) >> 1;
if (mid >= x) return query(lc[u], l, mid, x);
return query(rc[u], mid + 1, r, x);
}
} tr;
const ull base = 19260817;
ull h1[N], h2[N], pw[N];
map <int, int> son[N];
vector <pii> adj[N];
vector <int> ft[N], vec[N];
queue <int> q;
int fa[N], c[N], t[N], top[N], siz[N], wson[N], tops[N], pre[N], mx[N], lim[N], fail[N], rt[N], ans2[N], dep[N];
ll ans[N];
int T, n, m, dfnt;
void dfs1(int u) {
siz[u] = 1; wson[u] = -1;
for (auto v : adj[u]) {
dep[v.first] = dep[u] + 1;
dfs1(v.first);
siz[u] += siz[v.first];
if (wson[u] == -1 || siz[v.first] > siz[wson[u]]) wson[u] = v.first;
}
}
void dfs2(int u, int tp) {
tops[u] = ++dfnt; pre[dfnt] = u; top[u] = tp;
mx[tp] = tops[u];
if (wson[u] != -1) dfs2(wson[u], tp);
for (auto v : adj[u]) {
if (v.first == wson[u]) continue;
dfs2(v.first, v.first);
}
}
ull ghs1(int l, int r) {
return h1[r] - h1[l - 1] * pw[r - l + 1];
}
ull ghs2(int l, int r) {
return h2[r] - h2[l - 1] * pw[r - l + 1];
}
void dfs3(int u) {
siz[u] = 1; tops[u] = ++dfnt;
for (auto v : ft[u]) {
dfs3(v);
siz[u] += siz[v];
}
}
struct node_t {
int l, r, mn, mn2, cnt, tag;
ll sum;
} p[N << 2];
void update(int u) {
p[u].mn = min(p[u << 1].mn, p[u << 1 | 1].mn);
p[u].sum = p[u << 1].sum + p[u << 1 | 1].sum;
if (p[u << 1].mn == p[u << 1 | 1].mn) {
p[u].mn2 = min(p[u << 1].mn2, p[u << 1 | 1].mn2);
p[u].cnt = p[u << 1].cnt + p[u << 1 | 1].cnt;
} else if (p[u << 1].mn < p[u << 1 | 1].mn) {
p[u].mn2 = min(p[u << 1].mn2, p[u << 1 | 1].mn);
p[u].cnt = p[u << 1].cnt;
} else {
p[u].mn2 = min(p[u << 1].mn, p[u << 1 | 1].mn2);
p[u].cnt = p[u << 1 | 1].cnt;
}
}
void add_tag(int u, int x) {
if (x <= p[u].mn) return;
p[u].sum += 1ll * (x - p[u].mn) * p[u].cnt;
p[u].mn = p[u].tag = x;
}
void pushdown(int u) {
if (p[u].tag) {
add_tag(u << 1, p[u].tag);
add_tag(u << 1 | 1, p[u].tag);
p[u].tag = 0;
}
}
void build(int u, int l, int r) {
p[u].l = l; p[u].r = r; p[u].tag = 0; p[u].sum = 0;
if (l == r) {
p[u].mn = 0; p[u].mn2 = 1e9; p[u].cnt = 1;
return;
}
int mid = (l + r) >> 1;
build(u << 1, l, mid);
build(u << 1 | 1, mid + 1, r);
update(u);
}
void modify(int u, int l, int r, int x) {
if (p[u].mn >= x) return;
if (l <= p[u].l && p[u].r <= r && p[u].mn2 > x) {
add_tag(u, x);
return;
}
pushdown(u);
int mid = (p[u].l + p[u].r) >> 1;
if (mid >= l) modify(u << 1, l, r, x);
if (mid + 1 <= r) modify(u << 1 | 1, l, r, x);
update(u);
}
int main() {
read(T);
while (T--) {
dfnt = 0;
read(n); read(m);
for (int i = 0; i <= n; i++) adj[i].clear(), son[i].clear();
for (int i = 1; i <= n; i++) read(fa[i]);
for (int i = 1; i <= n; i++) {
read(c[i]);
adj[fa[i]].emplace_back(i, c[i]);
son[fa[i]][c[i]] = i;
// fprintf(stderr, "%d %d %d\n", fa[i], i, c[i]);
}
for (int i = 1; i <= m; i++) read(t[i]);
dfs1(0); dfs2(0, 0);
pw[0] = 1;
for (int i = 1; i <= n + 1; i++) {
pw[i] = pw[i - 1] * base;
h1[i] = h1[i - 1] * base + c[pre[i]];
h2[i] = h2[i - 1] * base + t[i];
}
for (int _ = 1; _ <= n; _++) {
int u = _;
lim[_] = 0;
while (adj[u].size()) {
int now = min(mx[top[u]] - tops[u], m - lim[_]);
int l = 1, r = now, res = 0;
while (l <= r) {
int mid = (l + r) >> 1;
if (ghs1(tops[u] + 1, tops[u] + mid) == ghs2(lim[_] + 1, lim[_] + mid)) res = mid, l = mid + 1;
else r = mid - 1;
}
lim[_] += res; u = pre[tops[u] + res];
if (lim[_] == m) break;
if (!son[u].count(t[lim[_] + 1])) break;
++lim[_];
u = son[u][t[lim[_]]];
}
// fprintf(stderr, "lim[%d] = %d\n", _, lim[_]);
}
tr.reset();
for (int i = 0; i <= n; i++) ft[i].clear();
q.push(0); rt[0] = 0;
while (!q.empty()) {
int u = q.front(); q.pop();
if (u) rt[u] = rt[fail[u]];
for (auto v : adj[u]) tr.ins(rt[u], rt[u], 1, n, v.second, u);
if (u) ft[fail[u]].push_back(u);
for (auto v : adj[u]) {
if (u == 0) {
fail[v.first] = 0;
} else {
int tmp = tr.query(rt[fail[u]], 1, n, v.second);
if (son[tmp].count(v.second)) fail[v.first] = son[tmp][v.second];
else fail[v.first] = 0;
}
q.push(v.first);
}
}
dfnt = 0; dfs3(0);
int now = 0;
for (int i = 1; i <= m; i++) {
while (now && !son[now].count(t[i])) now = fail[now];
if (son[now].count(t[i])) now = son[now][t[i]];
ans2[i] = dep[now];
}
for (int i = 1; i <= m; i++) vec[i].clear();
for (int i = 1; i <= n; i++) {
if (lim[i]) vec[min(m, lim[i])].push_back(i);
}
build(1, 1, n);
for (int i = m; i >= 1; i--) {
for (auto j : vec[i]) {
modify(1, tops[j] - 1, tops[j] + siz[j] - 2, dep[j]);
// fprintf(stderr, "j = %d, cover [%d, %d] %d\n", j, tops[j] - 1, tops[j] + siz[j] - 2, dep[j]);
}
int cnt0 = p[1].mn == 0 ? p[1].cnt : 0;
ans[i] = p[1].sum + 1ll * (n - cnt0) * i + 1ll * cnt0 * ans2[i];
}
for (int i = 1; i <= m; i++) print(ans[i], i == m ? '\n' : ' ');
}
return 0;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 11ms
memory: 75244kb
input:
2 11 3 0 1 2 0 4 5 4 6 0 9 10 1 3 2 2 1 3 4 1 3 2 1 3 2 4 5 16 0 0 0 1 4 1 2 3 2 2 2 1 3 3 2 1 3 2 1 3 2 2 1 1 2 1
output:
17 26 22 8 5 5 5 5 5 5 5 5 5 5 5 5 5 10 5
result:
ok 2 lines
Test #2:
score: 0
Accepted
time: 52ms
memory: 75552kb
input:
30729 6 5 0 1 1 1 1 4 1 2 3 4 1 2 1 3 2 1 1 4 6 0 1 2 0 1 1 3 2 1 3 1 2 1 2 6 5 0 0 0 1 3 1 1 2 3 2 2 3 1 2 3 1 3 2 10 0 0 1 2 1 2 1 1 1 1 2 2 1 1 3 10 0 0 2 1 2 3 2 1 3 2 2 2 3 2 2 3 3 4 0 0 0 1 2 3 3 2 3 1 9 6 0 1 2 1 1 4 1 5 2 3 1 1 2 4 3 3 1 2 3 1 1 1 2 1 1 9 0 1 1 1 1 1 1 1 1 1 1 13 6 0 1 2 3 4...
output:
8 12 0 6 12 6 6 4 4 4 4 6 12 6 6 12 2 2 2 2 2 2 2 2 2 2 3 3 0 3 3 3 6 3 3 6 3 3 3 3 14 18 27 0 0 0 1 1 1 1 1 1 1 1 1 21 5 0 0 0 13 0 2 0 0 2 4 4 0 2 2 0 0 2 4 0 2 4 2 3 6 3 6 0 0 3 6 0 3 1 1 1 1 1 1 1 1 1 2 2 2 12 0 8 8 16 8 8 8 8 21 22 33 9 6 6 0 6 6 6 2 2 2 2 2 2 2 2 2 19 12 12 12 12 24 12 24 24 1...
result:
ok 30729 lines
Test #3:
score: 0
Accepted
time: 48ms
memory: 75308kb
input:
30817 5 9 0 1 0 3 3 2 1 3 2 3 3 2 1 2 3 1 3 1 3 10 4 0 0 0 0 0 3 5 0 2 1 2 1 3 5 6 2 1 4 3 1 1 2 2 2 3 2 0 0 2 1 3 1 1 1 5 1 0 1 2 3 3 3 1 1 1 2 3 4 5 0 0 1 3 1 2 2 1 3 1 1 1 1 3 6 0 1 0 1 1 3 3 3 2 2 3 2 6 6 0 0 1 0 2 5 1 2 3 3 1 3 1 3 2 1 1 2 5 10 0 0 0 2 0 2 1 4 2 3 3 2 2 1 1 3 3 1 1 1 3 5 0 1 0 ...
output:
7 10 10 5 5 0 5 0 5 13 10 10 10 4 3 5 0 4 4 4 4 3 3 0 0 3 0 7 13 6 12 6 6 5 5 5 5 5 5 5 5 5 5 0 3 3 3 3 3 0 0 18 2 0 3 3 0 14 7 14 7 14 0 0 0 7 14 21 16 9 0 0 6 0 0 6 6 6 6 6 12 6 6 4 4 4 4 5 6 6 6 0 3 0 16 7 14 14 21 7 14 0 4 5 0 5 5 5 10 17 10 8 8 16 8 8 8 12 12 12 11 7 7 7 7 7 7 7 7 7 14 7 7 7 7 ...
result:
ok 30817 lines
Test #4:
score: 0
Accepted
time: 60ms
memory: 75516kb
input:
3606 79 93 0 1 2 2 3 5 6 4 3 5 0 11 2 2 7 10 13 6 11 13 1 7 6 9 9 22 19 27 27 4 27 18 29 15 17 20 31 27 9 37 6 19 41 39 11 35 45 3 2 4 5 3 30 20 42 6 35 24 18 47 33 37 37 6 29 65 27 26 51 15 2 29 15 58 43 63 49 32 65 1 1 6 3 1 1 4 1 4 2 3 1 5 4 1 1 2 2 2 3 3 3 5 1 2 1 2 1 4 2 3 2 1 1 1 2 3 2 3 1 6 3...
output:
195 118 157 0 0 0 0 0 79 158 237 237 237 316 79 158 158 237 158 237 316 0 79 158 0 79 158 158 237 316 79 158 237 158 79 158 237 316 237 316 79 158 158 158 237 316 158 237 316 79 158 237 316 79 158 237 316 158 158 79 158 237 79 158 158 237 316 237 158 158 158 79 158 237 237 316 158 158 0 0 79 158 237...
result:
ok 3606 lines
Test #5:
score: 0
Accepted
time: 58ms
memory: 77388kb
input:
3638 83 6 0 0 0 1 4 0 1 4 1 9 10 10 0 6 4 1 6 11 4 0 10 1 2 10 16 10 11 8 14 23 13 27 12 23 10 24 6 12 18 11 29 41 31 21 28 23 9 45 14 48 37 35 20 2 20 8 36 51 51 19 0 20 61 31 21 21 43 6 42 39 54 8 8 4 41 27 15 25 75 56 28 18 3 2 6 5 1 5 7 3 3 4 1 3 4 1 4 4 2 1 1 1 4 2 5 2 6 3 5 2 1 1 1 3 2 1 2 1 2...
output:
205 129 168 166 249 166 118 17 67 61 61 122 183 244 61 128 106 86 129 172 43 77 273 271 159 188 282 376 282 376 94 188 282 376 470 376 282 188 188 94 94 94 94 188 282 94 188 282 94 188 282 188 282 282 376 282 376 118 121 105 153 96 144 48 96 144 96 144 96 144 144 48 96 96 144 144 144 192 240 144 96 ...
result:
ok 3638 lines
Test #6:
score: 0
Accepted
time: 66ms
memory: 82704kb
input:
364 490 731 0 1 2 2 3 0 1 3 8 2 1 5 7 3 7 7 0 12 18 10 18 13 10 5 17 2 8 22 27 5 7 14 19 27 28 21 17 32 32 11 28 33 5 0 2 6 1 37 26 7 6 44 45 51 36 20 3 16 38 7 0 20 42 19 3 10 24 54 7 15 68 41 21 16 62 8 38 7 76 17 31 37 53 69 55 20 11 82 75 6 9 87 18 76 38 22 93 73 11 49 57 93 25 102 90 86 101 19 ...
output:
1604 1415 1488 499 980 1470 980 1470 980 1470 1470 490 980 1470 1960 1960 1960 2450 490 490 980 1470 490 490 980 1470 1470 490 490 980 1470 490 980 1470 490 490 980 1470 490 980 1470 490 980 490 980 1470 490 980 490 980 1470 490 980 1470 1960 1960 2450 1960 1470 980 1470 490 980 1470 1470 980 1470 1...
result:
ok 364 lines
Test #7:
score: 0
Accepted
time: 66ms
memory: 75796kb
input:
365 183 329 0 0 2 2 4 4 5 0 1 9 3 10 3 7 1 11 11 16 11 3 17 12 12 6 19 9 3 0 14 7 17 31 25 17 12 13 30 11 27 27 27 13 21 38 10 41 17 14 12 34 34 42 35 13 52 6 56 4 55 53 35 14 14 47 38 9 6 44 26 21 1 7 27 69 36 24 49 47 68 43 24 20 16 74 68 22 73 15 3 66 10 8 1 90 17 41 40 59 31 13 84 11 90 53 69 85...
output:
514 331 183 366 549 732 183 183 183 366 183 366 549 549 549 732 183 183 183 183 366 183 183 183 366 183 183 366 549 732 183 366 549 732 915 732 549 732 183 366 549 732 366 183 183 183 183 183 183 366 549 732 366 549 732 183 366 549 732 915 183 183 366 549 732 915 1098 183 366 549 732 183 366 549 549...
result:
ok 365 lines
Test #8:
score: 0
Accepted
time: 74ms
memory: 89612kb
input:
40 5160 1090 0 0 1 0 2 2 3 7 6 7 2 4 9 5 4 5 3 1 2 18 13 21 9 2 1 13 17 11 10 25 9 6 10 20 4 8 2 11 10 27 22 34 40 23 34 28 9 26 19 1 33 48 5 44 20 36 30 10 17 45 12 20 2 57 56 11 45 53 53 64 4 51 59 51 47 67 3 8 37 11 7 44 20 59 59 0 23 10 0 83 80 19 5 11 32 88 32 18 81 35 9 66 15 63 86 62 103 59 1...
output:
25031 21727 21110 19969 20329 21227 20649 20640 25800 30960 36120 15480 20640 25800 30960 36120 20640 15480 15480 20640 10320 15480 20640 15480 20640 25800 30960 15480 10320 15480 20640 25800 20640 25800 25800 25800 20640 25800 25800 15480 20640 25800 30960 15480 20640 25800 25800 30960 25800 25800 ...
result:
ok 40 lines
Test #9:
score: 0
Accepted
time: 90ms
memory: 87308kb
input:
35 5962 9309 0 1 2 0 2 4 4 6 6 0 0 11 1 1 9 11 2 16 15 4 5 10 0 8 24 2 16 3 5 14 6 2 11 17 28 21 17 28 2 38 11 41 40 24 15 26 4 1 3 23 11 20 39 17 50 24 36 20 49 59 59 4 3 16 32 45 12 21 33 46 60 62 67 56 5 4 59 35 11 55 72 43 21 44 34 11 62 40 69 47 50 63 23 76 56 29 23 13 15 89 99 84 68 69 69 83 1...
output:
28571 22008 22924 25724 29810 35772 41734 23848 23848 23848 29810 35772 41734 47696 29810 23848 29810 35772 23848 11924 17886 23848 29810 35772 29810 35772 11924 17886 23848 11924 17886 23848 29810 35772 11924 17886 23848 17886 17886 11924 11924 17886 23848 29810 29810 11924 11924 11924 17886 23848 ...
result:
ok 35 lines
Test #10:
score: 0
Accepted
time: 158ms
memory: 142940kb
input:
4 7284 38354 0 0 1 0 4 2 3 5 1 8 7 0 5 6 13 9 0 11 11 17 0 7 13 4 7 0 14 21 22 10 8 29 18 12 32 16 9 23 29 30 9 14 25 43 15 20 3 47 7 14 40 47 11 36 51 10 15 35 34 53 44 17 9 40 15 58 2 42 53 43 50 25 63 2 17 72 1 54 40 63 56 76 66 6 84 48 31 2 84 84 70 79 87 22 45 76 83 39 35 19 7 10 38 94 42 78 0 ...
output:
32300 25960 23760 22471 22067 29179 29177 21852 29136 7284 14568 21852 21852 29136 7284 14568 7284 14568 21852 7284 7284 14568 21852 29136 29136 21852 21852 21852 29136 21852 21852 29136 36420 7284 7284 14568 21852 14568 21852 29136 14568 7284 7284 7284 14568 21852 29136 29136 21852 29136 14568 2185...
result:
ok 4 lines
Test #11:
score: 0
Accepted
time: 128ms
memory: 103048kb
input:
5 12682 9544 0 0 2 2 2 4 1 6 0 2 8 11 6 10 11 0 8 6 14 18 14 0 16 19 5 6 7 24 0 23 21 11 30 5 16 6 21 20 7 6 2 21 40 13 36 3 39 32 22 16 41 9 9 53 46 46 12 38 30 12 20 17 48 37 30 13 11 39 44 54 20 11 67 69 26 35 23 17 73 36 43 40 45 33 76 21 57 22 42 49 72 21 57 47 69 5 57 46 10 30 55 43 52 70 10 8...
output:
64467 49463 50827 40069 51803 63415 76092 38046 38046 25364 38046 50728 50728 50728 63410 38046 50728 63410 50728 25364 38046 50728 50728 63410 50728 63410 76092 88774 50728 25364 38046 50728 63410 38046 38046 50728 63410 50728 38046 38046 50728 38046 38046 25364 38046 50728 50728 63410 76092 50728 ...
result:
ok 5 lines
Test #12:
score: 0
Accepted
time: 169ms
memory: 156760kb
input:
1 200000 182221 0 1 0 0 3 3 0 5 7 3 5 6 4 4 13 1 7 16 5 10 11 1 9 8 13 14 18 24 2 9 13 10 11 7 31 2 12 5 30 16 14 18 40 33 34 36 10 3 45 13 0 1 17 7 9 37 11 38 22 8 50 29 60 21 58 28 22 34 62 26 66 46 46 5 15 53 39 38 50 72 66 13 72 74 1 61 12 28 8 10 37 69 15 52 37 67 13 28 8 72 12 67 54 62 82 42 3...
output:
1205137 946233 854195 665059 820911 800511 1000027 600011 800000 1000000 1200000 800000 1000000 600000 800000 1000000 1200000 1400000 1600000 1000000 1200000 800000 800000 600000 800000 1000000 600000 800000 1000000 1200000 800000 600000 600000 800000 1000000 600000 800000 1000000 1200000 800000 600...
result:
ok single line: '1205137 946233 854195 665059 8...000 600000 600000 600000 800000'
Test #13:
score: 0
Accepted
time: 115ms
memory: 138152kb
input:
1 147954 200000 0 0 1 3 1 4 0 1 4 0 6 8 4 1 9 7 4 0 12 9 11 18 8 7 18 13 25 16 18 27 19 23 30 6 17 28 5 18 25 11 26 27 23 16 34 9 46 9 5 45 46 11 37 25 10 22 8 3 31 24 12 59 37 22 58 39 41 11 19 67 36 7 62 6 60 37 26 59 57 37 33 11 68 55 29 57 56 86 65 66 49 50 85 29 28 94 47 18 51 91 60 66 99 27 84...
output:
866496 651259 588843 378168 485782 591939 739788 887724 295908 443862 591816 591816 739770 295908 295908 443862 591816 591816 739770 443862 591816 739770 887724 1035678 591816 739770 887724 591816 591816 739770 443862 591816 443862 443862 443862 591816 739770 887724 443862 591816 739770 887724 44386...
result:
ok single line: '866496 651259 588843 378168 48...70 887724 1035678 591816 739770'
Test #14:
score: 0
Accepted
time: 156ms
memory: 157324kb
input:
1 200000 200000 0 0 2 3 3 4 3 2 8 6 5 0 2 9 0 7 6 8 1 7 19 10 15 13 23 15 11 13 23 21 30 15 20 33 25 22 13 11 10 4 34 17 10 24 41 25 10 17 43 16 50 8 37 52 42 25 2 0 2 42 50 31 17 3 36 31 27 32 23 32 63 51 68 27 58 3 57 62 14 78 42 40 57 0 25 45 73 25 80 13 49 31 21 76 86 57 92 21 15 46 50 75 56 100...
output:
18 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
result:
ok single line: '18 0 0 0 0 0 0 0 0 0 0 0 0 0 0...0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0'
Test #15:
score: 0
Accepted
time: 150ms
memory: 97236kb
input:
4 50000 50000 0 0 2 1 0 3 3 3 3 8 6 0 2 5 4 7 6 5 6 1 8 7 4 10 10 2 10 9 2 4 8 9 1 0 0 10 4 10 6 0 0 7 4 10 9 9 4 0 1 8 7 7 2 1 2 9 4 2 3 3 2 10 4 6 0 4 2 8 8 9 10 6 8 8 3 3 6 7 7 9 6 10 9 4 8 10 5 0 2 3 1 1 0 5 9 7 9 7 8 9 4 8 6 10 2 0 5 6 1 6 0 6 7 0 8 2 6 2 2 2 0 5 3 7 2 3 4 0 7 4 7 3 8 10 6 2 9 ...
output:
50049 100017 50000 100000 150000 50000 100000 50000 100000 150000 200000 250000 50000 100000 150000 200000 50000 100000 150000 200000 50000 100000 150000 50000 100000 50000 100000 150000 200000 50000 100000 50000 100000 50000 100000 150000 200000 250000 50000 100000 150000 50000 50000 100000 50000 5...
result:
ok 4 lines
Test #16:
score: 0
Accepted
time: 124ms
memory: 73176kb
input:
20 10000 10000 0 1 2 1 4 5 2 0 6 7 7 4 3 5 9 1 9 2 1 0 9 9 4 2 9 8 3 9 3 9 1 8 9 7 4 10 2 6 5 9 0 2 8 9 2 4 9 0 2 6 9 3 10 8 9 5 6 0 10 5 9 3 0 8 6 5 0 3 8 1 2 1 8 3 0 9 7 1 7 9 3 3 1 2 7 5 0 1 0 9 5 10 3 5 10 4 8 2 2 4 3 1 6 10 7 1 1 10 3 9 10 6 8 0 6 2 10 10 3 7 1 7 6 0 4 7 0 8 2 2 2 4 10 1 7 8 7 ...
output:
10048 20034 30026 40000 10000 20000 30000 10000 20000 30000 40000 50000 60000 10000 20000 30000 40000 50000 60000 10000 20000 30000 40000 10000 20000 30000 40000 10000 20000 30000 40000 50000 60000 10000 20000 30000 10000 20000 10000 20000 10000 20000 10000 20000 10000 20000 10000 20000 10000 20000 ...
result:
ok 20 lines
Test #17:
score: 0
Accepted
time: 64ms
memory: 77560kb
input:
200 1000 1000 0 0 2 1 0 5 2 0 8 2 5 3 3 7 4 10 1 7 0 2 10 4 8 5 0 6 0 6 4 6 8 1 0 5 1 9 10 6 2 6 9 4 4 2 10 4 1 5 7 6 4 10 4 10 10 1 9 0 4 4 1 6 10 4 8 4 4 6 3 3 10 6 6 0 2 3 5 5 2 2 0 10 0 1 1 3 5 3 4 6 10 9 2 9 1 7 7 10 2 3 10 2 10 1 2 2 6 0 0 2 0 0 7 2 2 7 0 1 3 10 5 0 5 1 6 0 0 7 5 1 3 6 2 3 3 4...
output:
1000 2000 3000 1000 2000 3000 1000 2000 3000 1000 2000 1000 2000 1000 2000 1000 1000 2000 1000 2000 3000 1000 2000 3000 1000 2000 3000 1000 2000 3000 1000 2000 1000 2000 3000 1000 1000 2000 3000 1000 2000 1000 2000 3000 1000 2000 1000 2000 1000 2000 1000 2000 3000 1000 2000 3000 1000 2000 1000 2000 ...
result:
ok 200 lines
Test #18:
score: 0
Accepted
time: 51ms
memory: 77588kb
input:
10000 20 20 0 0 2 0 1 0 0 0 1 9 7 1 4 9 4 2 3 8 4 0 1 2 1 3 1 4 5 6 2 3 1 3 1 19 2 2 1 1 3 7 2 1 1 1 2 2 7 1 2 19 7 2 7 1 2 2 3 1 3 3 20 20 0 0 1 3 3 5 4 0 0 0 2 8 10 6 1 2 2 2 9 9 1 2 1 19 2 1 1 3 4 5 1 1 1 1 2 2 3 4 6 2 2 1 2 2 1 1 1 2 1 1 4 4 2 3 1 1 1 19 2 2 20 20 0 0 2 0 1 0 5 3 8 0 8 5 0 8 1 0...
output:
35 40 60 40 40 40 20 20 40 60 20 20 20 20 40 40 20 40 40 40 37 44 40 40 40 40 40 60 80 100 20 20 40 40 40 40 40 60 20 40 20 40 20 40 20 40 60 40 20 40 60 80 20 40 60 80 20 20 40 60 52 61 69 80 20 20 40 60 80 40 60 20 40 20 40 60 80 60 80 80 37 45 20 40 60 40 60 60 80 60 80 20 40 60 40 40 60 20 40 60...
result:
ok 10000 lines
Test #19:
score: 0
Accepted
time: 46ms
memory: 75492kb
input:
2000 100 100 0 0 2 1 1 4 4 7 1 4 5 6 8 2 10 5 10 9 2 7 0 9 6 0 8 9 1 0 5 7 5 8 10 9 2 4 10 3 3 5 10 10 8 10 7 2 8 7 1 10 4 1 6 4 0 6 0 3 0 8 10 3 10 10 7 4 6 0 6 8 9 3 9 2 3 0 7 4 1 9 3 7 1 6 2 5 5 9 2 5 3 8 4 8 10 0 6 5 2 6 1 2 1 1 2 1 2 1 3 3 1 1 1 31 1 2 2 1 3 2 87 2 2 4 2 3 4 5 3 3 4 3 52 4 4 4 ...
output:
143 216 310 300 400 400 400 500 100 200 100 200 300 400 500 300 200 100 200 300 100 100 200 300 400 500 300 300 300 200 300 400 500 300 100 200 300 100 200 100 100 200 300 400 100 200 300 100 200 300 400 500 100 200 300 100 200 300 400 500 300 300 300 400 100 200 300 100 200 300 100 200 300 400 100 ...
result:
ok 2000 lines
Test #20:
score: 0
Accepted
time: 184ms
memory: 113204kb
input:
2 100000 100000 0 1 0 1 2 2 0 5 1 0 1 8 5 4 1 3 0 2 3 1 8 8 8 2 9 2 7 8 9 4 10 10 7 2 9 8 6 3 1 0 0 3 1 2 5 10 1 3 2 2 8 4 0 4 0 0 4 0 7 7 1 5 6 2 4 5 2 9 3 1 3 5 2 1 8 9 1 1 4 0 10 3 1 5 0 0 8 5 10 8 2 2 3 9 10 0 7 10 6 8 6 4 7 10 1 5 5 4 10 6 4 10 4 1 1 10 9 2 0 9 9 1 4 3 0 2 2 2 7 4 6 2 2 9 0 4 1...
output:
100053 200017 300014 400010 100000 200000 300000 100000 200000 100000 200000 300000 400000 500000 100000 200000 300000 400000 100000 200000 300000 100000 100000 200000 100000 100000 200000 300000 100000 100000 200000 100000 200000 100000 200000 100000 100000 100000 200000 100000 100000 200000 100000...
result:
ok 2 lines
Test #21:
score: 0
Accepted
time: 182ms
memory: 155680kb
input:
1 200000 200000 0 0 0 3 4 1 5 6 6 2 2 4 1 0 3 8 4 7 5 5 2 1 10 7 6 2 5 0 2 10 6 0 6 7 9 6 3 3 4 1 4 8 8 6 0 3 3 7 8 5 8 2 4 8 6 9 4 0 0 1 4 1 9 3 0 5 10 2 10 7 6 1 4 0 2 3 4 5 3 3 5 4 3 3 9 6 9 9 8 5 5 0 1 1 8 4 1 10 8 3 5 4 4 2 4 6 3 10 10 8 10 10 8 2 0 6 9 4 4 10 2 10 0 9 6 8 8 7 10 10 3 10 0 3 3 ...
output:
200039 400000 600000 200000 400000 600000 800000 1000000 200000 400000 600000 200000 400000 600000 800000 200000 200000 400000 600000 800000 200000 400000 600000 800000 200000 400000 600000 200000 400000 600000 200000 400000 600000 200000 400000 200000 400000 600000 200000 400000 600000 800000 20000...
result:
ok single line: '200039 400000 600000 200000 40...000 400000 600000 200000 400000'
Test #22:
score: 0
Accepted
time: 173ms
memory: 152952kb
input:
1 199999 199999 0 0 2 3 3 5 3 6 5 4 9 10 0 6 6 7 2 2 6 1 9 6 5 3 7 2 3 6 2 3 5 0 2 9 1 3 10 5 0 5 1 4 8 1 0 1 9 3 7 6 2 5 2 8 0 10 9 0 10 3 10 4 4 10 5 4 5 10 3 10 1 5 0 8 2 9 7 2 4 2 7 7 3 2 5 1 1 0 1 9 5 7 0 2 0 4 8 9 4 1 5 0 4 2 2 10 7 9 7 4 7 5 1 10 10 8 3 4 2 1 3 2 2 3 2 3 6 10 1 1 9 7 1 4 7 3 ...
output:
200040 400010 600003 799996 999995 199999 399998 599997 799996 999995 1199994 199999 399998 599997 799996 999995 199999 399998 599997 799996 999995 199999 199999 399998 599997 799996 999995 199999 399998 599997 199999 399998 599997 799996 999995 199999 399998 599997 199999 199999 399998 199999 39999...
result:
ok single line: '200040 400010 600003 799996 99...98 599997 799996 999995 1199994'
Test #23:
score: 0
Accepted
time: 143ms
memory: 99352kb
input:
4 50000 50000 0 0 2 1 0 3 3 3 3 8 6 2 11 12 8 9 15 2 12 18 2 18 10 0 14 17 15 19 26 11 17 14 23 20 29 12 8 4 6 8 19 3 35 32 16 3 28 19 18 31 7 43 34 47 46 36 42 4 11 50 45 0 36 15 54 48 8 18 21 1 6 25 2 54 46 13 61 28 46 9 70 55 65 51 10 18 9 66 50 64 89 0 80 80 58 10 75 58 19 92 46 38 97 14 31 13 6...
output:
288505 237582 269937 298119 298630 312233 361330 400000 450000 500000 550000 600000 200000 200000 250000 300000 300000 300000 350000 400000 450000 500000 550000 600000 650000 400000 400000 350000 200000 250000 300000 350000 400000 450000 500000 550000 600000 400000 450000 200000 250000 300000 350000...
result:
ok 4 lines
Test #24:
score: 0
Accepted
time: 95ms
memory: 83092kb
input:
20 10000 10000 0 1 2 1 4 5 2 0 6 7 7 11 8 3 2 8 3 4 4 16 14 20 1 1 18 14 11 11 11 16 2 2 9 12 7 11 10 25 34 7 25 4 18 42 22 7 31 13 48 42 4 13 16 19 9 50 19 36 35 20 43 49 4 17 55 60 65 13 4 43 14 1 40 25 16 73 7 50 63 54 23 33 4 60 66 44 44 45 88 3 28 60 34 16 9 67 69 73 2 50 75 69 90 62 85 42 38 8...
output:
63852 47761 52015 57429 62431 64986 70241 80000 90000 100000 110000 120000 40000 30000 40000 50000 60000 70000 80000 90000 100000 40000 50000 60000 70000 70000 80000 90000 100000 110000 120000 50000 60000 40000 40000 50000 60000 70000 20000 30000 40000 50000 60000 70000 80000 40000 50000 60000 70000...
result:
ok 20 lines
Test #25:
score: 0
Accepted
time: 62ms
memory: 77752kb
input:
200 1000 1000 0 0 2 1 0 5 2 0 8 2 5 5 9 13 8 9 9 11 11 1 5 4 15 16 2 12 4 11 3 20 4 11 0 26 33 31 14 18 22 39 11 3 38 2 38 26 7 33 22 2 45 33 25 32 10 29 34 9 40 34 26 40 57 34 31 48 23 66 7 10 50 43 52 42 27 8 5 72 18 38 42 8 44 51 61 68 32 80 57 51 34 39 27 1 61 6 7 8 35 42 83 99 14 12 81 51 16 52...
output:
4320 2967 3578 4117 5045 1000 2000 3000 4000 5000 6000 7000 3000 4000 4000 5000 6000 1000 2000 3000 4000 5000 6000 7000 1000 2000 3000 4000 5000 6000 7000 8000 9000 4000 3000 3000 4000 5000 1000 2000 3000 4000 1000 2000 3000 4000 1000 2000 3000 4000 1000 2000 3000 4000 5000 6000 7000 8000 1000 2000 ...
result:
ok 200 lines
Test #26:
score: 0
Accepted
time: 50ms
memory: 77356kb
input:
10000 20 20 0 0 2 0 1 0 0 0 1 9 7 8 0 9 8 3 16 14 17 16 1 2 1 3 1 4 5 6 2 3 1 1 7 19 2 1 1 1 1 2 2 1 1 1 1 2 2 2 1 1 2 1 2 19 2 1 1 2 2 2 20 20 0 1 0 3 3 4 0 2 6 8 10 2 2 9 10 7 3 4 8 0 1 1 2 1 2 1 3 1 1 1 12 2 3 1 2 1 14 2 2 4 1 1 3 1 1 1 1 2 1 2 1 1 1 1 1 2 1 1 1 12 20 20 0 0 1 0 4 5 5 1 5 3 3 5 4...
output:
32 40 60 80 100 40 20 20 40 60 80 40 40 60 20 40 60 80 20 20 50 63 60 40 40 60 80 100 40 60 40 60 80 100 80 100 40 60 80 0 22 40 60 20 40 60 80 100 60 60 40 40 20 40 60 20 40 60 80 40 20 20 40 60 80 40 60 40 40 20 20 40 60 80 100 40 60 40 60 40 43 45 60 60 60 80 60 80 100 80 20 40 60 60 60 60 40 60 ...
result:
ok 10000 lines
Test #27:
score: 0
Accepted
time: 60ms
memory: 77268kb
input:
2000 100 100 0 0 2 1 1 4 4 7 1 4 5 9 10 3 11 4 6 7 9 11 2 20 3 6 20 5 14 6 18 8 24 3 21 22 30 18 9 30 30 15 11 27 20 32 4 4 13 31 13 20 23 0 52 11 0 33 48 53 31 5 38 2 9 34 28 37 29 50 45 21 47 62 57 38 66 10 73 36 15 66 68 19 61 32 32 84 82 20 23 81 14 3 64 22 40 56 59 72 13 90 1 2 1 1 2 1 2 1 3 3 ...
output:
282 335 384 444 400 500 400 500 300 400 300 100 200 300 400 500 100 200 300 400 500 300 400 500 600 700 800 600 400 500 600 700 200 300 400 300 400 300 300 400 400 400 500 300 400 500 500 300 400 400 500 600 700 800 900 200 300 400 500 600 700 500 600 300 400 500 600 700 200 300 400 500 600 700 800 ...
result:
ok 2000 lines
Test #28:
score: 0
Accepted
time: 186ms
memory: 115700kb
input:
2 100000 100000 0 1 0 1 2 2 0 5 1 0 1 11 11 12 2 12 13 9 15 15 5 19 16 16 4 11 5 17 8 24 2 27 7 22 19 26 10 0 6 13 34 25 39 35 15 40 9 1 29 1 40 5 16 43 44 12 22 24 37 34 53 26 23 37 32 27 43 41 60 12 28 46 33 48 0 56 23 8 50 31 17 50 59 33 44 52 21 82 7 78 2 63 41 14 65 71 25 58 39 41 36 38 79 65 3...
output:
758723 647071 548659 400000 500000 600000 700000 800000 900000 1000000 300000 400000 500000 600000 600000 700000 800000 900000 1000000 1100000 1200000 1300000 1400000 1500000 1600000 1700000 1800000 1900000 200000 300000 400000 400000 500000 600000 700000 800000 900000 1000000 700000 400000 500000 5...
result:
ok 2 lines
Test #29:
score: 0
Accepted
time: 198ms
memory: 156676kb
input:
1 200000 200000 0 0 0 3 4 1 5 6 6 2 2 1 12 11 10 0 0 9 0 7 17 12 11 0 3 24 19 23 6 1 20 28 6 11 3 8 36 28 15 17 21 1 16 17 17 42 6 11 11 48 35 38 23 51 39 16 3 40 32 53 46 12 26 37 24 60 35 61 6 63 5 14 50 17 38 17 26 18 5 66 33 50 70 29 3 17 15 20 9 6 6 34 16 10 17 89 29 15 19 29 61 77 90 55 36 87 ...
output:
1197028 1000044 1025334 960818 1000000 1200000 1400000 1600000 1800000 600000 800000 1000000 800000 1000000 1200000 1400000 1600000 1800000 2000000 2200000 2400000 1600000 1400000 800000 1000000 1200000 1400000 1600000 1800000 2000000 2200000 2400000 2600000 2800000 3000000 3200000 1400000 1600000 1...
result:
ok single line: '1197028 1000044 1025334 960818...1000000 1200000 1400000 1600000'
Test #30:
score: 0
Accepted
time: 182ms
memory: 156024kb
input:
1 199999 199999 0 0 2 3 3 5 3 6 5 4 9 10 10 13 5 7 11 9 3 19 4 6 13 20 2 2 13 13 28 2 10 2 24 7 30 35 33 28 30 37 29 28 41 1 27 12 16 4 37 6 12 9 49 41 11 33 51 38 35 18 15 18 25 36 21 37 7 39 42 27 61 32 67 6 73 64 40 36 73 43 63 42 52 26 31 57 42 66 29 66 10 74 6 0 27 33 10 10 26 90 10 49 81 70 2 ...
output:
1090231 436061 634571 817408 1016303 1199994 1399993 799996 999995 1199994 1399993 1599992 1799991 1399993 1599992 1799991 1999990 1199994 799996 999995 799996 999995 1199994 1399993 1599992 1799991 1999990 2199989 199999 399998 599997 799996 999995 1199994 1399993 1599992 1799991 1999990 2199989 23...
result:
ok single line: '1090231 436061 634571 817408 1...95 1199994 999995 599997 799996'
Test #31:
score: 0
Accepted
time: 78ms
memory: 102580kb
input:
4 50000 50000 0 0 2 3 3 5 5 7 7 8 10 10 12 12 13 15 15 16 17 18 20 20 21 22 24 25 26 27 27 29 29 30 32 32 33 34 36 36 37 38 39 41 41 42 44 45 45 47 48 49 49 51 51 53 53 54 56 56 58 58 59 60 62 63 64 64 65 66 68 69 70 71 71 72 74 75 76 76 77 79 79 81 82 83 84 84 85 86 88 88 90 90 91 92 94 94 95 96 97...
output:
188090278 125577948 27477204 6256133 4267648 3055058 852275 656426 578246 582442 622761 650883 661152 711152 761152 800000 850000 900000 950000 1000000 1050000 1100000 1150000 1200000 1250000 1300000 1350000 1400000 1450000 1500000 1550000 1600000 1650000 1700000 1750000 1800000 1850000 1900000 1950...
result:
ok 4 lines
Test #32:
score: 0
Accepted
time: 74ms
memory: 81444kb
input:
20 10000 10000 0 1 2 3 4 5 5 6 7 9 10 11 11 13 13 14 16 16 17 18 19 20 21 23 23 24 25 27 28 28 30 30 32 32 34 35 36 37 38 39 39 40 42 42 44 45 45 47 48 48 50 51 51 53 53 54 56 56 58 58 60 61 62 63 64 64 65 67 67 69 69 71 72 73 73 75 75 76 77 78 80 81 81 82 83 84 86 87 88 89 89 90 91 92 93 95 96 97 9...
output:
22326794 15093909 10369474 7092585 4914232 1179031 773981 551881 461590 186577 157897 150099 160099 155451 157976 165568 170443 180000 190000 200000 210000 220000 230000 240000 250000 260000 270000 280000 290000 300000 310000 320000 330000 340000 350000 360000 370000 380000 390000 400000 410000 4200...
result:
ok 20 lines
Test #33:
score: 0
Accepted
time: 62ms
memory: 75832kb
input:
200 1000 1000 0 0 1 3 3 5 5 6 7 8 9 11 12 13 14 15 15 17 18 19 20 20 21 22 24 24 26 27 27 28 29 31 31 32 33 35 35 36 38 39 39 41 41 42 44 44 46 47 48 48 50 51 52 52 53 55 55 57 58 58 59 60 62 62 64 64 65 66 67 68 70 71 72 72 73 74 76 76 78 78 79 80 82 83 83 84 85 86 88 89 89 91 92 93 94 94 95 96 98 ...
output:
218189 151205 38127 12319 9973 8838 8845 9845 10345 10197 11119 12119 13000 14000 15000 16000 17000 18000 19000 20000 21000 22000 23000 24000 25000 26000 27000 28000 29000 30000 31000 32000 33000 34000 35000 36000 37000 38000 39000 40000 41000 42000 43000 44000 45000 46000 47000 48000 49000 50000 51...
result:
ok 200 lines
Test #34:
score: 0
Accepted
time: 50ms
memory: 77292kb
input:
10000 20 20 0 0 1 2 3 4 5 6 8 9 9 10 12 13 13 15 15 16 17 18 1 2 1 1 1 1 1 1 1 3 2 1 1 19 2 1 2 1 1 1 2 1 1 1 1 3 1 1 2 2 2 1 1 1 1 2 2 1 1 1 20 20 0 1 2 3 3 5 6 7 8 8 9 10 12 12 14 14 15 17 17 19 1 1 1 1 2 19 1 1 1 2 1 1 1 2 7 2 1 1 2 1 1 1 1 2 19 1 1 2 1 2 7 1 1 2 1 2 7 1 2 1 20 20 0 1 1 2 3 5 5 6...
output:
42 57 68 88 100 120 140 160 180 200 20 40 60 80 100 120 20 40 60 80 116 95 83 80 100 120 140 160 180 200 220 240 260 0 20 0 0 20 0 20 97 61 73 80 100 120 140 160 180 200 20 40 60 80 60 80 100 120 40 60 122 109 94 60 80 100 120 60 80 100 120 140 160 180 200 220 240 260 60 0 47 20 40 60 80 100 120 140...
result:
ok 10000 lines
Test #35:
score: 0
Accepted
time: 54ms
memory: 77372kb
input:
2000 100 100 0 0 1 3 3 4 6 7 8 8 10 11 11 13 13 14 16 17 17 19 20 20 22 22 23 25 26 26 27 28 29 31 31 32 34 34 35 36 37 39 40 41 42 42 44 44 46 47 48 48 49 50 51 53 54 55 55 57 57 59 59 60 62 62 63 65 65 66 67 69 70 70 72 72 74 74 76 76 78 78 79 81 82 82 83 84 85 86 88 89 90 91 92 92 93 94 95 96 98 ...
output:
1001 687 536 559 521 621 721 770 772 774 700 800 900 1000 1100 1200 1300 1400 1500 1600 1700 1800 1900 2000 2100 2200 2300 2400 2500 2600 2700 2800 2900 3000 300 400 500 600 700 700 700 800 900 1000 1100 1200 1300 1400 1500 1600 1700 1800 1900 2000 2100 2200 2300 2400 2500 2600 2700 2800 2900 3000 3...
result:
ok 2000 lines
Test #36:
score: 0
Accepted
time: 108ms
memory: 124436kb
input:
2 100000 100000 0 1 2 3 4 4 5 7 7 8 10 11 11 12 14 14 16 17 17 19 19 21 21 22 23 25 25 27 28 28 30 31 32 32 34 34 36 36 38 39 40 41 41 43 44 44 45 47 48 49 49 51 51 53 54 54 56 56 57 58 59 60 61 63 64 65 66 67 68 68 70 70 72 72 73 74 76 76 77 79 79 80 81 83 84 84 86 86 88 88 90 91 91 92 93 95 95 96 ...
output:
2250241090 1523793708 1033179617 701154531 474210823 321036710 218474380 148131691 101318737 68720149 46975529 1200000 1300000 1400000 1500000 1600000 1700000 1800000 1900000 2000000 2100000 2200000 2300000 2400000 2500000 2600000 2700000 2800000 2900000 3000000 3100000 3200000 3300000 3400000 35000...
result:
ok 2 lines
Test #37:
score: 0
Accepted
time: 95ms
memory: 168384kb
input:
1 200000 200000 0 0 2 3 3 5 6 6 7 8 9 11 12 13 14 14 15 17 18 19 19 20 22 22 24 24 25 27 28 29 30 30 31 33 33 34 35 36 38 39 40 41 41 43 44 44 46 47 48 48 49 50 52 53 53 54 56 56 57 59 59 60 61 63 64 64 66 67 68 69 70 70 71 73 74 75 75 76 78 78 80 80 82 83 84 85 85 86 87 88 89 90 92 92 93 95 95 97 9...
output:
3003138159 2021629081 450014258 303993020 202114190 1200000 1400000 1600000 1800000 2000000 2200000 2400000 2600000 2800000 3000000 3200000 3400000 3600000 3800000 4000000 4200000 4400000 4600000 4800000 5000000 5200000 5400000 5600000 5800000 6000000 6200000 6400000 6600000 6800000 7000000 7200000 ...
result:
ok single line: '3003138159 2021629081 45001425...000 600000 200000 400000 600000'
Test #38:
score: 0
Accepted
time: 116ms
memory: 169568kb
input:
1 199999 199999 0 0 1 3 4 5 6 6 7 8 9 10 12 13 13 15 15 17 18 19 20 20 22 22 23 24 26 27 28 28 29 30 31 33 34 35 35 36 38 39 40 40 41 43 43 44 46 46 47 48 49 51 52 53 53 55 56 56 57 58 59 60 61 62 64 65 65 67 68 69 70 70 72 72 74 74 75 76 78 79 80 80 82 82 84 85 85 86 87 88 89 90 92 92 93 95 96 96 9...
output:
9007397334 6080356813 4107759140 2786037590 1890806878 429291715 282962112 187292968 128681575 31270610 9483803 6746400 5494150 5033437 3181991 3373965 3539381 3636850 3827539 4027538 4199979 4399978 4599977 4799976 4999975 5199974 5399973 5599972 5799971 5999970 6199969 6399968 6599967 6799966 6999...
result:
ok single line: '9007397334 6080356813 41077591...999 199999 199999 199999 399998'
Test #39:
score: 0
Accepted
time: 78ms
memory: 107492kb
input:
4 50000 50000 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98...
output:
1250074999 1250124997 1250174994 1250224990 1250274985 1250324979 1250374972 1250424964 1250474955 1250524945 1250574934 1250624922 1250674909 1250724895 1250774880 1250824864 1250874847 1250924829 1250974810 1251024790 1251074769 1251124747 1251174724 1251224700 1251274675 1251324649 1251374622 125...
result:
ok 4 lines
Test #40:
score: 0
Accepted
time: 72ms
memory: 85644kb
input:
20 10000 10000 0 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 9...
output:
50014999 50024997 50034994 50044990 50054985 50064979 50074972 50084964 50094955 50104945 50114934 50124922 50134909 50144895 50154880 50164864 50174847 50184829 50194810 50204790 50214769 50224747 50234724 50244700 50254675 50264649 50274622 50284594 50294565 50304535 50314504 50324472 50334439 503...
result:
ok 20 lines
Test #41:
score: 0
Accepted
time: 59ms
memory: 77740kb
input:
200 1000 1000 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98...
output:
501499 502497 503494 504490 505485 506479 507472 508464 509455 510445 511434 512422 513409 514395 515380 516364 517347 518329 519310 520290 521269 522247 523224 524200 525175 526149 527122 528094 529065 530035 531004 531972 532939 533905 534870 535834 536797 537759 538720 539680 540639 541597 542554...
result:
ok 200 lines
Test #42:
score: 0
Accepted
time: 40ms
memory: 75348kb
input:
10000 20 20 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 20 20 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 20 20 0 1 2 3 4 5 6 7 ...
output:
229 247 264 280 295 309 322 334 345 355 364 372 379 385 390 394 397 399 400 400 229 247 264 280 295 309 322 334 345 355 364 372 379 385 390 394 397 399 400 400 229 247 264 280 295 309 322 334 345 355 364 372 379 385 390 394 397 399 400 400 229 247 264 280 295 309 322 334 345 355 364 372 379 385 390 ...
result:
ok 10000 lines
Test #43:
score: 0
Accepted
time: 48ms
memory: 73260kb
input:
2000 100 100 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 ...
output:
5149 5247 5344 5440 5535 5629 5722 5814 5905 5995 6084 6172 6259 6345 6430 6514 6597 6679 6760 6840 6919 6997 7074 7150 7225 7299 7372 7444 7515 7585 7654 7722 7789 7855 7920 7984 8047 8109 8170 8230 8289 8347 8404 8460 8515 8569 8622 8674 8725 8775 8824 8872 8919 8965 9010 9054 9097 9139 9180 9220 ...
result:
ok 2000 lines
Test #44:
score: 0
Accepted
time: 86ms
memory: 133020kb
input:
2 100000 100000 0 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 ...
output:
5000149999 5000249997 5000349994 5000449990 5000549985 5000649979 5000749972 5000849964 5000949955 5001049945 5001149934 5001249922 5001349909 5001449895 5001549880 5001649864 5001749847 5001849829 5001949810 5002049790 5002149769 5002249747 5002349724 5002449700 5002549675 5002649649 5002749622 500...
result:
ok 2 lines
Test #45:
score: 0
Accepted
time: 107ms
memory: 189820kb
input:
1 200000 200000 0 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 ...
output:
20000299999 20000499997 20000699994 20000899990 20001099985 20001299979 20001499972 20001699964 20001899955 20002099945 20002299934 20002499922 20002699909 20002899895 20003099880 20003299864 20003499847 20003699829 20003899810 20004099790 20004299769 20004499747 20004699724 20004899700 20005099675 ...
result:
ok single line: '20000299999 20000499997 200006...9999999 40000000000 40000000000'
Test #46:
score: 0
Accepted
time: 123ms
memory: 188176kb
input:
1 199999 199999 0 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 ...
output:
20000099998 20000299995 20000499991 20000699986 20000899980 20001099973 20001299965 20001499956 20001699946 20001899935 20002099923 20002299910 20002499896 20002699881 20002899865 20003099848 20003299830 20003499811 20003699791 20003899770 20004099748 20004299725 20004499701 20004699676 20004899650 ...
result:
ok single line: '20000099998 20000299995 200004...9600000 39999600001 39999600001'
Test #47:
score: 0
Accepted
time: 155ms
memory: 155172kb
input:
1 200000 200000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
output:
200000 200000 200000 200000 200000 200000 200000 200000 200000 200000 200000 200000 200000 200000 200000 200000 200000 200000 200000 200000 200000 200000 200000 200000 200000 200000 200000 200000 200000 200000 200000 200000 200000 200000 200000 200000 200000 200000 200000 200000 200000 200000 200000...
result:
ok single line: '200000 200000 200000 200000 20...000 200000 200000 200000 200000'
Test #48:
score: 0
Accepted
time: 144ms
memory: 119768kb
input:
2 100000 100000 0 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 ...
output:
391389195 391187974 390986723 390785442 390584131 390382790 390181172 389979524 389777846 389576138 389374400 389172632 388970834 388769006 388567148 388365260 388164009 387962728 387761417 387560076 387358705 387157304 386954673 386752011 386549318 386346594 386144284 385941943 385738371 385534767 ...
result:
ok 2 lines
Test #49:
score: 0
Accepted
time: 123ms
memory: 162620kb
input:
1 200000 200000 0 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 ...
output:
1111951281 1110977962 1110009559 1109041039 1108072402 1107103648 1106134314 1105164861 1104200831 1103236682 1102272414 1101307565 1100342596 1099382231 1098421746 1097461141 1096500416 1095539571 1094578606 1093617521 1092656316 1091694991 1090733546 1089771543 1088809419 1087847174 1086884808 108...
result:
ok single line: '1111951281 1110977962 11100095...053200000 1053400000 1053600000'
Test #50:
score: 0
Accepted
time: 145ms
memory: 161280kb
input:
1 199999 199999 0 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 ...
output:
917520210 916814620 916118823 915428983 914739092 914049150 913359157 912670391 911983936 911297430 910610873 909924265 909242343 908560370 907878346 907196271 906514145 905838454 905162712 904486919 903821493 903156016 902490488 901824909 901159279 900504966 899850602 899196187 898541721 897887204 ...
result:
ok single line: '917520210 916814620 916118823 ...9512 97799511 97999510 98199509'
Test #51:
score: 0
Accepted
time: 113ms
memory: 105424kb
input:
4 50000 50000 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98...
output:
156981839 156851070 156720271 156589442 156458583 156330816 156204885 156081233 155958223 155835183 155712113 155589013 155465883 155342723 155219533 155096313 154973063 154849783 154726473 154603133 154479763 154356363 154232933 154109473 153985983 153862463 153738913 153616547 153494149 153371719 ...
result:
ok 4 lines
Test #52:
score: 0
Accepted
time: 90ms
memory: 82288kb
input:
20 10000 10000 0 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 9...
output:
15313878 15293295 15272705 15252108 15231504 15210893 15190275 15169650 15149018 15128379 15107733 15087080 15066420 15045753 15027790 15009820 14991843 14973859 14955868 14937870 14919865 14901853 14883834 14865808 14847775 14829735 14811688 14793634 14775572 14757502 14739424 14721338 14703244 146...
result:
ok 20 lines
Test #53:
score: 0
Accepted
time: 76ms
memory: 78224kb
input:
200 1000 1000 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98...
output:
495443 491076 486703 482324 477939 473548 469151 464748 460339 455980 451615 447244 442867 438484 434095 429700 425299 421876 418447 415011 411568 408118 404660 401194 397720 394238 390748 387250 383744 380230 376708 373178 369640 366094 362875 359648 356413 354117 351813 349500 347178 344847 342507...
result:
ok 200 lines
Test #54:
score: 0
Accepted
time: 125ms
memory: 120900kb
input:
2 100000 100000 0 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 ...
output:
49426978 1069745 1169745 1269745 1369745 1469745 1569745 1669745 1769745 1869745 1969745 2069745 2169745 2269745 2369745 2469745 2569745 2669745 2769745 2869745 2969745 3069745 3169745 3269745 3369745 3469745 3569745 3669745 3769745 3869745 3969745 4069745 4169745 4269745 4369745 4469745 4569745 466...
result:
ok 2 lines
Test #55:
score: 0
Accepted
time: 89ms
memory: 163188kb
input:
1 200000 200000 0 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 ...
output:
2151127 2351127 2550258 2750258 2950258 3150258 3350258 3550258 3750258 3950258 4150258 4350258 4550258 4750258 3000000 3200000 3400000 3600000 3800000 4000000 4200000 4400000 4600000 4800000 5000000 5200000 5400000 5600000 5800000 6000000 6200000 6400000 6600000 6800000 7000000 7200000 7400000 7600...
result:
ok single line: '2151127 2351127 2550258 275025...0000 14400000 14600000 14800000'
Test #56:
score: 0
Accepted
time: 90ms
memory: 162148kb
input:
1 199999 199999 0 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 ...
output:
2150395 2350394 2550393 2750392 2950391 3150390 3350389 3550388 3750387 3950386 4150385 4350384 2199989 2399988 2599987 2799986 2999985 3199984 3399983 3599982 3799981 3999980 4199979 4399978 4599977 4799976 4999975 5199974 5399973 5599972 5799971 5999970 6199969 6399968 6599967 6799966 6999965 7199...
result:
ok single line: '2150395 2350394 2550393 275039...9765 46999765 46999765 46999765'
Test #57:
score: 0
Accepted
time: 125ms
memory: 101684kb
input:
4 50000 50000 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98...
output:
20975240 522824 572824 578175 628175 678175 726984 776984 825766 875766 925766 975766 1025766 1075766 1125766 1174613 1224613 1274613 1324613 1374613 1424613 1474018 1524018 1574018 1624018 1674018 1724018 1774018 1824018 1874018 1924018 1974018 2024018 2074018 2124018 2174018 2224018 2274018 232401...
result:
ok 4 lines
Extra Test:
score: 0
Extra Test Passed