QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#491207 | #8759. 小班课 | Yansuan_HCl | AC ✓ | 24ms | 13032kb | C++14 | 5.6kb | 2024-07-25 17:35:18 | 2024-07-25 17:35:18 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define U(i,l,r) for (int i(l),END##i(r); i<=END##i; ++i)
#define D(i,l,r) for (int i(l),END##i(r); i>=END##i; --i)
#define ms(x, v) memset(x, v, sizeof(x))
#define il __attribute__((always_inline))
#define vc vector
#define ar array
#define pb push_back
#define eb emplace_back
#define el '\n'
using ll = long long;
const int N = 505;
int n, m, b[N];
int _T, __T;
namespace dinic {
const int N = 1005, M = 800005, INF = 0x3f3f3f3f;
struct edge { int v, f, pre; } e[M]; int tail[N], ptr = 1;
void single(int u, int v, int f) {
e[++ptr] = {v, f, tail[u]};
tail[u] = ptr;
}
void add(int u, int v, int f) {
single(u, v, f);
single(v, u, 0);
}
int layer[N], que[N];
bool bfs(int s, int t) {
ms(layer, 0); int l = 0, r = 1; que[0] = s; layer[s] = 1;
while (l < r) {
int u = que[l++];
for (int p = tail[u]; p; p = e[p].pre) {
auto [v, f, _] = e[p];
if (!layer[v] && f)
layer[que[r++] = v] = layer[u] + 1;
}
}
return layer[t];
}
int dfs(int u, int in, int t) {
if (u == t || !in) return in;
int out = 0;
for (int &p = tail[u]; p; p = e[p].pre) {
auto &[v, f, _] = e[p];
if (!f || layer[v] != layer[u] + 1) continue;
int c = dfs(v, min(f, in), t);
f -= c; e[p ^ 1].f += c;
in -= c; out += c;
if (!in) break;
}
return out;
}
int flow(int s, int t) {
int orig[N], res = 0;
while (bfs(s, t)) {
memcpy(orig, tail, sizeof(tail));
int cur = dfs(s, INF, t);
res += cur;
// clog << cur << endl;
memcpy(tail, orig, sizeof(tail));
}
return res;
}
void clear() { ms(tail, 0); ptr = 1; }
}
#define de dinic::
void solve() {
#define Assert(x) if (!(x)) { cout << "FAIL@" << __LINE__ << endl; print(); exit(0); }
int n, m; cin >> n >> m;
int S = de N - 1, T = S - 1;
int sum[N] {};
U (i, 1, m) {
cin >> b[i]; sum[i] = sum[i - 1] + b[i];
de add(n + i, T, b[i]);
}
vc<int> a[N], eg[N]; int beg[N] {};
auto print = [&]() {
cout << "**" << endl;
cout << n << ' ' << m << endl;
U (i, 1, m) cout << b[i] << ' '; cout << endl;
U (i, 1, n) {
cout << a[i].size();
for (int u : a[i])
cout << ' ' << u;
cout << endl;
}
};
U (i, 1, n) {
de add(S, i, 1);
int k; cin >> k;
a[i].resize(k); eg[i].resize(k); int j = 0;
for (int &u : a[i]) {
cin >> u;
de add(i, n + u, 1);
eg[i][j++] = de ptr;
}
}
// if (_T == 125 && __T <= 5) {
// cout << "#" << __T << endl;
// print();
// }
int cnt[N] {}, mat[N] {}, ans[N] {}; memcpy(cnt, b, sizeof(b));
int fl = de flow(S, T);
int trash = n;
U (i, 1, n) {
mat[i] = -1;
U (j, 0, int(a[i].size()) - 1) if (de e[eg[i][j]].f) {
mat[i] = j;
break;
}
if (mat[i] == -1)
ans[i] = trash--;
}
// clog << "fin" << endl;
// clog << fl << "*";
// U (i, 1, n)
// clog << (mat[i] == -1 ? -1 : a[i][mat[i]]) << ' ';
// clog << endl;
auto shrink = [&ans, &n, &cnt, &a, &beg, &mat, &print]() {
U (i, 1, n) if (!ans[i]) {
while (!cnt[a[i][beg[i]]]) {
++beg[i];
Assert(beg[i] <= mat[i]);
if (beg[i] == a[i].size())
Assert(0);
}
}
};
auto done = [&ans, &cnt, &beg, &mat, &a, &n, &shrink, &print](int j, int t) {
// clog << j << '@' << a[j][mat[j]] << endl;
// clog << "ans_" << j << "=" << t << endl;
ans[j] = t;
--cnt[a[j][mat[j]]];
shrink();
};
shrink();
U (_, 1, trash) { // 依次确定前 i 个
// clog << "^" << _ << endl;
int f = 0;
U (j, 1, n) if (!ans[j] && mat[j] == beg[j]) {
f = j;
break;
}
if (f) {
done(f, _);
continue;
}
int pre[N] {}; memcpy(pre, b, sizeof(b));
U (j, 1, n) if (mat[j] != -1)
--pre[a[j][mat[j]]];
U (j, 1, n) if (!ans[j] && pre[a[j][beg[j]]]) {
mat[j] = beg[j];
f = j; break;
}
if (f) {
done(f, _);
continue;
}
int label[N][2] {}, sc[N] {}, s2[N] {}, mp[N] {}, tot, lim[N] {};
U (i, 1, n) if (!ans[i]) {
if (beg[i] > mat[i])
Assert(0);
++sc[a[i][mat[i]]];
}
U (i, 1, m) {
// Assert(s2[i] == sc[i]);
sc[i] += sc[i - 1];
lim[i] = sc[i - 1];
U (j, sc[i - 1] + 1, sc[i])
mp[j] = i;
}
tot = sc[m];
memcpy(s2, sc, sizeof(sc));
int to[N] {};
U (i, 1, n) if (!ans[i]) {
label[i][0] = max(lim[a[i][beg[i]]] + 1, sc[a[i][beg[i]]]--);
label[i][1] = s2[a[i][mat[i]]]--;
// Assert(sc[a[i][beg[i]]] >= lim[a[i][beg[i]]]);
Assert(s2[a[i][mat[i]]] >= lim[a[i][mat[i]]]);
to[label[i][1]] = label[i][0];
}
int stk[N] {}, sp = 0, vis[N] {}, tag[N] {};
for (int u = 1, cnt = 0; ; u = to[u], ++cnt) {
Assert(cnt <= n);
if (vis[u]) {
do {
tag[stk[sp]] = 1;
} while (stk[sp--] != u);
break;
} else {
vis[u] = 1;
stk[++sp] = u;
}
}
U (i, 1, n) if (!ans[i]) {
if (tag[label[i][1]]) {
mat[i] = beg[i];
Assert(mp[label[i][0]] == a[i][beg[i]]);
} else {
Assert(mp[label[i][1]] == a[i][mat[i]]);
}
}
--_;
}
if (1 || _T != 125) cout << fl << el;
int inv[N] {};
U (i, 1, n)
inv[ans[i]] = i;
U (i, 1, n) {
if (1 || _T != 125) cout << inv[i] << ' ';
Assert(inv[i]);
}
if (1 || _T != 125) cout << el;
}
void clear() {
de clear();
ms(b, 0);
}
int main() {
// freopen("ava.in", "r", stdin);
// freopen(".out", "w", stdout);
ios::sync_with_stdio(0);
cin >> __T;
_T = __T;
while (__T--) {
assert(!cin.eof());
solve();
clear();
}
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3556kb
input:
3 5 5 1 1 1 1 1 4 1 3 2 4 1 5 4 3 4 2 1 2 3 5 1 1 5 3 1 2 2 2 1 2 2 1 2 2 1 3 2 1 3 2 1 3 5 5 1 1 1 1 1 2 1 2 2 5 4 2 3 2 2 4 3 2 5 1
output:
5 2 4 5 1 3 5 3 1 2 4 5 5 1 5 2 4 3
result:
ok Correct!
Test #2:
score: 0
Accepted
time: 1ms
memory: 3864kb
input:
250 2 1 2 1 1 1 1 1 1 1 0 2 2 1 1 1 1 2 2 1 2 2 0 2 2 1 2 1 2 1 1 1 1 1 1 2 1 0 0 1 2 1 0 0 2 1 2 1 1 0 1 2 1 0 0 2 1 2 1 1 1 1 1 1 1 1 1 1 2 1 0 1 2 2 2 2 0 1 1 1 2 1 1 1 0 1 1 1 0 1 2 0 1 1 1 2 2 1 1 1 1 2 1 2 2 2 1 1 2 2 1 2 2 1 1 2 0 1 1 2 2 1 2 1 1 0 2 2 2 0 1 1 1 2 1 1 1 1 1 2 1 2 0 1 1 1 1 1 ...
output:
2 1 2 0 1 2 1 2 2 1 2 1 1 0 1 0 1 1 1 2 0 1 2 1 2 1 1 0 1 1 1 2 0 1 0 1 0 1 2 1 2 2 1 2 1 1 1 1 2 1 1 2 1 1 1 2 1 1 1 1 2 1 0 2 1 1 1 1 1 0 1 1 1 2 1 2 0 1 0 1 1 1 2 2 1 2 0 1 0 1 0 1 0 2 1 2 1 2 1 1 1 1 0 1 0 1 0 1 1 1 1 1 0 1 2 1 2 2 1 2 1 2 1 1 1...
result:
ok Correct!
Test #3:
score: 0
Accepted
time: 1ms
memory: 3676kb
input:
166 3 3 1 1 1 0 2 2 3 0 3 3 0 3 0 0 2 1 3 0 3 3 0 0 3 0 2 2 3 0 3 3 2 0 1 2 2 3 0 2 3 2 3 3 0 2 1 2 3 1 0 2 2 1 3 3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 3 2 2 2 3 4 1 3 1 2 3 4 2 3 4 2 1 4 1 2 3 4 2 1 4 3 2 3 2...
result:
ok Correct!
Test #5:
score: 0
Accepted
time: 0ms
memory: 3676kb
input:
100 5 5 2 1 2 0 0 0 2 3 2 3 5 4 3 2 1 2 0 5 5 0 2 0 0 3 1 5 0 1 1 0 0 5 5 0 1 3 0 1 2 5 4 2 1 5 0 0 3 3 1 4 5 5 1 1 0 2 1 1 2 0 2 4 5 0 1 4 5 5 0 1 1 2 1 2 4 2 0 2 1 3 0 1 1 5 5 0 0 2 2 1 2 4 3 1 4 0 3 5 4 1 3 5 1 2 5 5 1 2 1 0 1 2 1 2 0 3 3 5 2 2 4 3 0 5 5 1 0 1 1 2 0 1 4 1 3 1 3 0 5 5 1 2 1 1 0 1 ...
output:
3 2 3 4 5 1 1 1 5 4 3 2 2 2 5 4 3 1 3 1 5 3 4 2 2 3 1 5 4 2 4 2 5 4 1 3 3 4 1 3 5 2 2 2 4 5 3 1 1 1 5 4 3 2 4 1 2 3 4 5 2 2 3 5 4 1 2 1 4 5 3 2 3 2 5 3 4 1 3 3 4 1 5 2 3 4 1 2 5 3 3 1 3 2 5 4 2 1 3 5 4 2 3 4 1 5 3 2 1 1 5 4 3 2 3 2 5 3 4 1 1 4 5 3 2 1 2 4 3 5 2 1 2 1 4 5 3 2 2...
result:
ok Correct!
Test #6:
score: 0
Accepted
time: 1ms
memory: 3688kb
input:
10 45 47 3 0 2 0 1 1 1 0 2 0 1 0 0 3 0 0 0 4 0 1 0 0 1 2 1 1 1 0 1 1 1 0 0 0 0 1 0 0 0 1 2 4 1 2 1 2 3 7 1 37 21 3 13 43 22 0 10 23 46 22 40 12 19 47 27 16 42 4 29 19 45 35 10 6 26 2 43 41 7 9 16 42 44 5 39 40 34 46 14 3 34 3 38 8 10 5 38 23 19 37 9 34 0 5 31 29 15 13 35 3 40 4 28 1 7 6 29 12 9 35 2...
output:
33 1 7 11 12 14 16 17 19 21 25 29 31 36 37 10 4 18 24 39 3 8 5 6 34 15 35 38 30 13 40 42 43 44 45 41 33 32 28 27 26 23 22 20 9 2 39 1 3 10 12 14 16 18 28 30 40 21 9 29 20 2 44 33 17 35 41 6 26 32 15 19 7 23 24 38 42 45 5 31 34 39 11 36 43 25 37 27 22 13 8 4 36 4 17 20 21 23 2 25 27 31 43 19 46 1 8...
result:
ok Correct!
Test #7:
score: 0
Accepted
time: 3ms
memory: 4276kb
input:
1 499 497 1 2 0 2 0 1 0 0 0 2 1 2 0 3 1 2 0 0 0 1 0 1 0 2 1 0 1 0 1 1 1 2 0 1 0 1 0 2 2 3 1 1 2 1 0 0 1 0 2 3 0 1 0 0 2 0 1 2 1 0 0 1 2 0 0 2 0 2 0 1 0 1 0 0 1 0 0 1 1 1 1 1 0 0 0 1 2 3 0 0 0 4 2 2 1 2 2 0 1 0 1 0 2 0 1 0 2 0 0 1 1 1 3 2 0 2 2 2 0 1 1 1 1 1 0 1 0 1 1 1 1 1 2 0 0 1 0 2 1 2 1 2 1 0 1 ...
output:
482 4 31 66 95 124 126 142 148 153 167 169 190 195 234 259 268 293 318 346 347 359 401 412 40 56 82 104 44 92 76 108 120 205 208 258 275 196 301 333 176 337 396 428 434 438 456 431 202 466 476 497 417 96 418 256 47 18 101 442 33 110 159 291 324 372 433 2 273 344 410 19 207 353 460 463 10 17 38 67 75...
result:
ok Correct!
Test #8:
score: 0
Accepted
time: 24ms
memory: 13032kb
input:
1 498 499 0 1 1 0 1 0 1 0 0 0 0 2 0 3 1 2 4 0 1 0 1 1 0 0 0 1 1 0 0 2 2 0 1 1 1 0 4 1 1 2 1 0 0 1 2 0 1 2 1 0 1 2 0 2 1 2 2 0 2 2 0 1 0 2 0 0 3 0 1 1 1 1 0 1 0 1 0 0 1 1 0 1 1 0 0 1 0 1 2 1 1 0 1 0 1 0 0 0 1 1 2 0 1 0 2 1 1 2 2 0 0 0 0 2 0 2 1 0 1 0 2 0 1 3 1 1 1 0 1 3 0 1 0 1 0 0 1 3 2 3 2 1 1 0 2 ...
output:
498 27 73 349 408 418 435 436 458 467 484 489 67 90 98 140 158 241 249 261 267 299 304 313 321 336 343 353 354 359 361 369 388 394 401 406 413 453 464 475 477 494 66 357 403 410 455 87 178 381 3 34 53 54 121 160 164 209 235 340 342 360 7 137 243 274 322 335 429 497 166 180 207 246 256 265 266 275 31...
result:
ok Correct!
Test #9:
score: 0
Accepted
time: 1ms
memory: 3636kb
input:
5 99 96 2 0 0 1 1 2 1 0 1 1 1 0 0 0 1 0 1 1 2 1 1 1 1 1 0 1 2 4 0 0 0 2 2 1 1 1 1 1 0 2 0 0 0 1 1 3 0 1 0 0 1 2 1 4 1 2 1 0 1 0 0 2 0 0 0 2 3 2 1 0 1 2 2 0 1 1 0 0 1 0 0 1 2 1 3 1 3 1 3 0 3 0 0 2 2 2 2 14 58 1 55 2 53 69 0 0 1 76 2 23 38 1 41 2 74 54 0 0 2 83 91 0 0 0 1 48 0 0 1 96 2 76 52 1 17 2 51...
output:
48 2 3 6 7 9 16 19 20 22 24 26 30 34 23 35 38 39 40 44 45 46 57 60 62 65 66 69 71 72 73 74 77 67 82 87 88 42 92 93 56 94 95 97 59 99 12 53 78 98 96 91 90 89 86 85 84 83 81 80 79 76 75 70 68 64 63 61 58 55 54 52 51 50 49 48 47 43 41 37 36 33 32 31 29 28 27 25 21 18 17 15 14 13 11 10 8 5 4 1 44 7 15 ...
result:
ok Correct!
Test #10:
score: 0
Accepted
time: 1ms
memory: 3624kb
input:
5 99 97 0 2 4 0 0 2 0 1 1 1 0 1 0 3 0 1 1 1 1 0 0 1 0 0 1 2 0 0 1 3 1 2 0 2 1 1 1 3 3 1 2 1 0 1 0 1 0 2 0 0 0 0 1 2 3 1 1 1 0 1 0 1 0 0 1 2 1 2 1 1 1 2 2 3 1 1 0 0 1 1 0 0 1 1 2 1 2 2 0 1 1 1 2 0 1 3 1 2 56 63 2 52 45 4 26 56 80 10 2 27 19 1 81 2 38 64 1 83 1 8 3 14 81 60 3 63 28 15 5 59 33 80 88 56...
output:
72 1 6 7 8 9 12 13 14 16 22 23 24 25 29 30 33 39 40 41 46 47 48 49 53 58 63 70 73 55 76 77 79 81 18 62 83 27 85 42 60 87 91 94 95 97 98 34 37 44 28 54 57 59 68 32 52 64 90 20 65 66 45 71 78 35 3 11 17 72 82 99 96 93 92 89 88 86 84 80 75 74 69 67 61 56 51 50 43 38 36 31 26 21 19 15 10 5 4 2 67 2 7 8...
result:
ok Correct!
Test #11:
score: 0
Accepted
time: 1ms
memory: 3888kb
input:
5 99 98 4 0 1 1 3 2 0 1 4 0 1 1 2 2 1 2 0 0 1 2 1 2 0 1 1 1 2 0 2 0 0 3 0 2 0 0 1 1 1 0 1 1 1 2 0 1 1 0 1 1 1 0 0 1 0 0 2 1 2 3 3 0 0 0 0 0 1 2 1 1 0 3 0 0 0 1 2 0 0 0 0 1 0 2 2 1 2 1 0 1 0 0 1 1 2 3 3 0 5 72 78 90 7 60 6 69 37 10 41 4 59 10 61 85 79 5 7 58 3 55 1 50 6 59 24 30 26 77 21 2 29 21 10 7...
output:
85 5 8 12 20 21 24 27 29 30 42 53 55 46 59 62 63 70 71 72 76 79 33 83 89 90 97 98 1 3 6 11 14 15 32 4 40 47 38 25 67 51 34 35 69 37 73 23 80 82 84 16 54 60 64 77 10 66 85 74 93 49 99 68 58 91 87 41 57 94 75 95 2 86 96 31 43 28 44 26 50 78 19 39 65 81 92 88 61 56 52 48 45 36 22 18 17 13 9 7 87 1 3 1...
result:
ok Correct!
Test #12:
score: 0
Accepted
time: 2ms
memory: 3768kb
input:
5 97 100 1 1 1 0 0 1 0 1 1 2 0 1 2 0 1 0 2 3 0 1 0 1 0 1 0 0 1 0 1 2 0 3 2 2 1 0 1 1 2 3 3 1 0 2 1 1 1 2 2 2 0 2 0 3 1 2 2 2 0 1 0 1 1 0 2 0 0 0 0 3 1 0 0 1 0 1 1 0 0 1 1 2 1 2 0 0 1 2 0 1 1 0 2 0 0 1 0 0 2 2 48 80 1 66 89 71 73 40 2 50 99 68 91 31 76 25 67 94 37 6 88 86 28 22 43 62 21 16 17 39 70 1...
output:
94 4 9 16 19 23 24 25 48 64 79 2 3 86 15 1 12 94 32 14 26 92 56 61 87 42 96 18 5 13 20 27 30 50 53 70 73 84 40 85 8 7 11 17 21 33 38 49 54 55 59 62 78 82 88 89 97 41 28 10 36 69 81 39 45 72 74 37 80 44 52 75 51 65 90 6 63 35 77 47 29 91 58 71 83 31 34 43 67 57 93 22 76 60 66 95 68 46 94 15 25 26 54...
result:
ok Correct!
Test #13:
score: 0
Accepted
time: 1ms
memory: 3836kb
input:
5 96 96 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 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 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 72 44 0 0 1 75 0 2 48 35 1 29 1 55 2 75 32 1 95 0 2 87 85 1 69 1 6 2 48 6 1 77 1 67 0 0 1 75 2 59 ...
output:
59 8 12 13 15 6 16 17 20 9 23 24 25 29 31 32 35 36 39 41 45 48 27 49 51 56 58 59 46 60 61 64 65 67 70 71 62 73 74 75 78 80 81 82 44 83 85 86 87 88 89 90 96 47 55 68 34 79 91 21 95 94 93 92 84 77 76 72 69 66 63 57 54 53 52 50 43 42 40 38 37 33 30 28 26 22 19 18 14 11 10 7 5 4 3 2 1 54 4 8 16 19 20 2...
result:
ok Correct!
Test #14:
score: 0
Accepted
time: 1ms
memory: 3680kb
input:
1 499 497 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 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 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 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 ...
output:
287 6 7 8 10 15 21 23 26 29 31 32 34 24 41 43 47 48 55 57 58 60 61 68 69 77 81 84 85 87 91 96 106 108 115 118 119 120 122 80 123 125 126 134 137 141 145 146 147 150 152 154 156 159 162 166 167 169 170 174 176 178 183 186 187 191 192 197 198 201 207 209 210 211 216 222 223 225 226 227 35 228 229 233 ...
result:
ok Correct!
Test #15:
score: 0
Accepted
time: 1ms
memory: 3704kb
input:
10 50 49 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 1 1 1 1 1 1 1 1 1 1 43 0 0 2 25 28 0 0 2 28 14 0 2 8 38 1 1 0 1 6 1 41 0 2 40 47 2 8 34 2 26 41 2 31 28 1 5 0 2 33 45 0 2 14 43 0 2 39 34 1 32 1 6 1 15 1 17 0 0 2 9 6 2 37 1 0 2 13 20 0 2 4 41 2 31 5 0 2 44 14 1...
output:
30 4 10 13 15 16 9 17 27 28 29 32 33 37 40 41 43 45 18 7 23 38 46 47 48 49 21 50 25 35 44 42 39 36 34 31 30 26 24 22 20 19 14 12 11 8 6 5 3 2 1 27 3 6 9 10 15 17 19 24 14 25 27 29 34 16 35 38 33 39 41 43 44 45 48 49 40 50 5 47 46 42 37 36 32 31 30 28 26 23 22 21 20 18 13 12 11 8 7 4 2 1 25 1 2 3 7...
result:
ok Correct!
Test #16:
score: 0
Accepted
time: 1ms
memory: 3868kb
input:
10 50 49 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 1 1 1 1 1 1 1 1 1 1 32 0 0 2 47 41 1 10 3 33 18 13 1 43 1 49 1 39 0 0 3 16 27 31 0 0 2 30 25 3 23 16 37 3 18 1 46 2 8 9 3 32 33 10 3 24 14 31 3 31 11 2 2 8 36 1 44 1 9 0 2 39 27 1 14 1 6 3 47 12 10 1 14 1 10 0 1...
output:
32 1 7 8 9 12 15 16 19 20 23 24 26 28 30 31 33 36 38 39 40 42 21 44 45 46 48 4 29 6 47 17 49 50 43 41 37 35 34 32 27 25 22 18 14 13 11 10 5 3 2 31 1 6 11 18 21 23 4 25 26 28 33 36 2 39 40 43 46 47 48 49 3 17 27 31 32 29 34 16 38 42 41 50 45 44 37 35 30 24 22 20 19 15 14 13 12 10 9 8 7 5 35 1 3 6 9...
result:
ok Correct!
Test #17:
score: 0
Accepted
time: 0ms
memory: 3672kb
input:
1 495 495 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 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 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 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 ...
output:
344 4 6 10 18 19 23 24 25 28 30 41 45 48 50 51 55 59 65 12 68 74 77 78 79 91 44 94 95 96 97 102 104 111 113 114 116 120 122 123 127 129 132 133 136 144 145 146 148 155 156 158 37 161 162 163 168 171 141 173 174 178 179 180 181 182 184 187 190 191 38 192 198 204 110 205 164 210 212 218 220 221 222 22...
result:
ok Correct!
Test #18:
score: 0
Accepted
time: 0ms
memory: 3700kb
input:
250 1 2 1 0 2 1 2 2 2 0 2 1 1 1 1 2 2 1 1 2 1 2 2 1 2 1 1 1 0 2 2 0 2 2 1 2 0 2 1 2 1 1 0 2 2 0 2 1 1 2 1 2 2 1 2 0 0 1 2 0 1 2 1 2 1 1 1 1 1 2 1 2 0 1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 5 4 3 2 1 1 5 4 3 2 1 1 1 5 4 3 2 2 4 5 3 2 1 0 5 4 3 2 1 4 2 4 3 5 1 2 3 4 5 2 1 0 5 4 3 2 1 3 5 1 3 4 2 2 5 1 4 3 2 3 3 4 1 5 2 1 5 4 3 2 1 2 4 3 5 2 1 1 4 5 3 2 1 2 1 4 5 3 2 3 4 2 5 3 1 3 2 3 4 5 1 0 5 4 3 2 1 1 2 5 4 3 1 0...
result:
ok Correct!
Test #22:
score: 0
Accepted
time: 1ms
memory: 3636kb
input:
10 49 49 0 0 0 0 0 1 0 1 0 0 1 0 0 1 1 0 0 1 2 0 2 2 1 1 0 0 2 3 1 2 1 1 1 2 2 0 1 0 1 0 2 2 0 0 4 1 3 3 3 5 3 10 12 16 18 5 2 16 36 21 39 9 19 23 5 31 32 12 15 34 40 0 5 5 19 21 24 30 3 6 8 16 6 15 17 26 2 14 7 1 3 2 14 15 3 16 21 23 6 3 4 17 19 21 22 1 7 7 2 11 28 10 13 31 6 0 6 13 33 43 47 14 1 4...
output:
29 11 16 30 38 13 40 26 41 39 42 47 28 18 15 17 29 34 49 22 45 2 5 10 3 33 36 46 20 32 48 44 43 37 35 31 27 25 24 23 21 19 14 12 9 8 7 6 4 1 22 9 12 17 22 24 23 27 29 33 28 38 2 36 41 42 32 46 47 48 7 25 45 49 44 43 40 39 37 35 34 31 30 26 21 20 19 18 16 15 14 13 11 10 8 6 5 4 3 1 28 6 12 32 19 26...
result:
ok Correct!
Test #23:
score: 0
Accepted
time: 3ms
memory: 5780kb
input:
1 498 500 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 1 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 1 0 0 0 1 0 0 1 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 1 1 0 1 0 0 0 0 0 1 0 2 1 0 1 0 0 2 0 1 0 0 1 1 0 0 0 0 0 2 0 0 1 0 1 0 0 0 0 0 2 1 2 0 1 0 0 1 1 0 1 ...
output:
464 19 27 33 42 46 58 60 78 94 135 162 189 218 230 296 312 325 330 342 372 378 52 400 409 453 461 465 483 62 112 283 160 74 173 419 457 482 14 145 198 254 304 439 47 161 116 129 149 171 267 271 366 473 109 96 24 43 107 136 153 233 288 299 306 338 412 273 421 167 103 179 197 235 239 280 310 323 340 4...
result:
ok Correct!
Test #24:
score: 0
Accepted
time: 14ms
memory: 7648kb
input:
1 497 496 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 1 0 1 0 1 0 0 0 0 0 0 1 0 0 0 0 1 0 0 1 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 1 0 0 1 1 0 1 1 0 1 0 1 0 2 1 0 0 0 0 0 0 0 1 1 0 1 0 1 2 1 2 0 1 0 0 1 2 0 1 1 1 0 0 0 0 2 1 1 1 0 0 1 ...
output:
496 39 199 262 195 103 318 480 395 448 7 45 91 111 115 144 166 322 349 382 391 442 468 479 133 239 336 154 194 290 294 309 346 371 420 421 463 482 213 272 277 282 314 319 412 494 381 105 168 179 236 339 340 397 400 472 493 49 62 116 171 224 303 335 355 464 466 473 486 492 95 130 203 347 352 364 375 ...
result:
ok Correct!
Test #25:
score: 0
Accepted
time: 1ms
memory: 3568kb
input:
5 100 100 0 0 0 0 0 0 0 1 0 1 0 0 1 0 0 0 0 1 0 0 0 1 0 1 0 1 0 1 0 1 0 1 1 2 0 1 0 0 1 1 1 1 0 2 1 0 0 1 2 1 0 1 1 1 1 0 1 1 2 5 1 0 1 2 0 2 0 3 1 1 1 2 3 2 1 1 1 2 4 2 1 4 1 2 1 0 3 3 1 3 0 0 3 1 0 0 0 3 4 2 1 35 0 1 8 1 35 0 0 1 10 2 15 19 2 1 3 2 6 61 0 0 0 0 2 14 20 2 4 80 0 0 0 1 6 0 1 13 1 4 ...
output:
19 7 10 16 27 37 39 48 57 59 66 73 76 54 83 84 92 98 43 79 100 99 97 96 95 94 93 91 90 89 88 87 86 85 82 81 80 78 77 75 74 72 71 70 69 68 67 65 64 63 62 61 60 58 56 55 53 52 51 50 49 47 46 45 44 42 41 40 38 36 35 34 33 32 31 30 29 28 26 25 24 23 22 21 20 19 18 17 15 14 13 12 11 9 8 6 5 4 3 2 1 26 1...
result:
ok Correct!
Test #26:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
5 95 99 0 0 1 0 0 0 0 0 1 1 0 0 0 2 1 0 0 0 1 0 1 0 0 0 1 2 0 0 1 1 2 0 0 0 1 0 0 1 1 1 0 1 0 1 1 0 1 1 1 2 2 0 0 0 1 0 1 1 1 4 3 0 3 1 2 1 0 1 0 1 5 0 1 1 0 3 0 3 1 2 2 4 0 0 0 1 1 1 2 3 1 0 2 4 0 1 1 4 3 0 1 5 3 31 50 70 1 21 5 14 26 31 2 6 5 7 41 19 45 30 3 1 6 40 0 2 16 19 4 5 6 9 25 0 0 5 17 47...
output:
41 15 17 28 30 36 38 19 43 44 45 47 54 57 59 41 63 66 70 72 75 78 81 83 84 88 89 90 85 92 5 79 87 13 93 42 3 51 62 65 73 82 95 94 91 86 80 77 76 74 71 69 68 67 64 61 60 58 56 55 53 52 50 49 48 46 40 39 37 35 34 33 32 31 29 27 26 25 24 23 22 21 20 18 16 14 12 11 10 9 8 7 6 4 2 1 37 1 5 10 16 19 30 6...
result:
ok Correct!
Test #27:
score: 0
Accepted
time: 1ms
memory: 3632kb
input:
5 97 97 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 1 0 1 1 0 0 1 1 2 0 0 1 2 1 0 0 1 2 2 1 0 2 0 1 0 0 3 0 2 3 0 2 1 1 1 1 0 1 1 2 4 1 0 2 1 0 1 2 1 2 2 2 1 2 5 2 0 1 0 3 1 3 1 0 1 2 0 0 2 4 2 2 1 2 1 3 0 0 5 14 16 33 41 9 7 12 28 16 32 45 46 71 10 15 63 65 17 66 18 81 45 8 68 6 8 35 12 54 21 63 0 0 0 ...
output:
67 2 5 14 16 22 26 49 57 59 66 70 73 75 80 82 54 83 85 41 38 42 69 53 23 86 72 3 77 25 58 91 55 94 65 50 87 36 48 56 78 89 95 96 97 19 21 29 63 64 27 92 67 10 93 47 20 24 34 45 60 84 81 31 51 4 62 71 90 88 79 76 74 68 61 52 46 44 43 40 39 37 35 33 32 30 28 18 17 15 13 12 11 9 8 7 6 1 62 12 20 24 30...
result:
ok Correct!
Test #28:
score: 0
Accepted
time: 2ms
memory: 3656kb
input:
5 95 95 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 1 0 1 0 0 0 1 1 0 1 0 1 1 1 0 0 2 1 0 0 1 1 0 0 1 0 1 0 0 3 0 2 1 1 5 0 0 0 4 3 0 2 1 0 3 2 2 1 2 1 6 1 3 4 2 1 2 2 3 0 2 0 2 1 1 2 2 1 0 2 1 0 0 1 2 3 16 2 9 23 36 52 58 31 65 66 71 72 17 75 24 44 27 28 4 2 32 38 45 21 52 61 94 55 46 79 92 1 11 65 73 95...
output:
89 3 25 54 71 72 35 19 38 39 30 41 28 33 80 53 1 31 59 67 9 7 74 93 18 34 57 27 6 55 70 75 26 42 48 82 89 69 47 51 87 73 94 60 14 11 40 88 63 23 36 65 66 77 79 84 85 95 49 58 37 68 16 78 22 15 45 20 2 43 50 4 76 29 32 61 10 83 13 81 92 21 56 46 52 17 44 86 91 64 90 62 24 12 8 5 89 5 7 14 27 56 66 7...
result:
ok Correct!
Test #29:
score: 0
Accepted
time: 1ms
memory: 3968kb
input:
1 498 500 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 1 2 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 1 1 1 2 0 0 1 0 0 0 0 0 1 0 0 2 0 1 1 1 0 0 1 0 2 0 0 1 1 0 0 2 0 0 0 0 0 3 1 0 2 0 1 3 0 0 0 ...
output:
108 29 54 58 60 86 99 110 116 125 128 137 144 149 159 173 187 192 197 199 231 237 240 243 247 250 14 251 255 286 288 291 298 307 210 315 317 160 319 323 329 330 348 360 361 365 369 372 374 382 384 392 394 395 401 405 407 414 416 417 423 426 397 427 429 432 437 409 438 440 443 17 239 294 444 448 228 ...
result:
ok Correct!
Test #30:
score: 0
Accepted
time: 2ms
memory: 5908kb
input:
1 500 498 2 0 0 1 1 1 0 0 0 0 1 1 2 2 2 0 1 0 0 0 1 1 1 0 1 1 2 2 2 1 1 0 4 3 1 1 1 1 0 3 0 3 3 1 2 1 0 2 3 2 0 2 0 0 0 1 1 1 0 2 4 1 0 1 1 1 1 3 1 0 0 1 1 2 2 4 1 1 1 0 0 2 2 1 2 1 1 1 0 0 2 0 0 1 0 0 1 1 1 1 0 1 0 0 1 2 1 1 1 2 2 4 2 0 0 0 0 1 1 0 1 4 1 3 0 2 0 3 0 1 1 1 0 4 0 1 1 3 2 0 0 1 0 1 1 ...
output:
258 252 259 288 301 304 375 403 230 467 500 209 235 281 306 318 333 337 343 354 384 387 389 411 422 426 442 445 466 490 193 244 270 289 302 312 335 401 435 453 479 253 308 321 334 346 353 361 420 433 459 491 427 499 227 241 254 258 260 311 313 320 344 347 383 407 408 434 441 468 471 482 493 286 295 ...
result:
ok Correct!
Test #31:
score: 0
Accepted
time: 12ms
memory: 8660kb
input:
1 496 498 0 0 0 0 2 0 0 1 0 1 1 0 2 3 1 1 2 0 3 2 2 0 2 1 2 0 1 1 1 0 1 2 0 0 0 0 5 1 1 0 2 1 0 0 1 0 0 2 0 3 0 0 3 1 0 3 0 1 1 2 1 2 0 2 0 2 1 0 3 0 1 0 1 1 2 0 1 0 0 1 2 1 2 0 1 0 1 1 1 0 3 3 3 2 0 1 2 1 1 3 1 1 0 0 3 0 1 0 0 0 0 1 3 1 0 1 1 2 1 0 1 2 0 2 0 1 1 1 2 2 0 0 1 2 1 1 1 2 1 3 1 1 1 0 0 ...
output:
248 310 331 354 375 386 390 426 440 466 476 335 425 460 467 468 416 431 493 251 300 319 320 326 355 369 377 380 396 401 407 253 260 263 275 282 288 291 303 304 309 311 323 372 379 381 397 398 405 406 410 420 429 448 450 451 456 457 473 481 483 272 339 384 393 408 411 437 496 329 371 280 286 312 316 ...
result:
ok Correct!
Test #32:
score: 0
Accepted
time: 1ms
memory: 3660kb
input:
10 49 50 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 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 4 0 1 7 2 8 7 2 9 8 0 1 10 1 12 2 13 12 0 0 1 16 2 16 17 0 1 19 0 1 20 1 21 1 23 2 24 23 2 25 24 1 26 1 27 1 27 1 28 0 2 31 30 1 32 0 1 33 1 34 2 35 36 1 37 2 38 37 1 38 1 40 2 41 4...
output:
35 1 4 6 7 8 10 11 12 15 16 18 20 21 22 23 24 25 27 28 31 33 34 38 37 39 40 41 43 44 45 46 48 49 30 35 47 42 36 32 29 26 19 17 14 13 9 5 3 2 31 1 9 11 12 13 14 16 17 18 20 29 30 32 35 36 37 40 39 42 43 45 46 49 7 21 23 24 28 27 34 47 48 44 41 38 33 31 26 25 22 19 15 10 8 6 5 4 3 2 30 1 2 4 6 8 9 1...
result:
ok Correct!
Test #33:
score: 0
Accepted
time: 1ms
memory: 3912kb
input:
5 99 99 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 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 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 0 0 2 5 4 1 5 1 7 0 1 9 1 10 0 2 12 11 1 12 1 14 1 14 2 15 16 1 17 0 1 19 1 19 1 21 2 21 2...
output:
60 1 5 4 6 8 9 12 11 14 16 19 21 22 23 25 26 27 33 32 31 34 38 40 43 44 45 50 51 55 56 58 60 62 67 66 70 71 73 75 76 77 81 84 87 91 93 94 95 96 97 99 15 36 41 53 57 69 68 85 88 98 92 90 89 86 83 82 80 79 78 74 72 65 64 63 61 59 54 52 49 48 47 46 42 39 37 35 30 29 28 24 20 18 17 13 10 7 3 2 63 1 2 3...
result:
ok Correct!
Test #34:
score: 0
Accepted
time: 1ms
memory: 3680kb
input:
1 496 500 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 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 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 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 ...
output:
325 1 2 3 6 5 9 11 13 14 16 18 23 24 26 27 28 29 30 31 32 35 36 38 42 43 44 45 47 49 50 53 54 55 57 60 62 63 64 65 66 68 69 70 71 73 75 74 76 82 84 85 88 90 91 92 93 95 97 96 98 99 101 103 102 104 105 107 109 112 113 115 116 117 118 119 120 121 122 125 124 126 131 132 134 145 146 148 150 151 154 153...
result:
ok Correct!
Test #35:
score: 0
Accepted
time: 1ms
memory: 3700kb
input:
10 46 47 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 1 1 1 1 1 1 1 1 1 2 3 4 1 5 2 5 6 2 6 5 3 8 6 7 0 1 8 1 10 0 2 11 13 2 14 13 2 14 13 3 15 14 16 2 16 15 1 18 1 18 0 1 20 1 21 1 21 0 2 23 24 1 26 2 27 26 1 27 1 29 1 29 1 31 1 30 1 32 1 32 1 33 2 35 36 2 35 37 1...
output:
34 8 9 11 12 13 17 19 21 26 25 28 29 30 32 33 34 35 36 40 39 37 41 42 43 46 2 23 44 45 4 5 6 14 15 38 31 27 24 22 20 18 16 10 7 3 1 36 6 5 7 8 9 13 12 10 15 16 14 21 22 25 27 28 29 31 30 33 34 35 36 37 38 44 45 46 47 2 3 17 18 40 41 42 48 43 39 32 26 24 23 20 19 11 4 1 39 1 8 7 6 9 10 11 12 13 16 ...
result:
ok Correct!
Test #36:
score: 0
Accepted
time: 1ms
memory: 3684kb
input:
5 99 99 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 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 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 1 3 2 2 4 3 2 4 3 0 2 6 7 1 6 3 8 7 9 2 10 9 1 11 3 12 11 10 3 13 12 11 1 12 2 13 14 0 1 15 ...
output:
75 2 3 6 5 7 9 11 12 10 8 13 15 16 18 20 19 22 23 24 32 34 42 40 39 38 36 44 45 46 47 48 50 54 53 55 56 59 60 64 66 67 70 72 73 74 80 82 81 84 83 86 85 87 88 89 90 91 92 93 96 27 30 41 58 62 63 68 75 76 77 95 97 98 99 1 94 79 78 71 69 65 61 57 52 51 49 43 37 35 33 31 29 28 26 25 21 17 14 4 75 3 2 4...
result:
ok Correct!
Test #37:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
1 495 497 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 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 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 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 ...
output:
383 2 4 3 6 8 10 9 11 12 13 18 21 23 25 26 30 28 31 37 39 42 41 40 43 48 51 49 52 53 55 59 60 58 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 81 80 86 87 89 90 92 91 94 93 95 98 99 102 103 101 100 106 108 109 111 110 114 113 115 117 119 121 120 122 123 124 125 128 126 129 130 132 131 133...
result:
ok Correct!
Test #38:
score: 0
Accepted
time: 1ms
memory: 3680kb
input:
10 45 49 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 1 1 1 1 1 1 1 1 1 3 3 5 2 0 2 6 5 3 4 5 8 3 9 6 8 3 7 8 10 1 8 3 8 11 10 2 12 10 3 13 12 10 3 14 15 12 3 14 13 12 3 15 17 13 2 15 18 3 19 17 18 4 16 17 19 20 3 18 21 20 1 18 2 19 21 3 21 20 23 3 23 21 25 1 22 3 ...
output:
43 4 6 7 8 10 11 12 9 14 13 15 16 18 19 17 20 21 22 23 24 25 26 27 30 28 31 33 34 32 35 36 37 43 1 5 3 40 41 39 38 42 45 44 29 2 42 1 4 5 10 12 13 11 7 8 6 16 19 24 25 26 29 33 35 40 41 43 2 3 27 28 30 32 34 36 37 45 42 44 38 14 15 20 21 23 22 18 17 39 31 9 44 1 2 3 6 7 11 12 15 18 25 21 20 26 24 ...
result:
ok Correct!
Test #39:
score: 0
Accepted
time: 1ms
memory: 3644kb
input:
5 95 98 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 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 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 5 1 3 1 6 3 5 4 7 2 7 8 1 7 3 7 10 6 3 9 11 8 4 10 8 9 11 3 9 10 12 1 12 3 12 14 15 1 16 4 14 ...
output:
90 5 4 7 9 6 8 10 11 12 15 16 17 13 14 27 28 25 26 29 32 33 35 36 34 37 38 40 39 42 41 43 52 53 56 60 63 61 59 62 64 67 66 65 68 72 78 80 84 81 79 82 83 87 85 88 89 86 90 91 95 1 3 58 75 73 74 19 20 21 18 22 23 30 31 50 51 49 47 44 45 46 48 54 55 70 71 69 92 93 94 77 76 57 24 2 90 5 8 9 6 10 11 7 4...
result:
ok Correct!
Test #40:
score: 0
Accepted
time: 2ms
memory: 3980kb
input:
1 498 496 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 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 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 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 ...
output:
462 5 6 4 14 18 19 20 16 21 22 23 27 25 29 52 49 50 51 53 54 56 57 55 58 64 62 68 69 74 76 77 82 83 87 90 86 93 95 96 97 98 99 100 101 102 103 106 104 105 107 108 111 112 114 115 116 113 121 118 117 119 120 123 124 127 128 125 132 133 136 137 138 139 140 141 142 144 143 146 147 145 151 156 162 160 1...
result:
ok Correct!
Test #41:
score: 0
Accepted
time: 1ms
memory: 3908kb
input:
10 49 47 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 1 1 1 1 1 1 1 7 3 1 7 4 9 8 10 6 11 2 6 3 4 5 3 3 12 10 5 5 9 6 12 7 5 13 7 10 9 11 3 10 6 12 6 12 16 7 8 10 9 7 11 9 16 12 17 10 15 5 15 14 11 13 9 3 12 18 16 5 13 20 17 15 19 4 15 19 17 12 7 13 15 22 18 19 17 ...
output:
47 11 17 21 25 27 28 33 35 37 38 36 49 46 47 41 43 40 32 24 15 9 13 42 31 34 30 29 22 23 20 19 16 26 14 12 18 10 2 4 5 7 45 1 44 39 48 8 6 3 48 3 7 4 10 12 6 5 20 22 25 40 46 43 44 48 41 30 31 33 26 28 32 35 39 36 37 38 42 34 47 15 17 14 8 1 21 2 45 18 23 11 13 19 16 9 24 27 29 47 23 32 34 29 24 1...
result:
ok Correct!
Test #42:
score: 0
Accepted
time: 1ms
memory: 3720kb
input:
5 99 100 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 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 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 9 7 5 2 9 8 11 7 6 5 8 4 9 3 11 6 9 8 13 10 12 4 6 5 6 12 14 9 11 2 10 14 8 12 15 8 9 14 ...
output:
99 2 5 3 13 18 19 23 27 33 37 32 45 59 70 71 77 81 93 96 92 97 94 88 87 95 38 41 34 35 39 42 31 28 29 30 36 40 44 20 22 25 24 26 8 11 12 7 1 14 21 15 99 90 16 17 9 6 10 4 86 85 82 83 84 89 91 98 46 48 51 55 52 61 53 57 50 47 49 43 65 68 58 60 63 56 54 62 64 67 72 66 69 78 80 73 74 75 76 79 95 9 22 ...
result:
ok Correct!
Test #43:
score: 0
Accepted
time: 0ms
memory: 3792kb
input:
1 498 499 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 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 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 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 ...
output:
497 5 8 11 19 26 30 34 42 44 47 43 46 48 52 56 51 73 71 70 72 89 84 93 95 99 104 107 113 114 120 122 124 119 136 140 141 147 155 159 161 156 162 180 185 204 214 227 229 236 239 246 264 272 274 276 291 298 324 325 323 326 330 333 335 336 338 339 340 341 344 345 347 350 354 357 379 385 395 396 399 403...
result:
ok Correct!