QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#605188 | #8759. 小班课 | UESTC_NLNS | AC ✓ | 474ms | 13792kb | C++14 | 5.0kb | 2024-10-02 16:00:17 | 2024-10-02 16:00:17 |
Judging History
answer
#include <limits>
#include <queue>
#include <vector>
using namespace std;
using i64 = long long;
using ll = long long;
const int maxn = 1503;
const int maxm = 600 * 600 * 2;
const int inf = 0x3f3f3f3f;
struct MCMF {
struct edge {
int to, cap, cost, rev;
// edge() {}
// edge(int to, int _cap, int _cost, int _rev) : to(to), cap(_cap), cost(_cost), rev(_rev) {}
};
int V, H[maxn + 5], dis[maxn + 5], PreV[maxn + 5], PreE[maxn + 5];
vector<edge> G[maxn + 5];
void init(int n) {
V = n;
for (int i = 0; i <= V; ++i) G[i].clear();
}
int add(int from, int to, int cap, int cost) {
int t = G[from].size();
G[from].emplace_back(edge{to, cap, cost, (int)G[to].size()});
G[to].emplace_back(edge{from, 0, -cost, (int)G[from].size() - 1});
return t;
}
int mcmf(int s, int t) {
int res = 0, flow = 0;
fill(H, H + 1 + V, 0);
int f = inf;
while (f) {
priority_queue<pair<int, int>> q;
fill(dis, dis + 1 + V, inf);
dis[s] = 0;
q.push(pair<int, int>(0, s));
while (!q.empty()) {
pair<int, int> now = q.top();
q.pop();
int v = now.second, Size;
if (dis[v] < -now.first) continue;
Size = G[v].size();
for (int i = 0; i < Size; ++i) {
edge e = G[v][i];
if (e.cap > 0 && dis[e.to] > dis[v] + e.cost + H[v] - H[e.to]) {
dis[e.to] = dis[v] + e.cost + H[v] - H[e.to];
PreV[e.to] = v;
PreE[e.to] = i;
q.push(pair<int, int>(-dis[e.to], e.to));
}
}
}
if (dis[t] == inf) break;
for (int i = 0; i <= V; ++i) H[i] += dis[i];
int d = f;
for (int v = t; v != s; v = PreV[v]) d = min(d, G[PreV[v]][PreE[v]].cap);
f -= d;
flow += d;
res += d * H[t];
for (int v = t; v != s; v = PreV[v]) {
edge& e = G[PreV[v]][PreE[v]];
e.cap -= d;
G[v][e.rev].cap += d;
}
}
return flow;
}
};
#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
using namespace std;
const int N = 1505;
vector<int> g[N];
int c[N];
int b[N];
int n, m;
vector<int> get_ans() {
vector<int> b1(m + 1);
for (int i = 1; i <= m; ++i) b1[i] = b[i];
queue<int> q;
vector<int> ans;
vector<int> cur(n + 1, 0);
vector<vector<int>> w(m + 1);
ans.reserve(n);
auto get = [&](int i) {
return g[i][cur[i]];
};
for (int i = 1; i <= m; ++i) {
if (b1[i] == 0) q.push(i);
}
for (int i = 1; i <= n; ++i) {
if (c[i] == 0) continue;
int w1 = g[i][cur[i]];
if (w1 == c[i]) {
// assert(b1[w1] > 0);
b1[w1]--;
if (b1[w1] == 0) q.push(w1);
ans.push_back(i);
} else {
w[w1].push_back(i);
}
}
while (q.size()) {
int f = q.front();
q.pop();
for (const auto u : w[f]) {
while (b1[get(u)] == 0) {
cur[u]++;
}
int w1 = get(u);
if (w1 == c[u]) {
// assert(b1[w1] > 0);
b1[w1]--;
if (b1[w1] == 0) q.push(w1);
ans.push_back(u);
} else {
w[w1].push_back(u);
}
}
w[f].clear();
}
for (int i = 1; i <= n; ++i) {
if (c[i] == 0) ans.push_back(i);
}
return ans;
}
int s, t;
void INIT() {
s = n + m + 1, t = n + m + 2;
}
void solve() {
cin >> n >> m;
INIT();
vector<vector<int>> as(n + 1, vector<int>(m + 1));
MCMF mcfg;
mcfg.init(t + 2);
for (int i = 1; i <= n; ++i) g[i].clear();
for (int i = 1; i <= m; ++i) cin >> b[i], mcfg.add(n + i, t, b[i], 0);
for (int i = 1; i <= n; ++i) {
mcfg.add(s, i, 1, 0);
int k;
cin >> k;
g[i].reserve(k);
int la = 0;
for (int j = 1, tmp; j <= k; ++j) {
cin >> tmp;
g[i].push_back(tmp);
// mcfg.add(i, n + tmp, 1, j);
as[i][tmp] = mcfg.add(i, n + tmp, 1, j);
}
}
memset(c, 0, sizeof(c));
int flow = mcfg.mcmf(s, t);
for (int i = 1; i <= n; ++i) {
for (int x : g[i]) {
if (mcfg.G[i][as[i][x]].cap == 0) c[i] = x;
}
}
cout << flow << '\n';
vector<int> ans = get_ans();
for (auto u : ans) {
cout << u << " ";
}
cout << '\n';
// puts("");
}
int main() {
cin.tie(0), cout.tie(0), ios::sync_with_stdio(0);
int t;
cin >> t;
while (t--) solve();
}
/*
1
5 4
1 1 1 1
1 1
3 3 1 2
1 1
2 1 3
4 1 2 3 4
*/
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3960kb
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 3 1 5 5 1 2 3 4 5 2 3 4 5 1
result:
ok Correct!
Test #2:
score: 0
Accepted
time: 0ms
memory: 3724kb
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 2 1 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 2 1 1 1 1 1 2 1 1 2 1 1 1 2 1 1 1 1 2 1 0 1 2 1 1 1 1 0 1 1 1 2 1 2 0 1 0 1 1 1 2 2 2 1 0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 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 11 12 14 15 19 29 37 38 39 42 31 16 8 30 17 40 43 7 21 6 35 5 10 25 3 44 36 4 13 24 18 34 2 9 20 22 23 26 27 28 32 33 41 45 39 10 12 14 15 16 20 30 32 43 44 25 45 2 28 29 36 3 35 19 7 17 40 31 33 38 24 18 9 21 42 11 34 5 26 1 41 6 23 39 4 8 13 22 27 37 36 3 4 10 20 28 29 31 32 33 46 47 16 36 ...
result:
ok Correct!
Test #7:
score: 0
Accepted
time: 118ms
memory: 5660kb
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 1 2 3 10 17 18 22 30 31 33 34 35 38 40 41 55 56 59 60 63 69 70 73 80 81 82 86 89 91 95 96 101 104 106 108 110 111 113 118 119 120 124 125 126 134 138 139 142 144 149 150 153 157 162 167 171 172 174 179 182 187 190 199 204 208 214 215 217 224 227 228 231 232 234 237 239 241 242 243 244 245 250 25...
result:
ok Correct!
Test #8:
score: 0
Accepted
time: 474ms
memory: 13792kb
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 1 2 3 5 7 8 15 16 17 19 26 28 35 36 37 39 45 46 47 50 52 53 56 57 66 68 69 72 73 78 79 82 83 88 96 98 108 110 111 112 113 114 116 117 123 124 126 127 129 133 134 135 136 140 142 146 147 150 155 157 160 161 170 174 176 177 180 184 185 188 189 191 198 199 204 207 209 211 214 215 216 221 222 230 23...
result:
ok Correct!
Test #9:
score: 0
Accepted
time: 3ms
memory: 3804kb
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 12 16 19 21 22 25 26 30 34 35 38 39 40 45 46 53 57 60 62 65 69 71 72 73 74 77 78 82 87 88 93 94 95 97 99 24 92 9 44 20 23 42 56 59 1 4 5 8 10 11 13 14 15 17 18 27 28 29 31 32 33 36 37 41 43 47 48 49 50 51 52 54 55 58 61 63 64 66 67 68 70 75 76 79 80 81 83 84 85 86 89 90 91 96 98 44 8 11 ...
result:
ok Correct!
Test #10:
score: 0
Accepted
time: 6ms
memory: 3712kb
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 3 6 7 8 9 12 14 20 22 23 25 29 30 32 33 35 37 39 40 44 46 48 49 55 58 63 64 65 66 68 70 71 77 82 83 87 90 91 96 97 99 85 47 79 95 76 73 28 41 24 78 11 81 16 13 45 53 62 34 98 27 52 59 42 60 57 17 72 18 94 54 2 4 5 10 15 19 21 26 31 36 38 43 50 51 56 61 67 69 74 75 80 84 86 88 89 92 93 67 2 3 7...
result:
ok Correct!
Test #11:
score: 0
Accepted
time: 11ms
memory: 3764kb
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 1 3 4 5 8 11 15 19 23 24 29 30 32 37 38 40 41 47 51 54 55 65 66 69 70 71 72 74 79 81 82 83 84 89 94 96 99 46 20 12 73 85 62 53 87 25 39 86 27 59 64 67 35 21 76 97 50 93 58 91 49 90 34 10 26 98 57 16 42 63 33 77 68 78 44 43 75 95 28 31 6 2 80 14 60 7 9 13 17 18 22 36 45 48 52 56 61 88 92 87 2 3 5...
result:
ok Correct!
Test #12:
score: 0
Accepted
time: 20ms
memory: 3892kb
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 8 9 10 12 15 16 19 20 23 25 26 29 30 31 33 34 37 42 43 45 47 49 51 54 57 58 62 69 71 73 79 91 92 93 94 97 90 78 3 11 39 96 80 36 67 17 55 66 5 35 56 6 14 64 40 27 70 59 50 87 44 77 60 85 24 72 63 88 75 65 13 1 41 89 18 28 86 53 48 38 76 21 32 83 7 52 84 2 81 61 22 82 74 46 68 95 94 2 6 7 10 15...
result:
ok Correct!
Test #13:
score: 0
Accepted
time: 3ms
memory: 3824kb
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 1 8 12 13 15 16 17 20 21 23 24 25 29 31 32 34 35 36 39 41 47 48 49 51 55 56 58 59 60 61 64 65 67 68 70 71 73 74 75 79 80 81 82 83 86 88 89 91 96 85 6 45 90 9 27 46 78 44 87 2 3 4 5 7 10 11 14 18 19 22 26 28 30 33 37 38 40 42 43 50 52 53 54 57 62 63 66 69 72 76 77 84 92 93 94 95 54 4 7 11 14 16 1...
result:
ok Correct!
Test #14:
score: 0
Accepted
time: 19ms
memory: 5056kb
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 1 2 3 6 7 8 10 15 21 23 25 26 27 28 29 31 32 34 37 39 40 41 43 47 48 53 55 57 58 60 61 67 68 69 75 77 81 82 84 85 87 89 91 92 96 99 106 107 108 111 114 115 116 119 120 122 123 125 126 134 137 140 141 145 146 147 148 150 152 154 159 161 162 164 166 167 169 170 172 174 176 178 179 183 185 186 187 ...
result:
ok Correct!
Test #15:
score: 0
Accepted
time: 2ms
memory: 3696kb
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 1 4 7 10 13 15 16 17 19 23 25 27 29 32 33 35 37 38 40 41 43 44 45 46 48 49 50 9 47 21 2 3 5 6 8 11 12 14 18 20 22 24 26 28 30 31 34 36 39 42 27 3 5 6 9 10 17 20 21 24 25 27 35 38 39 41 43 44 45 48 50 49 14 33 40 29 34 16 1 2 4 7 8 11 12 13 15 18 19 22 23 26 28 30 31 32 36 37 42 46 47 25 1 2 3 7...
result:
ok Correct!
Test #16:
score: 0
Accepted
time: 3ms
memory: 3988kb
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 7 8 9 12 15 16 20 22 23 24 28 29 30 31 33 36 39 40 44 45 46 47 49 26 38 48 4 19 17 42 6 21 1 2 3 5 10 11 13 14 18 25 27 32 34 35 37 41 43 50 31 1 5 6 11 16 17 23 25 26 27 28 31 32 33 34 36 39 40 41 42 46 47 48 49 29 4 2 21 38 3 43 7 8 9 10 12 13 14 15 18 19 20 22 24 30 35 37 44 45 50 35 1 2 3 6...
result:
ok Correct!
Test #17:
score: 0
Accepted
time: 23ms
memory: 4752kb
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 1 2 4 6 10 16 18 19 20 23 24 25 28 41 42 45 50 51 54 59 68 70 71 74 77 78 79 82 90 91 94 95 96 97 102 103 107 109 111 113 114 115 116 120 121 122 123 125 127 129 132 133 136 139 144 145 146 148 150 153 155 156 158 160 161 168 169 171 173 174 175 178 179 180 181 182 184 185 187 190 191 197 198 20...
result:
ok Correct!
Test #18:
score: 0
Accepted
time: 1ms
memory: 3660kb
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 1 2 2 1 1 2 1 2 1 1 1 1 1 1 1 2 1 2 0 1 1 1 2 0 1 2 1 2 1 2 0 1 0 1 2 0 1 1 1 2 2 1 1 1 1 2 1 2 2 1 2 1 1 1 1 1 2 1 0 2 1 2 1 2 0 1 2 1 2 1 2 1 0 2 ...
output:
1 1 0 1 2 2 2 1 0 1 1 1 2 1 1 2 1 2 1 0 1 2 1 1 1 1 1 2 1 2 2 1 1 1 1 2 1 1 1 0 1 0 1 2 1 2 2 1 2 1 1 1 1 1 1 2 1 2 0 1 2 2 1 2 1 1 1 1 2 0 1 1 1 1 1 1 1 2 2 1 2 1 2 1 1 1 1 2 1 0 1 1 1 2 1 2 1 1 1 2 1 1 2 1 0 1 2 0 1 0 1 2 1 1 1 2 1 0 1 2 1 1 2 1 1 0...
result:
ok Correct!
Test #19:
score: 0
Accepted
time: 1ms
memory: 3660kb
input:
166 3 3 1 1 1 1 1 0 1 1 3 3 1 1 1 1 1 2 1 2 0 3 3 1 2 0 1 1 1 1 0 3 3 1 0 2 0 2 1 2 0 3 3 0 2 1 1 1 2 1 2 2 1 2 3 3 1 0 2 0 0 1 1 3 3 1 0 2 0 1 1 1 1 3 3 1 0 2 0 0 1 1 3 3 0 2 1 2 1 2 0 2 1 2 3 3 0 1 2 0 0 2 1 2 3 3 0 1 2 2 1 2 2 1 2 2 1 2 3 3 1 0 2 2 1 2 0 0 3 3 0 1 2 0 2 1 2 2 1 2 3 3 0 3 0 0 1 1 ...
output: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 5 0 0 1 2 2 3 1 2 3 3 1 2 3 3 1 2 3 0 3 2 3 4 5 5 0 2 1 2 0 1 1 2 1 2 3 1 2 3 1 1 2 1 2 5 5 0 0 0 0 5 0 0 0 0 3 1 2 3 5 5 1 0 0 2 2 1 1 3 1 2 3 2 1 2 3 1 2 3 3 1 2 3 5 5 0 0 1 2 2 3 1 2 3 0 0 2 1 2 1 1 5 5 0 2 0 ...
output:
1 4 1 2 3 5 2 4 2 1 3 5 2 3 5 1 2 4 3 2 5 3 1 4 0 1 2 3 4 5 1 5 1 2 3 4 1 1 2 3 4 5 2 4 5 1 2 3 0 1 2 3 4 5 4 2 4 5 3 1 2 4 3 1 2 5 0 1 2 3 4 5 3 5 1 3 2 4 2 5 1 2 3 4 3 3 4 1 2 5 1 5 1 2 3 4 2 4 3 1 2 5 1 4 1 2 3 5 2 1 4 2 3 5 3 4 2 5 1 3 3 4 3 2 1 5 0 1 2 3 4 5 1 2 1 3 4 5 0...
result:
ok Correct!
Test #22:
score: 0
Accepted
time: 4ms
memory: 3708kb
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 6 7 9 38 28 30 41 2 13 16 11 45 18 32 49 26 39 15 10 34 42 3 46 36 17 33 22 20 5 1 4 8 12 14 19 21 23 24 25 27 29 31 35 37 40 43 44 47 48 22 13 21 27 47 9 12 45 7 22 42 41 46 29 24 28 38 23 48 2 25 36 32 1 3 4 5 6 8 10 11 14 15 16 17 18 19 20 26 30 31 33 34 35 37 39 40 43 44 49 28 16 41 28 32 3...
result:
ok Correct!
Test #23:
score: 0
Accepted
time: 112ms
memory: 5636kb
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 7 17 18 30 56 60 74 100 109 129 145 162 205 226 227 251 296 306 326 337 340 342 398 400 24 172 454 32 260 303 212 355 225 463 485 462 416 35 55 78 10 81 245 381 395 434 93 409 475 69 464 135 13 465 371 223 264 458 237 97 198 385 90 378 483 52 26 118 130 91 182 262 334 367 384 238 110 116 253 229...
result:
ok Correct!
Test #24:
score: 0
Accepted
time: 304ms
memory: 9988kb
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 131 137 141 174 198 199 225 248 250 289 308 350 352 360 378 403 417 427 482 487 261 303 218 256 298 433 486 494 270 284 335 300 10 149 106 362 162 227 194 285 58 268 171 344 346 90 185 293 412 450 97 252 276 478 61 318 230 154 212 311 428 496 170 476 186 240 241 377 490 21 334 57 60 398 16 492 5...
result:
ok Correct!
Test #25:
score: 0
Accepted
time: 2ms
memory: 3768kb
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 43 48 57 59 66 79 83 84 92 98 16 10 39 76 73 27 37 54 1 2 3 4 5 6 8 9 11 12 13 14 15 17 18 19 20 21 22 23 24 25 26 28 29 30 31 32 33 34 35 36 38 40 41 42 44 45 46 47 49 50 51 52 53 55 56 58 60 61 62 63 64 65 67 68 69 70 71 72 74 75 77 78 80 81 82 85 86 87 88 89 90 91 93 94 95 96 97 99 100 26 3...
result:
ok Correct!
Test #26:
score: 0
Accepted
time: 3ms
memory: 3812kb
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 5 17 18 19 44 49 54 59 71 75 78 82 83 88 92 36 28 43 87 15 61 47 57 85 30 69 51 63 89 84 42 16 45 70 73 65 79 3 62 41 13 1 2 4 6 7 8 9 10 11 12 14 20 21 22 23 24 25 26 27 29 31 32 33 34 35 37 38 39 40 46 48 50 52 53 55 56 58 60 64 66 67 68 72 74 76 77 80 81 86 90 91 93 94 95 37 5 34 57 70 82 93 ...
result:
ok Correct!
Test #27:
score: 0
Accepted
time: 7ms
memory: 3816kb
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 14 52 66 73 80 86 45 57 51 72 22 13 54 38 26 94 5 16 67 75 83 70 3 47 2 4 25 95 42 43 71 10 59 92 49 29 77 34 60 48 62 41 69 53 63 21 93 56 65 89 96 58 36 87 55 31 23 64 24 81 78 19 50 97 20 84 27 1 6 7 8 9 11 12 15 17 18 28 30 32 33 35 37 39 40 44 46 61 68 74 76 79 82 85 88 90 91 62 16 35 50 67...
result:
ok Correct!
Test #28:
score: 0
Accepted
time: 20ms
memory: 3904kb
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 16 17 32 37 71 94 14 83 54 77 44 64 84 25 60 9 42 27 31 66 73 68 59 43 75 82 35 40 41 74 95 36 30 26 29 72 28 38 53 80 6 57 47 18 10 85 19 87 7 91 63 1 21 48 93 33 70 11 76 55 56 61 23 92 2 15 20 22 81 34 45 88 67 13 4 52 46 65 49 86 51 50 79 78 69 58 39 89 5 8 12 24 62 90 89 56 72 22 39 57 63...
result:
ok Correct!
Test #29:
score: 0
Accepted
time: 8ms
memory: 4832kb
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 12 14 29 33 42 48 51 54 57 58 60 86 99 125 127 133 137 139 149 153 161 187 188 212 231 243 255 282 288 297 298 300 307 347 354 365 374 401 405 407 427 432 437 438 440 445 446 450 457 459 464 469 471 493 497 197 330 394 481 159 472 277 237 382 144 192 453 319 160 94 348 17 110 392 361 173 291 331...
result:
ok Correct!
Test #30:
score: 0
Accepted
time: 42ms
memory: 5304kb
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 1 4 9 12 15 28 38 41 52 60 61 63 66 68 73 75 76 79 80 91 94 99 108 110 115 122 131 133 138 146 148 150 152 154 155 156 157 165 166 169 174 176 180 183 184 185 188 189 190 192 193 194 195 204 205 207 213 215 218 220 225 226 228 231 238 243 247 249 250 252 253 254 257 258 259 261 263 266 267 268 2...
result:
ok Correct!
Test #31:
score: 0
Accepted
time: 123ms
memory: 9264kb
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 1 4 8 9 13 14 18 23 28 30 31 32 35 42 44 45 46 47 49 51 52 54 58 60 66 71 73 77 78 80 83 91 94 97 99 100 101 102 111 114 117 119 123 125 127 130 136 143 150 159 169 173 175 183 186 188 192 193 194 197 199 207 208 211 213 215 222 225 226 227 228 236 238 246 248 260 261 269 273 281 285 287 288 290...
result:
ok Correct!
Test #32:
score: 0
Accepted
time: 2ms
memory: 3752kb
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 18 20 21 22 23 24 25 27 28 30 31 33 34 35 36 38 39 40 41 43 44 45 46 48 49 16 2 3 5 9 13 14 17 19 26 29 32 37 42 47 31 1 7 9 11 12 13 14 16 17 18 20 21 23 24 27 28 29 30 32 34 35 37 38 40 42 43 45 46 47 49 36 2 3 4 5 6 8 10 15 19 22 25 26 31 33 39 41 44 48 30 1 2 4 6 8 9 1...
result:
ok Correct!
Test #33:
score: 0
Accepted
time: 3ms
memory: 3988kb
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 6 8 9 12 14 15 16 19 21 22 23 25 26 27 33 34 36 38 40 41 43 44 45 50 51 53 55 56 57 58 60 62 67 68 69 70 71 73 75 76 77 81 84 85 87 88 91 93 94 95 96 97 99 4 11 32 66 31 2 3 7 10 13 17 18 20 24 28 29 30 35 37 39 42 46 47 48 49 52 54 59 61 63 64 65 72 74 78 79 80 82 83 86 89 90 92 98 63 1 2 3...
result:
ok Correct!
Test #34:
score: 0
Accepted
time: 19ms
memory: 5008kb
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 4 6 7 9 11 12 13 16 18 23 24 26 27 28 29 30 31 32 35 36 38 40 42 43 44 45 47 49 50 53 54 55 57 58 60 62 63 64 65 66 68 69 71 73 75 76 77 78 82 84 88 90 91 92 93 95 97 98 99 101 103 104 107 108 109 112 113 114 115 117 118 121 122 125 126 127 129 131 132 134 135 137 139 140 142 143 145 146 1...
result:
ok Correct!
Test #35:
score: 0
Accepted
time: 0ms
memory: 3996kb
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 2 4 5 8 9 11 13 14 15 17 19 21 23 24 26 28 29 30 32 33 34 36 40 41 44 45 46 6 12 35 39 42 37 43 1 3 7 10 16 18 20 22 25 27 31 38 36 2 3 6 7 8 9 13 14 16 17 18 21 25 27 28 31 33 34 35 36 37 38 41 42 44 46 47 5 12 15 22 29 30 40 45 10 1 4 11 19 20 23 24 26 32 39 43 48 39 1 5 6 8 9 10 12 13 14 16 ...
result:
ok Correct!
Test #36:
score: 0
Accepted
time: 5ms
memory: 4036kb
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 3 6 7 9 11 12 15 16 18 20 22 23 24 27 30 32 34 37 38 39 41 42 44 45 46 47 48 50 54 55 56 58 59 60 62 63 64 66 67 68 70 72 73 74 75 77 80 82 84 86 88 89 90 93 96 97 98 99 2 5 13 10 19 36 53 76 81 83 85 87 91 92 95 1 8 4 14 17 21 25 26 28 29 31 33 35 40 43 49 51 52 57 61 65 69 71 78 79 94 75 1 3 4...
result:
ok Correct!
Test #37:
score: 0
Accepted
time: 29ms
memory: 5056kb
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 6 8 10 11 12 13 14 18 20 21 22 23 25 27 30 31 32 33 36 37 39 42 45 47 48 51 52 53 54 57 59 60 61 63 64 65 66 67 68 69 70 71 72 73 76 77 80 82 83 86 87 89 90 92 94 95 96 97 98 99 100 101 102 105 106 108 109 111 112 114 115 117 119 121 123 128 130 132 134 137 138 139 140 144 146 148 149 150 15...
result:
ok Correct!
Test #38:
score: 0
Accepted
time: 4ms
memory: 3696kb
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 1 3 4 5 6 7 9 11 14 15 16 18 22 25 27 30 31 33 34 35 37 38 39 40 43 8 12 13 19 17 26 32 36 41 42 10 20 28 44 45 21 23 24 2 29 42 1 3 4 5 9 10 12 13 14 15 16 18 19 20 22 24 25 29 30 32 33 34 35 36 38 39 41 45 2 7 17 23 27 28 37 43 42 8 6 21 26 44 11 31 40 44 1 3 5 7 8 9 11 15 16 18 19 25 26 27 2...
result:
ok Correct!
Test #39:
score: 0
Accepted
time: 8ms
memory: 3976kb
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 1 2 6 8 9 10 12 15 17 20 21 22 23 24 25 26 28 29 30 31 32 33 35 36 38 40 41 47 50 51 52 53 56 58 60 63 64 67 68 70 72 73 75 77 80 81 87 89 90 91 92 93 95 3 4 7 14 16 18 34 37 39 43 45 48 49 54 55 61 66 71 74 76 79 85 86 94 13 11 19 42 44 59 69 82 83 84 46 62 65 5 27 57 78 88 90 3 5 8 9 10 15 16 ...
result:
ok Correct!
Test #40:
score: 0
Accepted
time: 45ms
memory: 4844kb
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 4 6 8 12 13 14 18 20 21 22 23 26 28 29 32 33 35 37 38 39 41 42 45 48 49 53 56 57 58 59 64 65 66 67 68 69 71 72 73 74 75 76 77 78 80 82 83 84 87 89 90 91 92 93 94 95 96 97 98 99 100 107 108 109 110 112 114 115 116 121 123 127 128 130 131 132 133 135 138 140 141 142 144 146 149 150 151 152 155 156...
result:
ok Correct!
Test #41:
score: 0
Accepted
time: 6ms
memory: 3708kb
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 2 3 4 5 6 10 14 15 17 19 20 21 22 24 26 27 30 31 32 34 37 38 40 41 43 44 46 47 48 49 8 11 13 7 23 16 18 25 35 29 42 36 39 45 9 12 28 1 33 48 2 3 5 7 9 10 11 12 13 15 16 17 19 20 21 22 23 24 28 30 31 32 36 37 38 39 42 44 46 47 4 6 14 25 18 26 27 33 34 43 35 40 8 29 45 48 1 41 47 3 4 7 8 9 11 13 ...
result:
ok Correct!
Test #42:
score: 0
Accepted
time: 9ms
memory: 3820kb
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 4 6 7 8 9 11 13 16 18 19 20 21 23 25 26 29 30 33 34 36 37 39 41 42 43 44 46 48 50 53 55 56 58 59 62 64 65 66 68 70 74 75 76 80 82 83 84 87 89 90 91 97 98 99 96 1 10 15 22 28 31 24 32 35 45 38 49 52 57 61 63 69 72 71 77 85 86 81 88 3 5 92 95 17 12 14 40 27 47 51 54 67 73 78 94 93 60 79 95 4 5 6...
result:
ok Correct!
Test #43:
score: 0
Accepted
time: 66ms
memory: 5148kb
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 1 3 4 5 8 10 11 12 13 16 17 19 20 21 22 23 24 26 27 30 33 36 37 40 41 45 46 47 48 52 53 54 55 59 62 63 64 65 69 70 74 75 77 80 81 82 83 84 87 90 97 98 99 100 102 103 104 106 114 118 120 124 125 126 127 130 131 132 135 136 141 143 147 149 150 151 154 158 160 162 163 164 166 171 173 176 177 178 18...
result:
ok Correct!