QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#304034 | #7977. 彩虹航线 | hos_lyric | 100 ✓ | 651ms | 78180kb | C++14 | 9.5kb | 2024-01-13 12:45:18 | 2024-01-13 12:45:18 |
Judging History
answer
#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
using Int = long long;
template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << "(" << a.first << ", " << a.second << ")"; };
template <class T> ostream &operator<<(ostream &os, const vector<T> &as) { const int sz = as.size(); os << "["; for (int i = 0; i < sz; ++i) { if (i >= 256) { os << ", ..."; break; } if (i > 0) { os << ", "; } os << as[i]; } return os << "]"; }
template <class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << " "; cerr << endl; }
template <class T> bool chmin(T &t, const T &f) { if (t > f) { t = f; return true; } return false; }
template <class T> bool chmax(T &t, const T &f) { if (t < f) { t = f; return true; } return false; }
#define COLOR(s) ("\x1b[" s "m")
// !!!Modifies ns and edges!!!
// n: modified regular bipartite graph
// d := max degree = edge chromatic number
// iss[c]: edges of color c \in [0, d)
// colors[i]: color of edge i
struct BipartiteEdgeColoring {
int ns[2];
vector<pair<int, int>> edges;
int n;
int d;
vector<int> colors;
vector<vector<int>> iss;
BipartiteEdgeColoring() {}
BipartiteEdgeColoring(int n0, int n1) : ns{n0, n1}, edges() {}
void ae(int u, int v) {
assert(0 <= u); assert(u < ns[0]);
assert(0 <= v); assert(v < ns[1]);
edges.emplace_back(u, v);
}
void run() {
const int m = edges.size();
vector<int> deg[2];
for (int s = 0; s < 2; ++s) deg[s].assign(ns[s], 0);
for (const auto &edge : edges) {
++deg[0][edge.first];
++deg[1][edge.second];
}
d = 0;
for (int s = 0; s < 2; ++s) for (int u = 0; u < ns[s]; ++u) if (d < deg[s][u]) d = deg[s][u];
// Merge vertices of small degree.
for (int s = 0; s < 2; ++s) {
priority_queue<pair<int, int>, vector<pair<int, int>>, std::greater<pair<int, int>>> que;
par.resize(ns[s]);
for (int u = 0; u < ns[s]; ++u) que.emplace(deg[s][u], par[u] = u);
for (; ; ) {
if (!que.size()) break;
const auto p0 = que.top(); que.pop();
if (!que.size()) break;
const auto p1 = que.top(); que.pop();
if (p0.first + p1.first > d) break;
par[p0.second] = p1.second;
que.emplace(p0.first + p1.first, p1.second);
}
int nn = 0;
vector<int> ids(ns[s], -1);
for (int u = 0; u < ns[s]; ++u) if (par[u] == u) ids[u] = nn++;
ns[s] = nn;
if (s == 0) {
for (auto &edge : edges) edge.first = ids[root(edge.first)];
} else {
for (auto &edge : edges) edge.second = ids[root(edge.second)];
}
}
// Add edges to make the graph d-regular.
n = max(ns[0], ns[1]);
for (int s = 0; s < 2; ++s) deg[s].assign(n, 0);
for (const auto &edge : edges) {
++deg[0][edge.first];
++deg[1][edge.second];
}
for (int u = 0, v = 0; ; ) {
for (; u < n && deg[0][u] >= d; ++u) {}
for (; v < n && deg[1][v] >= d; ++v) {}
if (u == n && v == n) break;
edges.emplace_back(u, v);
++deg[0][u];
++deg[1][v];
}
iss.clear();
vector<int> is(n * d);
for (int i = 0; i < n * d; ++i) is[i] = i;
rec(is);
// Remove added edges.
colors.assign(m, -1);
for (int k = 0; k < d; ++k) {
iss[k].erase(std::lower_bound(iss[k].begin(), iss[k].end(), m), iss[k].end());
for (const int i : iss[k]) colors[i] = k;
}
}
vector<int> par;
int root(int u) {
return (par[u] == u) ? u : (par[u] = root(par[u]));
}
// is: k-regular
void rec(vector<int> is) {
if (!is.size()) return;
const int k = is.size() / n;
if (k == 1) {
std::sort(is.begin(), is.end());
iss.push_back(is);
} else if (k % 2 != 0) {
if (iss.size()) {
is.insert(is.end(), iss.back().begin(), iss.back().end());
iss.pop_back();
rec(is);
} else {
// Add (2^e - k) bad matchings to find a perfect matching.
const int e = (31 - __builtin_clz(k)) + 1;
vector<int> ma(n);
for (int u = 0; u < n; ++u) ma[u] = ~u;
for (; ; ) {
auto js = is;
for (const int j : ma) for (int l = 0; l < (1 << e) - k; ++l) js.push_back(j);
for (int f = e; --f >= 0; ) {
const auto jss = euler(js);
int numBads[2] = {};
for (int s = 0; s < 2; ++s) for (const int i : jss[s]) if (i < 0) ++numBads[s];
js = jss[(numBads[0] <= numBads[1]) ? 0 : 1];
}
ma.swap(js);
bool good = true;
for (const int j : ma) if (j < 0) {
good = false;
break;
}
if (good) break;
}
std::sort(ma.begin(), ma.end());
iss.push_back(ma);
std::sort(is.begin(), is.end());
vector<int> iis;
auto it = ma.begin();
for (const int i : is) {
for (; it != ma.end() && *it < i; ++it) {}
if (!(it != ma.end() && *it == i)) iis.push_back(i);
}
rec(iis);
}
} else {
const auto jss = euler(is);
for (int s = 0; s < 2; ++s) rec(jss[s]);
}
}
// Take Eulerian circuit and take edges alternately.
vector<vector<int>> euler(const vector<int> &is) {
const int isLen = is.size();
vector<int> used(isLen, 0);
vector<vector<pair<int, int>>> graph(n + n);
for (int x = 0; x < isLen; ++x) {
const int i = is[x];
int u, v;
if (i >= 0) {
u = edges[i].first;
v = n + edges[i].second;
} else {
u = ~i;
v = n + ~i;
}
graph[u].emplace_back(x, v);
graph[v].emplace_back(x, u);
}
vector<vector<int>> jss(2);
int side = 0;
vector<int> stack;
for (int u0 = 0; u0 < n; ++u0) {
for (stack.push_back(u0); stack.size(); ) {
const int u = stack.back();
if (graph[u].size()) {
const int x = graph[u].back().first;
const int v = graph[u].back().second;
graph[u].pop_back();
if (!used[x]) {
used[x] = 1;
jss[side].push_back(is[x]);
side ^= 1;
stack.push_back(v);
}
} else {
stack.pop_back();
}
}
}
return jss;
}
};
////////////////////////////////////////////////////////////////////////////////
int N, M, K;
vector<int> A, B;
vector<vector<int>> C;
int main() {
for (; ~scanf("%d%d%d", &N, &M, &K); ) {
A.resize(M);
B.resize(M);
C.assign(M, vector<int>(K));
for (int i = 0; i < M; ++i) {
scanf("%d%d", &A[i], &B[i]);
--A[i];
--B[i];
for (int k = 0; k < K; ++k) {
scanf("%d", &C[i][k]);
}
}
BipartiteEdgeColoring bec(N, N);
for (int i = 0; i < M; ++i) {
bec.ae(A[i], B[i]);
}
bec.run();
const auto &colors = bec.colors;
// cerr<<"colors = "<<colors<<endl;
int limC = 0;
for (int i = 0; i < M; ++i) {
for (int k = 0; k < K; ++k) {
chmax(limC, C[i][k]);
}
}
++limC;
vector<vector<int>> iss(limC);
for (int i = 0; i < M; ++i) {
for (int k = 0; k < K; ++k) {
iss[C[i][k]].push_back(i);
}
}
vector<int> ans(M, -1);
vector<int> sa(N, -1), sb(N, -1);
for (int c = 0; c < limC; ++c) if (iss[c].size()) {
/*
stable matching
left: prefer large color
right: prefer small color
*/
vector<int> as, bs;
for (const int i : iss[c]) if (!~ans[i]) {
as.push_back(A[i]);
bs.push_back(B[i]);
}
sort(as.begin(), as.end()); as.erase(unique(as.begin(), as.end()), as.end());
sort(bs.begin(), bs.end()); bs.erase(unique(bs.begin(), bs.end()), bs.end());
const int asLen = as.size();
const int bsLen = bs.size();
for (int x = 0; x < asLen; ++x) sa[as[x]] = x;
for (int y = 0; y < bsLen; ++y) sb[bs[y]] = y;
vector<vector<int>> g(asLen);
for (const int i : iss[c]) if (!~ans[i]) {
g[sa[A[i]]].push_back(i);
}
for (int x = 0; x < asLen; ++x) {
sort(g[x].begin(), g[x].end(), [&](int i0, int i1) -> bool {
return (colors[i0] < colors[i1]);
});
}
vector<int> isA(asLen, -1), isB(bsLen, -1);
for (int x0 = 0; x0 < asLen; ++x0) {
for (int x = x0; g[x].size(); ) {
const int i = g[x].back();
g[x].pop_back();
if (~isB[sb[B[i]]]) {
if (colors[isB[sb[B[i]]]] > colors[i]) {
x = sa[A[isB[sb[B[i]]]]];
isA[sa[A[i]]] = isB[sb[B[i]]] = i;
isA[x] = -1;
}
} else {
isA[sa[A[i]]] = isB[sb[B[i]]] = i;
break;
}
}
}
// cerr<<c<<": "<<isA<<" "<<isB<<endl;
for (int x = 0; x < asLen; ++x) if (~isA[x]) {
ans[isA[x]] = c;
}
}
for (int i = 0; i < M; ++i) {
if (i) printf(" ");
printf("%d", ans[i]);
}
puts("");
}
return 0;
}
详细
Subtask #1:
score: 1
Accepted
Test #1:
score: 1
Accepted
time: 1ms
memory: 3836kb
input:
150 150 1 144 5 1 141 54 1 26 120 1 148 68 1 136 62 1 114 1 1 33 136 1 85 100 1 97 124 1 84 66 1 107 81 1 82 135 1 112 44 1 20 89 1 50 32 1 52 94 1 89 88 1 3 57 1 130 23 1 140 150 1 96 37 1 122 38 1 41 63 1 99 85 1 13 95 1 142 47 1 95 4 1 69 17 1 27 119 1 73 93 1 108 43 1 54 18 1 37 76 1 67 114 1 40...
output:
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
result:
ok construction is correct.
Test #2:
score: 0
Accepted
time: 1ms
memory: 3900kb
input:
150 150 1 117 132 96 147 4 114 67 57 60 62 94 20 48 117 68 31 144 27 19 44 121 3 51 92 83 52 67 26 125 56 8 124 75 125 31 52 79 8 21 132 14 136 77 111 45 134 136 145 129 73 85 122 92 143 59 76 36 60 127 115 102 126 133 10 106 32 93 35 106 75 47 102 45 140 41 44 108 146 25 98 106 140 116 76 143 3 87 ...
output:
96 114 60 20 68 27 121 92 67 56 75 52 21 136 45 145 85 143 36 115 133 32 106 102 41 146 106 76 87 90 116 15 147 51 35 85 15 83 43 105 89 12 89 140 103 114 135 78 93 80 87 93 19 7 125 132 96 96 99 48 1 63 3 6 146 116 48 9 126 6 106 64 74 84 16 23 119 51 7 83 96 56 94 97 27 15 51 106 95 32 70 103 75 8...
result:
ok construction is correct.
Test #3:
score: 0
Accepted
time: 1ms
memory: 3808kb
input:
150 10 1 35 145 1 145 88 2 130 14 1 111 142 1 138 99 1 76 73 1 101 79 1 147 137 2 65 64 1 108 8 2
output:
1 2 1 1 1 1 1 2 1 2
result:
ok construction is correct.
Subtask #2:
score: 2
Accepted
Test #4:
score: 2
Accepted
time: 157ms
memory: 43376kb
input:
75 5625 150 11 6 680849 150419 731361 419631 223710 806977 837589 529911 568337 456216 515190 302854 672904 388629 548276 803173 770491 610684 550790 786097 253610 446581 705772 610053 637171 567249 365794 571846 431219 213414 466432 53255 748825 765338 761154 556712 159152 463622 706471 49434 59624...
output:
980 3381 1885 123 19436 2560 2359 3518 22349 781 3686 5196 6995 58 34 631 7775 5611 9896 1481 11434 2253 2756 170 1112 7853 9236 20266 5409 1781 3095 1124 2145 201 8611 430 3048 1838 129 7881 9615 12237 335 425 9372 303 4913 1877 16645 6954 5793 1073 6631 8819 14 1400 11886 3472 2148 3635 2287 15866...
result:
ok construction is correct.
Test #5:
score: 0
Accepted
time: 72ms
memory: 11976kb
input:
75 5625 150 55 59 136 110 80 141 34 72 121 2 116 38 39 16 56 20 147 81 58 64 24 83 73 30 127 97 128 35 77 96 54 21 106 57 32 115 133 84 50 103 94 45 68 53 31 8 55 44 89 41 36 150 3 28 9 98 66 49 119 101 114 112 82 11 22 124 134 107 105 90 88 145 87 135 26 79 37 122 10 15 104 27 18 120 7 13 46 139 40...
output:
34 6 55 34 46 22 21 3 14 23 49 10 47 54 46 72 22 15 32 25 1 18 51 46 11 31 65 13 59 52 10 68 42 5 35 11 2 17 71 68 61 10 18 69 61 72 16 13 47 10 17 61 13 6 73 65 2 3 50 17 22 25 42 21 74 56 65 26 11 13 13 9 50 35 61 64 65 75 66 59 6 70 4 49 67 6 5 52 37 5 52 5 58 36 50 37 40 39 60 5 75 3 11 30 22 12...
result:
ok construction is correct.
Test #6:
score: 0
Accepted
time: 82ms
memory: 30180kb
input:
75 3750 150 1 29 15545 372923 77579 125076 509966 151564 332286 414939 296369 227609 9580 52174 99587 224186 2679 309545 38096 115252 281893 44718 259941 187595 500086 197842 267668 399469 254416 114691 268905 112134 257669 210411 135373 423915 537194 17707 204354 99757 234452 307155 82087 64190 309...
output:
1133 8931 6979 292 4622 3682 3085 1837 3717 806 1577 243 3800 1530 5699 5036 5663 1854 1290 447 377 7910 1190 5340 9940 4996 13835 5304 878 5407 8178 3666 2542 478 23 3939 1330 449 6141 312 4935 2216 2337 96 6700 807 1509 776 23474 11235 10940 9509 5258 10608 7340 556 3767 3414 1978 748 6728 4270 29...
result:
ok construction is correct.
Test #7:
score: 0
Accepted
time: 44ms
memory: 8700kb
input:
75 3750 150 43 71 86 127 132 6 139 123 83 37 85 103 52 102 4 148 111 34 110 66 42 130 150 149 53 45 137 129 2 5 87 79 146 47 9 98 96 54 17 126 81 115 7 105 117 119 101 144 74 23 44 19 84 97 50 13 22 94 78 63 134 40 142 76 109 95 12 138 112 72 136 24 77 31 32 118 124 135 68 104 16 1 93 106 128 51 20 ...
output:
30 28 14 47 31 6 15 25 5 51 52 3 14 1 5 22 2 24 1 52 18 6 18 34 40 30 20 1 53 35 16 45 10 18 15 43 10 32 10 28 40 39 18 48 41 26 30 48 8 10 4 43 38 15 31 18 49 5 35 27 34 21 36 27 36 4 15 13 54 2 23 5 41 8 54 43 3 37 44 48 35 37 10 48 43 18 23 27 32 3 41 18 41 2 19 42 26 33 48 37 51 32 25 45 13 28 8...
result:
ok construction is correct.
Subtask #3:
score: 11
Accepted
Test #8:
score: 11
Accepted
time: 1ms
memory: 4120kb
input:
150 300 2 81 6 1 2 64 88 1 2 5 76 2 1 22 9 2 1 32 142 1 2 97 32 2 1 18 87 1 2 146 100 2 1 56 139 1 2 61 109 2 1 124 105 2 1 126 145 1 2 16 19 1 2 16 138 2 1 131 111 2 1 145 111 2 1 59 59 2 1 89 43 1 2 2 38 1 2 63 149 2 1 46 48 1 2 140 131 1 2 86 10 2 1 116 40 1 2 123 38 2 1 75 109 2 1 131 142 1 2 9 ...
output:
2 2 1 2 1 1 2 2 1 1 1 1 1 2 1 2 1 2 2 1 1 1 1 2 1 2 2 1 1 1 2 2 2 2 2 2 1 1 2 2 1 2 1 2 2 1 1 1 2 2 2 1 1 1 1 1 2 1 1 2 2 1 2 1 1 2 1 1 2 2 1 1 1 1 2 2 1 2 1 2 1 2 2 1 2 1 1 1 2 1 1 1 1 2 2 1 2 1 1 1 1 1 2 1 2 2 2 1 2 2 2 2 2 1 1 1 1 2 2 2 1 1 2 2 1 2 1 2 1 1 2 2 2 2 2 2 2 1 2 1 2 2 2 2 2 1 2 1 2 2 ...
result:
ok construction is correct.
Test #9:
score: 0
Accepted
time: 1ms
memory: 3852kb
input:
150 300 2 60 122 3 1 114 17 2 1 21 19 3 1 134 75 3 1 64 81 2 1 52 33 1 3 45 27 1 2 148 91 2 1 110 100 1 2 100 74 2 3 53 130 3 2 59 19 3 1 149 108 3 1 19 92 1 3 85 66 3 2 80 89 3 2 16 4 2 3 39 90 2 3 53 102 3 1 20 21 3 1 21 112 1 3 76 98 1 2 7 130 3 1 140 129 2 3 139 100 3 1 127 77 1 3 136 113 3 2 54...
output:
3 1 3 1 1 1 2 2 1 3 2 1 3 3 2 2 3 2 1 3 1 1 1 2 3 3 2 2 2 2 1 2 2 1 3 1 2 1 1 2 2 1 3 3 2 1 2 1 1 3 1 1 3 1 1 2 1 2 1 1 3 2 1 3 1 2 3 2 1 2 2 3 1 1 1 1 1 3 3 3 2 3 1 3 1 1 1 2 1 2 1 3 1 1 3 1 3 1 1 2 1 3 2 2 1 2 2 2 3 2 2 2 2 2 2 1 3 2 2 2 3 1 2 1 2 2 3 2 1 1 2 2 2 1 2 2 3 3 3 2 1 3 1 2 2 3 2 1 3 1 ...
result:
ok construction is correct.
Test #10:
score: 0
Accepted
time: 1ms
memory: 3852kb
input:
150 300 2 27 132 4 3 36 120 3 4 100 77 2 3 139 62 2 1 106 59 2 3 33 69 2 3 111 14 4 2 90 140 1 2 38 63 2 4 76 49 1 4 49 26 4 2 50 100 2 4 116 7 3 4 143 127 3 4 43 105 3 1 65 72 3 4 94 111 1 2 70 72 1 2 49 107 3 2 92 27 4 2 42 119 4 1 42 46 2 1 88 143 4 3 79 99 2 3 3 84 4 1 85 13 4 2 38 67 1 3 43 31 ...
output:
4 3 2 1 2 2 4 1 4 1 4 2 3 3 1 4 1 1 2 4 1 2 3 2 4 2 1 2 3 4 3 1 1 2 3 4 3 3 1 4 1 2 1 1 1 1 1 2 2 1 1 2 1 2 3 3 4 2 1 1 2 2 1 2 4 1 1 2 4 1 2 2 1 1 2 2 1 2 1 3 3 3 2 2 2 3 3 2 1 4 2 1 3 3 2 3 1 3 2 1 1 2 4 2 3 4 3 2 3 3 3 1 1 2 1 3 1 2 3 1 1 2 1 2 2 3 2 3 3 4 2 1 1 4 3 2 4 3 2 3 1 4 3 1 3 1 4 2 1 4 ...
result:
ok construction is correct.
Test #11:
score: 0
Accepted
time: 1ms
memory: 3844kb
input:
150 300 2 87 61 2 16 114 49 13 10 25 34 13 18 19 62 2 6 44 60 10 14 132 71 20 18 40 51 13 17 67 25 13 18 125 40 19 14 82 53 19 8 66 118 19 3 38 136 6 12 150 135 14 7 75 53 10 1 54 33 4 8 69 19 8 5 129 72 13 17 149 74 14 10 136 117 1 18 13 80 4 18 107 11 13 18 41 14 3 10 15 90 3 11 104 43 6 18 52 80 ...
output:
2 10 13 2 10 18 17 13 14 19 3 6 7 1 4 5 13 10 1 4 13 3 3 6 6 17 14 2 18 2 16 1 19 6 10 6 9 3 7 5 14 8 3 3 4 5 2 12 6 16 5 1 7 4 4 9 19 6 11 2 8 4 8 1 14 1 4 14 1 2 8 8 17 10 2 2 6 2 17 4 6 4 11 3 18 12 2 18 12 4 7 18 8 11 11 5 6 11 5 9 4 3 1 12 10 7 3 17 2 13 6 1 6 1 10 12 1 7 13 5 2 12 8 10 5 13 14...
result:
ok construction is correct.
Test #12:
score: 0
Accepted
time: 1ms
memory: 3804kb
input:
150 300 2 46 114 441 328 119 80 69 102 9 78 444 336 8 47 230 59 60 140 548 248 147 131 36 399 68 86 447 183 97 13 461 318 31 93 536 570 35 41 237 149 53 77 156 95 123 119 562 202 94 26 519 23 129 128 438 80 74 139 454 108 92 68 559 399 140 61 11 178 106 137 15 575 140 15 22 289 65 50 263 546 9 45 31...
output:
328 69 336 59 248 36 183 318 536 149 95 202 23 80 108 399 11 15 22 263 31 195 67 207 27 283 367 230 30 535 547 302 287 41 297 110 260 168 239 90 185 137 83 295 29 51 12 264 277 299 15 453 167 154 150 197 46 368 427 154 453 463 458 172 299 496 253 203 301 106 113 168 101 34 429 155 172 247 263 110 29...
result:
ok construction is correct.
Test #13:
score: 0
Accepted
time: 1ms
memory: 3820kb
input:
150 150 2 138 25 1 2 71 40 2 1 146 116 1 2 110 122 2 1 59 36 1 2 147 145 2 1 80 88 2 1 38 13 1 2 137 6 1 2 57 84 2 1 25 84 2 1 125 75 2 1 73 128 1 2 94 69 2 1 27 18 1 2 89 119 1 2 8 131 1 2 62 3 1 2 32 67 2 1 77 77 2 1 78 6 1 2 142 70 2 1 61 16 2 1 21 129 2 1 2 126 1 2 136 128 1 2 141 35 2 1 65 78 1...
output:
1 2 2 2 1 2 1 1 1 2 1 1 1 1 2 1 1 1 1 2 2 1 1 2 2 2 1 1 2 1 1 2 2 1 2 1 2 1 1 1 1 2 1 2 1 2 1 2 2 1 2 2 2 2 2 1 1 2 1 2 1 1 1 1 1 2 1 2 1 1 1 2 1 2 1 2 1 2 1 2 2 1 1 1 1 1 2 2 2 1 1 1 2 2 2 1 2 1 2 2 2 2 2 2 1 1 2 1 1 1 1 1 1 2 1 1 1 1 2 2 1 2 1 2 1 1 1 2 1 1 2 2 2 2 1 1 2 1 1 1 2 1 2 1 1 1 1 1 1 1
result:
ok construction is correct.
Test #14:
score: 0
Accepted
time: 1ms
memory: 3816kb
input:
150 150 2 73 97 3 2 50 90 3 1 106 133 1 3 2 65 1 2 47 141 3 2 75 24 1 2 93 85 2 1 14 12 3 2 53 15 2 1 136 120 1 3 68 49 1 2 13 127 2 3 26 87 1 3 78 79 1 3 130 97 3 1 3 8 3 1 55 3 3 1 122 27 3 1 39 51 2 3 72 64 2 3 85 98 2 1 148 18 2 1 90 110 3 1 21 89 2 1 116 75 1 2 52 99 1 2 41 29 1 3 60 130 2 1 10...
output:
2 1 3 1 2 2 1 2 1 1 2 2 1 1 1 1 1 1 3 2 1 1 1 1 2 2 1 1 1 2 1 1 2 1 1 1 2 2 2 3 3 3 2 2 1 2 3 2 2 1 2 1 2 2 1 2 2 2 2 1 2 1 1 1 2 1 2 3 2 2 2 3 1 1 2 2 2 2 2 2 3 2 1 1 1 1 3 2 2 1 2 1 2 3 1 1 1 1 1 2 1 1 2 1 1 2 2 3 2 1 1 1 3 1 2 1 3 3 1 1 1 3 1 2 1 2 1 2 2 2 3 2 2 1 1 3 3 2 2 1 3 1 3 2 2 1 2 1 1 1
result:
ok construction is correct.
Test #15:
score: 0
Accepted
time: 1ms
memory: 3820kb
input:
150 150 2 134 2 3 4 139 116 2 4 100 69 1 4 45 66 4 2 24 64 2 3 93 43 4 2 137 144 1 3 40 105 1 4 134 108 2 4 98 40 3 1 20 144 3 1 11 51 3 2 101 89 1 3 46 53 1 2 39 23 1 3 109 40 2 3 30 7 2 3 142 6 1 3 38 112 4 2 108 28 1 2 111 32 1 4 28 49 4 2 89 14 2 4 65 143 4 3 43 8 1 2 92 56 4 2 106 53 2 4 117 14...
output:
3 2 1 2 2 2 1 1 2 1 3 3 3 1 1 2 2 3 2 2 1 2 2 3 1 4 2 1 2 2 1 2 1 3 4 3 4 2 3 2 1 3 4 2 3 1 1 2 3 4 1 3 3 4 2 2 2 2 2 2 1 1 1 4 1 1 1 1 2 2 2 3 4 4 1 2 1 2 1 2 2 2 2 1 2 3 3 1 1 1 3 2 1 2 1 1 1 3 1 1 1 2 3 2 1 2 4 3 1 2 3 2 2 1 2 3 1 2 2 3 2 1 1 2 1 4 4 1 1 2 4 2 3 3 1 3 2 4 2 1 1 2 3 1 1 2 1 1 1 1
result:
ok construction is correct.
Test #16:
score: 0
Accepted
time: 0ms
memory: 3832kb
input:
150 150 2 42 118 2 5 44 13 7 14 95 7 20 11 92 142 11 19 96 150 10 18 11 52 6 18 66 48 1 13 17 5 13 16 91 22 8 20 19 71 15 6 73 61 10 5 50 63 3 14 101 143 20 5 52 114 12 17 111 60 19 9 20 4 6 7 54 63 16 18 31 31 9 4 33 148 10 8 37 32 17 19 60 57 20 8 31 136 8 1 65 87 19 4 138 72 6 17 71 112 8 20 83 3...
output:
2 7 11 11 10 18 13 13 8 6 5 3 5 12 9 6 16 4 8 17 20 1 4 6 8 2 2 6 2 8 7 9 2 6 8 1 1 12 9 10 11 1 15 3 9 4 8 3 13 2 13 9 5 8 1 8 10 8 5 16 18 9 6 11 4 16 6 3 11 16 5 8 1 3 5 4 5 2 14 7 8 7 9 7 6 17 1 1 5 7 19 8 1 12 12 11 12 5 20 14 1 10 8 18 6 5 8 10 1 3 15 16 9 4 3 18 10 3 20 6 20 3 7 11 9 3 6 10 5...
result:
ok construction is correct.
Test #17:
score: 0
Accepted
time: 0ms
memory: 4084kb
input:
150 150 2 137 126 61 39 96 140 224 95 145 72 296 11 23 92 241 36 98 129 102 20 90 41 85 39 41 113 188 148 93 131 282 107 10 76 23 225 8 16 16 124 115 135 270 30 20 129 88 48 110 125 94 272 101 98 56 238 106 116 125 110 73 138 234 193 22 127 245 8 58 29 8 140 86 36 212 170 40 97 288 204 30 50 109 75 ...
output:
39 95 11 36 20 39 148 107 23 16 30 48 94 56 110 193 8 8 170 204 75 250 1 221 200 108 92 71 94 73 87 43 88 43 30 32 215 138 51 82 216 12 3 9 227 6 67 32 127 114 11 190 25 97 55 104 14 42 84 167 114 151 99 132 174 164 102 56 134 145 2 167 15 149 26 21 138 112 47 128 87 93 144 74 126 208 67 37 208 265 ...
result:
ok construction is correct.
Subtask #4:
score: 37
Accepted
Test #18:
score: 37
Accepted
time: 388ms
memory: 35580kb
input:
149 22201 150 106 24 20 90 56 109 85 33 76 25 97 77 134 75 15 24 88 16 93 126 43 94 116 120 28 130 21 140 70 111 71 32 29 41 132 39 84 62 27 92 55 117 129 125 127 104 74 114 14 145 36 121 22 69 68 133 59 65 58 148 131 40 54 118 110 3 61 105 4 112 142 122 73 37 1 113 45 87 57 89 103 98 100 63 146 106...
output:
103 135 90 21 72 117 117 19 109 85 148 38 29 67 136 71 36 146 17 60 109 44 3 128 47 37 42 30 65 111 97 148 38 79 73 1 46 41 117 140 33 116 115 122 83 94 71 35 111 69 132 117 61 98 126 41 24 34 136 130 75 59 28 67 145 136 87 45 78 56 33 72 92 67 137 77 123 126 11 37 120 28 75 88 4 136 16 122 23 133 1...
result:
ok construction is correct.
Test #19:
score: 0
Accepted
time: 386ms
memory: 35928kb
input:
149 22201 150 59 87 57 143 9 144 61 104 129 116 26 50 73 24 138 78 82 137 4 100 81 69 101 140 102 115 149 18 42 54 16 28 75 74 130 70 35 12 29 36 2 121 62 37 21 64 71 133 110 96 58 67 59 128 124 56 106 103 53 107 49 141 90 105 8 1 65 13 146 77 83 22 134 84 108 119 44 15 32 88 17 79 48 33 46 120 111 ...
output:
28 122 77 30 100 110 71 90 53 6 29 118 53 132 95 38 18 5 85 117 73 83 78 136 77 6 108 38 20 59 98 100 80 137 111 112 30 46 61 3 16 74 27 59 137 48 67 76 62 66 39 67 140 98 99 72 82 118 128 113 94 88 73 14 62 6 45 58 101 85 103 70 132 96 113 136 114 80 28 105 54 55 130 28 64 41 46 51 142 69 8 18 31 1...
result:
ok construction is correct.
Test #20:
score: 0
Accepted
time: 379ms
memory: 36112kb
input:
149 22201 150 85 67 67 47 152 75 90 126 113 128 46 30 36 85 21 97 79 16 61 39 120 99 153 105 76 107 56 116 118 119 122 94 9 127 12 15 68 104 80 7 100 146 125 95 53 112 74 143 81 27 1 52 40 71 29 88 139 69 13 11 92 132 45 42 38 151 3 60 24 91 2 25 86 133 41 10 33 135 82 57 110 6 114 140 138 62 87 64 ...
output:
43 99 44 82 11 111 28 141 37 101 116 57 26 128 49 63 70 149 111 88 118 105 58 83 25 14 140 67 124 46 149 63 45 62 115 35 94 129 41 73 27 6 119 148 25 34 135 67 45 111 56 18 86 132 34 8 29 120 4 62 87 56 65 31 149 116 97 131 90 129 129 127 115 112 100 46 35 76 30 141 60 1 7 54 117 47 92 75 126 147 12...
result:
ok construction is correct.
Test #21:
score: 0
Accepted
time: 362ms
memory: 37312kb
input:
149 22201 150 20 14 155 45 96 11 71 74 38 143 146 165 31 128 56 133 137 127 4 75 108 44 69 77 141 55 113 22 163 54 67 29 23 37 63 148 25 117 97 65 89 76 51 112 139 151 109 66 82 114 13 80 73 119 61 84 53 40 156 24 20 164 50 122 124 158 8 118 7 120 160 154 152 145 46 138 30 162 132 16 59 15 91 94 52 ...
output:
91 62 73 70 23 35 138 127 118 135 113 72 118 131 44 11 74 30 71 58 94 11 128 1 110 74 1 37 104 68 64 87 144 98 109 58 103 117 6 107 38 45 16 27 1 14 109 83 129 109 53 121 15 50 78 136 95 15 24 1 130 58 3 106 130 119 10 36 132 36 58 27 82 87 75 53 47 66 32 95 48 65 142 16 19 5 127 73 89 78 28 143 33 ...
result:
ok construction is correct.
Test #22:
score: 0
Accepted
time: 651ms
memory: 77728kb
input:
149 22201 150 64 32 323179 933179 87351 997262 611605 404909 732640 452641 642757 539724 945803 438567 594564 413639 542011 13240 428009 469975 976134 998911 916345 580907 215711 24916 933666 193524 159822 766638 161868 151754 502972 194801 55497 466348 151018 849178 317067 34382 293653 929582 83436...
output:
13240 10115 23541 7973 13512 1703 3512 11086 1773 8255 5157 6137 7545 503 327 6820 3506 7744 2089 2811 8484 27220 14708 20666 3855 258 5632 21768 7518 7739 6790 7815 17629 46 1011 935 14569 4481 2399 436 15743 3747 1670 1884 2078 4887 17294 18388 11942 33 2787 7929 2221 16236 10913 5765 201 7063 620...
result:
ok construction is correct.
Subtask #5:
score: 21
Accepted
Test #23:
score: 21
Accepted
time: 394ms
memory: 36720kb
input:
150 22500 150 117 116 91 74 113 95 110 26 141 115 38 66 71 138 17 83 112 99 149 18 3 44 15 28 53 114 96 37 7 145 20 109 80 19 117 16 63 27 42 137 135 132 14 39 1 148 147 30 68 126 12 32 57 67 119 139 124 46 133 24 36 51 69 88 131 60 86 140 102 29 100 150 35 123 84 85 90 105 75 45 77 143 130 127 98 7...
output:
13 74 12 48 58 81 14 127 18 132 40 41 74 60 99 119 72 126 1 32 3 107 124 122 58 106 147 112 8 10 127 48 4 8 150 65 88 28 59 55 137 26 17 29 14 46 91 27 4 32 5 38 5 34 13 12 143 140 20 5 4 122 133 97 35 13 113 145 147 106 1 24 92 47 143 22 47 71 124 64 3 96 62 1 98 117 6 103 107 27 140 105 141 5 44 1...
result:
ok construction is correct.
Test #24:
score: 0
Accepted
time: 387ms
memory: 36200kb
input:
150 22500 150 147 68 107 8 61 49 133 15 148 55 122 84 72 75 29 19 118 99 51 79 142 117 11 50 149 69 87 45 73 92 41 110 56 144 128 47 77 78 141 48 31 53 136 103 94 26 145 151 121 46 101 58 38 10 102 126 22 140 138 40 129 96 82 150 95 30 27 100 28 13 114 74 81 52 116 17 4 143 66 90 20 2 111 21 7 91 68...
output:
16 68 5 101 3 36 19 117 8 14 8 9 128 26 96 140 112 29 68 149 44 18 1 42 142 146 47 96 134 129 138 95 145 21 98 111 20 8 84 3 22 54 101 123 136 13 131 95 75 87 11 128 8 28 7 150 18 6 104 32 49 145 112 23 93 95 90 30 23 109 61 46 5 79 10 123 128 9 33 143 39 13 73 79 80 67 114 128 14 115 42 6 95 1 38 4...
result:
ok construction is correct.
Test #25:
score: 0
Accepted
time: 392ms
memory: 36164kb
input:
150 22500 150 53 59 70 142 54 108 56 6 22 92 39 80 38 84 125 144 117 127 74 71 40 140 33 146 145 72 85 44 128 45 86 94 93 66 34 52 21 59 57 137 78 120 63 67 13 124 2 126 60 76 79 102 116 100 23 150 58 115 107 82 104 138 97 151 106 131 152 42 132 77 32 11 89 55 30 31 95 49 65 96 141 135 17 114 143 14...
output:
67 104 26 34 97 97 24 115 73 27 119 28 88 35 43 49 25 47 24 30 103 126 25 137 56 66 136 85 13 113 68 81 67 21 41 106 144 37 127 56 78 47 123 86 30 78 7 130 46 148 106 102 71 6 15 36 47 50 97 84 64 26 117 127 1 129 76 55 92 105 30 134 66 132 18 99 66 59 49 11 10 85 65 66 53 4 99 125 80 56 150 57 148 ...
result:
ok construction is correct.
Test #26:
score: 0
Accepted
time: 373ms
memory: 36396kb
input:
150 22500 150 81 87 83 67 109 57 147 69 102 72 25 29 39 94 56 73 27 41 81 53 144 101 135 117 127 96 5 145 155 22 87 106 38 19 14 86 58 97 20 35 65 124 47 93 50 10 75 80 52 31 76 154 126 78 91 113 42 118 9 115 15 51 149 141 119 134 92 74 64 129 66 103 110 49 85 143 133 148 12 61 142 151 131 153 21 34...
output:
65 127 18 11 79 30 54 78 20 142 51 95 130 124 11 50 149 60 119 91 140 53 83 31 52 26 113 8 22 66 139 126 92 17 27 119 114 138 10 71 50 37 9 32 123 142 35 138 54 147 101 105 25 5 123 53 4 68 56 8 46 45 17 66 130 87 119 83 142 69 78 121 43 40 138 31 72 139 141 41 43 141 143 18 87 112 128 48 17 132 53 ...
result:
ok construction is correct.
Test #27:
score: 0
Accepted
time: 359ms
memory: 37484kb
input:
150 22500 150 21 135 30 53 162 62 34 163 112 104 16 67 48 161 137 99 94 93 158 20 70 91 12 148 40 24 141 131 29 132 14 44 31 7 167 146 35 113 45 39 136 84 142 108 87 123 129 85 58 134 5 166 28 73 128 56 80 147 155 6 149 76 41 36 88 66 121 86 168 97 63 47 26 116 169 151 95 15 100 19 50 103 98 126 38 ...
output:
12 76 117 20 137 115 89 111 21 89 111 146 133 28 125 79 144 136 63 146 134 58 2 27 122 52 134 17 110 73 28 73 21 76 50 52 33 37 81 50 6 74 57 58 114 3 118 30 20 107 141 3 13 86 120 90 95 92 133 20 148 91 148 9 112 9 68 115 127 141 69 79 6 73 12 2 101 26 58 28 89 126 131 42 36 28 29 61 80 87 68 38 39...
result:
ok construction is correct.
Test #28:
score: 0
Accepted
time: 577ms
memory: 78180kb
input:
150 22500 150 142 84 95127 811376 352518 34572 172491 645409 426070 585385 839136 465937 516075 461423 149284 929627 554965 743036 475305 268781 574670 840165 214086 131675 655651 402556 295405 797734 729790 132978 283490 807542 165311 188276 808619 466578 568749 15488 450230 528624 262879 824125 58...
output:
100 15190 7303 17063 13592 2419 658 385 3163 5545 17208 9676 462 6548 7810 1548 1070 1324 26648 2921 10551 3953 6646 8367 14836 9873 2723 6488 8060 10247 9394 9983 14260 371 974 11797 4944 18851 6570 8901 2229 1182 19219 6745 4575 29630 15348 758 1085 9021 4974 12386 26035 19589 3754 12063 1421 1144...
result:
ok construction is correct.
Subtask #6:
score: 28
Accepted
Test #29:
score: 28
Accepted
time: 1ms
memory: 3900kb
input:
150 450 3 57 22 2 1 3 142 57 1 3 2 138 113 3 1 2 13 77 2 3 1 43 112 1 2 3 82 99 2 1 3 66 65 3 1 2 3 31 2 1 3 24 146 3 2 1 127 18 2 3 1 125 37 1 2 3 13 137 1 2 3 105 127 1 3 2 54 20 1 2 3 48 15 3 1 2 23 71 2 3 1 30 28 1 2 3 125 146 1 3 2 68 120 2 1 3 38 92 2 1 3 101 100 1 3 2 81 28 1 3 2 70 7 1 2 3 1...
output:
1 3 3 2 3 2 2 1 2 2 3 1 2 3 2 3 2 1 3 1 1 1 1 2 2 1 3 1 3 1 2 1 2 2 1 2 1 2 3 2 2 1 2 3 2 3 1 1 3 3 2 2 1 3 3 2 3 2 3 2 2 1 3 1 3 3 1 3 2 1 3 1 3 1 1 1 1 3 2 3 1 3 2 3 2 2 2 1 2 3 1 1 3 2 1 3 2 2 1 1 3 2 1 2 1 2 2 1 3 3 3 3 3 3 1 1 1 2 1 1 1 1 3 2 1 2 3 3 3 1 3 1 3 2 2 2 2 2 2 3 2 3 3 1 3 2 3 2 1 1 ...
result:
ok construction is correct.
Test #30:
score: 0
Accepted
time: 1ms
memory: 3908kb
input:
150 450 3 148 73 905 1007 1204 72 13 614 952 114 72 3 1026 931 764 33 21 1143 204 536 19 112 694 1261 734 104 68 1057 72 1249 83 66 311 147 656 141 5 1349 1317 700 12 113 331 375 1165 49 7 1114 1149 1224 79 41 531 46 712 128 20 630 1175 399 35 74 421 1148 608 57 124 840 108 1238 63 22 922 403 203 35...
output:
905 114 764 204 694 72 147 700 331 1114 46 399 421 108 203 5 223 132 98 676 134 203 42 31 341 976 822 798 64 94 212 266 374 384 52 708 990 76 249 492 130 313 529 89 46 681 15 460 911 833 194 395 104 617 308 122 50 405 38 776 49 25 41 1067 106 986 146 523 366 290 757 103 575 873 100 467 153 211 762 4...
result:
ok construction is correct.
Test #31:
score: 0
Accepted
time: 1ms
memory: 4152kb
input:
150 450 3 111 66 3 4 1 62 51 3 2 4 117 58 3 4 1 54 105 1 3 4 40 108 3 1 4 104 112 2 4 1 131 73 4 3 1 109 30 1 4 3 36 130 3 4 2 40 70 2 3 1 24 112 3 1 4 44 119 4 1 2 39 91 1 4 3 28 118 1 2 3 8 117 2 4 1 110 109 3 1 4 99 20 4 1 2 131 49 4 1 2 130 114 1 4 3 133 57 3 1 2 41 125 1 3 4 21 65 1 2 3 144 143...
output:
3 3 1 1 3 1 3 1 2 2 3 1 3 1 2 1 4 1 3 2 3 2 1 3 1 4 2 2 1 1 3 1 4 2 2 4 2 4 2 3 3 2 2 2 3 2 1 2 1 4 4 1 2 2 3 1 4 1 1 3 4 1 1 3 3 4 1 1 1 2 3 1 3 4 1 2 1 4 2 3 3 1 2 1 3 2 3 1 2 2 1 3 2 1 1 1 3 3 4 1 3 2 2 3 1 1 2 4 2 2 4 2 2 1 3 2 2 1 2 3 4 2 2 2 2 4 3 4 4 4 3 2 2 2 1 3 1 2 4 4 3 2 3 3 1 4 3 1 3 3 ...
result:
ok construction is correct.
Test #32:
score: 0
Accepted
time: 0ms
memory: 3872kb
input:
150 450 3 79 108 4 7 3 85 72 8 3 7 105 47 5 2 8 56 47 3 4 5 66 90 7 5 3 109 68 8 1 7 84 73 5 2 3 14 7 8 5 6 129 111 5 1 2 103 45 1 6 7 102 96 7 3 2 30 80 6 1 8 22 80 5 1 6 55 21 6 3 5 4 104 6 3 8 27 130 2 1 3 64 109 7 2 4 20 110 7 8 6 5 50 5 8 2 116 8 7 8 6 5 74 3 1 6 86 124 2 4 7 129 57 2 7 8 2 9 2...
output:
3 3 8 3 3 7 2 6 5 1 3 1 5 3 6 3 4 7 2 6 3 4 2 2 7 4 2 3 4 5 3 1 6 4 6 3 5 2 1 1 1 2 3 5 6 2 6 1 4 3 6 1 4 4 2 6 5 2 2 3 2 8 1 1 6 3 1 1 1 1 4 7 4 4 2 1 4 2 1 4 3 5 1 4 2 4 1 2 8 2 5 2 1 2 4 1 4 5 2 4 4 2 6 1 1 1 4 5 7 1 2 3 2 1 3 1 3 2 7 4 2 2 1 1 5 4 1 1 1 3 5 1 5 3 6 6 2 1 4 2 6 1 2 3 1 3 2 1 7 2 ...
result:
ok construction is correct.
Test #33:
score: 0
Accepted
time: 1ms
memory: 3876kb
input:
150 350 3 69 53 1 2 3 73 148 3 1 2 29 58 3 1 2 19 84 3 1 2 8 134 3 1 2 46 147 2 3 1 115 114 2 3 1 9 13 1 2 3 27 96 1 3 2 38 75 1 3 2 127 43 2 3 1 18 100 3 1 2 134 36 3 1 2 37 14 1 3 2 33 131 2 3 1 114 17 2 1 3 86 57 2 1 3 136 12 2 3 1 7 121 3 1 2 95 51 2 1 3 84 40 1 3 2 73 47 1 3 2 116 46 2 3 1 133 ...
output:
2 3 1 2 3 3 2 3 2 1 2 3 3 2 1 1 1 1 3 3 3 1 2 2 2 1 2 2 1 1 1 1 3 1 3 3 1 2 1 2 2 2 2 3 1 1 3 3 2 2 2 3 1 2 2 1 1 2 1 1 1 1 2 1 2 1 3 2 1 2 3 3 3 2 2 1 1 1 2 1 2 1 1 1 2 1 1 1 3 1 3 2 2 1 3 1 2 2 3 2 3 1 2 3 1 2 3 1 3 3 2 1 1 3 3 1 3 3 3 2 3 3 3 3 3 2 1 3 2 3 1 3 1 2 3 1 1 1 2 2 1 1 3 1 1 1 3 1 2 1 ...
result:
ok construction is correct.
Test #34:
score: 0
Accepted
time: 0ms
memory: 4088kb
input:
150 1500 10 35 119 4 6 7 8 10 3 5 9 2 1 35 5 4 1 6 7 5 8 9 3 10 2 35 18 4 1 6 9 8 2 10 7 5 3 25 90 9 10 8 1 6 4 5 3 7 2 54 132 2 3 5 4 6 9 10 8 1 7 23 122 8 3 2 6 9 10 4 7 5 1 37 108 2 9 10 7 1 6 5 4 3 8 42 45 3 1 2 4 6 9 5 8 7 10 61 54 5 10 2 1 7 6 4 8 9 3 21 10 6 2 4 3 10 1 5 8 7 9 9 68 6 3 9 5 1 ...
output:
9 1 5 8 8 2 10 1 6 9 9 8 2 10 8 8 6 9 4 3 4 8 3 10 7 6 8 1 3 1 10 2 5 4 10 1 10 7 3 4 8 5 7 5 1 7 6 9 7 9 2 5 6 2 4 5 2 7 5 7 8 8 2 9 9 3 1 7 5 1 10 4 6 10 8 8 1 6 7 5 6 7 10 3 1 5 1 2 2 10 3 7 5 1 5 6 3 8 3 1 4 9 7 9 9 4 3 10 8 3 6 3 4 10 7 1 10 1 4 6 9 3 4 4 5 5 5 4 4 1 2 3 1 3 4 3 2 3 7 10 5 7 3 ...
result:
ok construction is correct.
Test #35:
score: 0
Accepted
time: 4ms
memory: 4236kb
input:
150 1499 10 30 147 12041 480 2534 5853 460 9985 9511 2130 8477 8240 125 143 12383 3967 6251 3622 10294 1397 10212 7716 2711 6137 112 138 2728 3406 8823 707 12079 11902 11817 3859 8350 156 19 142 912 13564 8650 1043 4205 9930 2799 5040 11807 2018 4 32 10346 12401 4848 13807 13988 9904 814 4787 13290 ...
output:
460 1397 156 912 814 88 2021 4567 212 5 3132 1524 237 169 3193 2979 1039 508 3321 649 1005 340 691 4208 241 2330 1249 436 1723 1129 540 363 2777 815 1379 4122 3495 939 1695 255 1884 101 1783 268 138 150 427 1822 975 770 3876 365 1971 4064 464 715 1046 264 132 890 939 1608 404 542 34 2742 194 1749 13...
result:
ok construction is correct.
Test #36:
score: 0
Accepted
time: 4ms
memory: 4340kb
input:
150 1498 10 13 93 4 3 7 9 11 10 5 1 6 8 135 4 11 6 5 1 10 3 2 8 4 9 75 91 3 9 2 8 5 4 1 6 10 11 137 110 10 9 6 2 1 11 3 4 7 8 77 76 5 6 11 3 8 4 9 1 10 7 69 51 2 9 1 4 10 8 5 3 7 11 18 27 10 6 3 11 5 4 1 2 8 7 122 101 11 3 4 2 6 10 8 9 5 1 56 2 7 9 1 10 4 3 11 8 5 2 1 16 2 5 10 8 11 1 9 6 3 4 18 54 ...
output:
1 9 5 3 3 2 11 4 5 4 7 5 10 9 7 4 7 2 1 2 5 3 10 5 2 2 3 8 8 2 8 6 10 2 2 4 1 1 5 9 10 10 4 5 10 9 10 9 3 7 3 6 8 8 6 2 10 3 8 8 4 4 5 1 10 3 10 5 4 6 1 6 9 3 7 1 7 8 8 1 5 5 2 7 5 7 8 5 9 11 1 10 8 5 3 7 4 10 9 6 1 4 9 6 5 4 6 4 9 3 2 10 7 5 1 5 9 4 3 9 9 2 3 5 1 4 8 8 5 9 6 8 5 5 6 7 6 1 6 9 2 11 ...
result:
ok construction is correct.
Test #37:
score: 0
Accepted
time: 3ms
memory: 4060kb
input:
150 1499 10 17 130 7 2 13 11 4 1 3 6 15 10 55 73 2 7 11 13 8 10 6 4 1 9 72 105 4 3 1 2 14 11 12 9 6 10 100 16 6 8 1 4 12 3 10 14 13 11 91 69 7 13 12 5 14 1 11 10 15 2 113 109 7 14 15 10 4 2 11 12 8 5 73 74 1 5 14 6 10 3 2 13 8 9 4 13 10 14 12 2 6 11 15 8 1 5 87 96 1 15 4 10 3 6 12 8 2 11 25 7 1 4 14...
output:
10 4 3 4 5 8 3 1 10 11 7 10 9 2 1 5 1 11 2 1 9 3 1 12 2 2 2 12 6 3 7 11 6 2 11 7 1 11 12 6 3 5 4 9 5 9 7 5 4 3 12 1 9 4 2 3 3 8 5 12 2 3 4 2 10 4 7 5 8 5 6 6 6 8 6 10 1 7 6 5 5 4 2 7 4 8 6 1 6 3 3 5 7 5 10 2 1 3 6 6 9 9 3 9 8 10 2 1 1 2 9 9 1 5 2 8 6 4 3 11 6 3 8 11 5 3 6 7 8 2 10 4 9 9 3 7 5 2 13 2...
result:
ok construction is correct.
Test #38:
score: 0
Accepted
time: 0ms
memory: 4084kb
input:
150 1400 10 101 73 1 7 5 3 10 6 2 8 4 9 100 14 6 4 8 5 9 2 10 7 1 3 89 103 3 2 5 7 1 9 4 8 6 10 31 63 5 10 6 7 9 4 2 8 1 3 81 145 6 7 5 2 9 4 10 8 1 3 103 95 4 8 3 5 2 9 10 1 7 6 14 89 1 9 2 4 10 8 5 3 6 7 90 111 7 10 8 5 4 6 3 1 9 2 82 11 10 7 1 3 9 2 8 6 5 4 5 119 6 9 7 4 10 5 8 1 3 2 147 74 9 2 6...
output:
9 7 10 3 5 1 2 10 9 8 1 4 2 4 10 5 9 9 1 2 9 9 9 4 3 1 6 4 5 7 7 2 10 9 10 2 8 8 6 6 3 2 8 3 3 7 3 3 5 8 7 7 3 5 4 4 10 5 4 3 4 1 2 8 1 2 5 9 8 4 4 8 3 1 7 2 3 3 8 6 4 5 4 2 9 8 1 8 7 10 6 1 7 1 6 4 5 6 1 6 3 9 5 1 9 7 2 1 8 10 3 9 2 3 6 2 7 2 7 10 8 2 5 4 10 6 6 3 5 1 3 1 4 1 7 8 9 9 5 3 7 8 7 7 1 ...
result:
ok construction is correct.
Test #39:
score: 0
Accepted
time: 10ms
memory: 4460kb
input:
150 3000 20 130 71 11 13 17 10 15 2 4 18 3 5 1 7 14 8 9 12 6 20 19 16 93 110 17 11 20 2 1 19 7 9 14 16 4 5 12 10 15 18 8 13 3 6 3 80 1 12 8 3 19 17 6 5 2 15 14 16 11 20 7 18 10 9 4 13 118 56 14 1 16 13 11 20 3 17 18 5 9 10 19 8 7 12 2 4 6 15 87 14 4 19 8 1 7 13 15 18 11 2 14 16 9 20 3 12 6 5 17 10 1...
output:
17 19 11 12 11 2 7 14 17 15 4 19 14 7 13 5 14 17 16 7 14 18 9 13 7 14 5 14 15 6 15 12 9 18 2 16 16 2 17 12 20 11 19 4 5 18 15 13 15 5 6 7 19 20 19 14 11 8 9 5 12 10 12 5 19 12 14 19 9 1 6 7 1 8 13 1 15 17 7 17 7 8 7 15 10 9 12 18 11 5 7 13 5 5 15 1 19 3 7 15 17 6 4 7 18 14 5 4 2 3 10 9 1 20 6 9 5 7 ...
result:
ok construction is correct.
Test #40:
score: 0
Accepted
time: 9ms
memory: 6268kb
input:
150 2997 20 137 131 5762 9111 38967 15773 52237 2826 21697 38030 50735 19494 3273 2767 35083 37295 10180 21810 12236 12874 15065 37851 29 78 50409 52886 11932 43949 7925 40147 2771 49165 639 12786 39123 36098 18441 22546 59053 36310 28727 8858 36938 4917 31 45 14688 22548 41715 42035 1729 54934 3718...
output:
2767 639 1729 1938 907 1845 1704 646 3458 3339 1654 1555 3315 4354 2477 2172 1885 420 6361 2769 2497 6432 6448 284 6098 6151 2444 10474 2186 705 4538 3556 1141 3099 1573 1469 8171 952 2435 6205 6432 629 7305 2348 5490 4726 1721 2058 2595 4916 3513 688 5627 2128 3483 1798 2564 9228 1245 1669 11597 33...
result:
ok construction is correct.
Test #41:
score: 0
Accepted
time: 10ms
memory: 4496kb
input:
150 2998 20 57 43 1 2 17 16 7 9 11 15 6 3 12 20 10 21 5 14 4 13 18 19 70 32 13 15 17 8 19 3 6 5 1 18 16 7 21 4 9 14 12 10 20 11 119 97 2 13 19 4 21 11 8 15 9 16 1 3 10 14 12 17 7 5 6 18 31 74 12 13 20 19 18 11 6 4 10 1 9 8 3 7 2 17 5 14 21 16 40 144 15 3 6 17 9 5 13 21 18 12 14 11 20 7 10 1 19 16 2 ...
output:
17 19 4 9 3 14 18 19 8 1 6 2 9 1 10 9 5 14 11 17 19 5 4 17 5 6 16 4 20 1 19 16 2 7 9 4 9 2 11 2 11 14 15 19 19 7 3 4 7 19 10 5 12 2 9 9 20 1 19 18 1 10 12 17 2 9 16 14 12 2 6 4 18 16 13 7 13 19 10 4 3 5 18 10 11 17 12 17 16 18 16 17 4 15 1 14 2 13 6 14 4 14 19 10 2 8 2 9 14 9 7 9 10 3 1 1 18 8 11 8 ...
result:
ok construction is correct.
Test #42:
score: 0
Accepted
time: 9ms
memory: 4804kb
input:
150 2997 20 63 21 8 6 4 1 19 14 10 16 18 24 2 21 5 3 15 17 7 9 23 12 40 101 12 24 13 18 10 21 22 19 16 15 14 1 23 8 4 2 25 5 7 20 32 150 18 24 16 13 3 22 23 9 20 8 12 14 15 1 25 5 2 6 11 21 122 137 25 7 11 8 5 24 10 22 18 15 9 20 4 16 13 12 17 3 19 6 72 105 12 13 4 21 10 17 24 20 25 9 18 8 14 5 16 1...
output:
8 8 13 20 6 3 13 6 8 5 11 19 20 20 4 10 10 2 9 14 3 1 20 1 9 5 7 21 18 4 16 10 19 19 1 8 19 16 8 7 1 18 5 9 2 18 6 5 2 6 20 20 11 9 20 13 10 14 18 11 13 18 1 16 1 1 13 16 1 15 9 6 5 18 20 11 1 15 8 19 14 20 17 19 13 7 3 8 19 7 6 9 12 3 14 19 12 2 2 6 5 17 21 19 5 3 9 14 13 3 4 6 12 18 21 11 2 18 9 1...
result:
ok construction is correct.
Test #43:
score: 0
Accepted
time: 10ms
memory: 4740kb
input:
150 2900 20 84 108 9 13 4 12 20 6 7 2 11 15 14 1 17 8 16 18 19 3 10 5 24 23 6 13 2 8 20 17 1 4 3 19 12 7 11 16 14 9 5 10 15 18 141 53 11 8 2 13 19 1 12 9 18 4 6 3 14 16 17 15 20 5 10 7 37 109 8 7 2 18 4 17 12 6 16 20 19 13 11 1 10 14 5 3 15 9 88 3 4 20 3 1 15 2 18 7 11 17 9 19 10 12 13 14 6 16 5 8 3...
output:
12 7 15 7 6 11 6 1 15 12 3 1 20 3 12 11 20 1 18 11 7 9 12 12 20 9 20 3 13 13 11 12 3 13 4 7 8 6 13 10 11 11 8 4 2 18 12 14 7 5 18 18 12 6 1 2 8 6 14 4 4 18 3 7 2 2 1 16 3 18 4 15 4 11 14 1 14 5 20 12 2 2 13 6 4 3 12 16 6 3 7 1 10 9 18 9 15 13 13 6 1 14 11 19 9 1 7 5 18 14 13 1 8 15 12 9 3 20 8 4 1 7...
result:
ok construction is correct.
Test #44:
score: 0
Accepted
time: 48ms
memory: 7136kb
input:
150 7494 50 57 77 43 20 29 31 16 40 17 1 37 48 24 33 15 22 23 38 41 7 3 42 11 12 45 5 27 36 8 25 26 34 2 10 19 21 46 6 50 39 44 13 32 4 14 35 47 18 49 9 30 28 7 123 33 10 24 45 26 3 40 11 6 27 29 35 32 17 20 13 8 31 9 37 38 7 1 5 16 43 12 4 28 30 14 36 25 48 49 2 34 41 47 39 21 42 44 19 50 46 18 22 ...
output:
43 13 17 38 37 41 26 34 10 25 47 13 21 12 22 2 43 45 16 31 43 9 31 19 23 44 13 12 26 48 25 42 15 13 4 27 45 13 7 34 43 48 25 1 35 37 29 48 27 7 7 41 43 24 18 21 28 43 19 39 24 23 41 44 18 5 14 39 8 17 43 49 10 18 21 3 29 36 32 11 32 4 20 39 42 24 35 8 24 43 30 39 6 42 50 29 46 13 35 6 7 16 42 17 40 ...
result:
ok construction is correct.
Test #45:
score: 0
Accepted
time: 45ms
memory: 7372kb
input:
150 7483 50 30 40 19 50 18 29 7 53 30 22 1 31 25 20 43 23 55 16 40 42 9 15 3 33 10 35 41 51 44 32 46 21 49 39 34 48 13 28 45 36 24 8 52 47 37 12 4 26 27 11 38 2 7 59 46 18 6 9 52 19 35 21 24 28 39 54 14 16 11 20 41 23 17 7 5 31 8 29 51 25 33 53 4 22 15 37 48 44 32 2 30 47 13 49 10 3 43 34 42 45 12 1...
output:
2 24 29 26 27 38 9 45 42 6 3 10 34 31 38 22 43 45 19 38 34 33 35 14 6 12 30 12 11 33 48 41 9 46 35 46 9 20 12 6 14 48 19 5 8 11 18 14 12 30 10 2 7 33 13 45 2 28 50 15 27 27 40 6 27 41 7 32 15 15 38 47 39 17 13 31 12 3 30 26 19 7 35 20 2 7 18 35 13 9 23 3 18 16 29 42 41 34 32 4 41 5 45 35 5 1 45 49 3...
result:
ok construction is correct.
Test #46:
score: 0
Accepted
time: 167ms
memory: 17628kb
input:
150 14979 100 51 51 23 8 1 82 39 77 42 18 99 74 78 60 49 86 100 63 59 12 52 87 14 83 48 33 5 50 67 34 94 75 28 38 24 70 51 97 7 35 30 55 80 66 10 37 11 41 25 89 68 17 95 56 84 92 90 85 6 81 96 62 57 27 2 20 69 15 4 53 36 16 40 71 45 22 93 88 46 79 58 3 91 64 32 9 21 73 76 29 26 54 65 44 13 72 19 47 ...
output:
81 80 31 64 7 73 53 63 29 79 26 79 2 26 62 11 67 25 17 65 28 12 43 19 81 43 41 88 71 3 64 27 23 76 85 95 21 79 78 92 2 14 18 43 78 4 89 49 72 35 13 69 74 8 63 52 3 97 77 64 36 94 26 50 56 82 1 87 70 54 88 71 91 45 42 45 27 26 70 41 7 83 74 60 67 87 70 61 52 43 53 24 18 77 41 66 39 3 34 98 36 30 8 91...
result:
ok construction is correct.
Test #47:
score: 0
Accepted
time: 165ms
memory: 17496kb
input:
150 14976 100 49 146 50 24 101 73 47 94 6 79 38 8 75 64 36 89 15 29 97 23 56 98 74 17 44 3 7 58 65 49 14 105 21 52 95 12 59 28 10 27 2 69 32 11 91 80 26 87 82 40 48 4 35 100 53 88 5 41 55 72 66 42 22 9 63 85 76 68 77 84 70 45 30 39 57 46 51 60 86 93 61 25 13 19 18 103 96 62 20 99 83 92 33 67 90 54 7...
output:
36 36 70 30 45 16 30 54 62 2 21 28 25 68 100 76 57 32 25 76 94 14 28 81 27 47 94 78 11 59 37 94 65 63 100 85 16 95 98 7 95 16 9 6 29 86 15 34 46 51 40 69 70 75 3 43 90 10 98 89 28 8 34 36 9 73 85 97 48 17 70 45 9 21 97 52 79 39 85 23 68 18 3 63 79 50 54 91 11 54 19 93 34 100 64 56 69 74 67 51 48 70 ...
result:
ok construction is correct.
Test #48:
score: 0
Accepted
time: 342ms
memory: 32596kb
input:
150 20969 140 12 46 41 108 67 140 21 20 11 126 62 100 117 5 76 64 49 60 3 58 55 19 133 85 98 10 18 63 26 122 39 96 115 69 34 53 24 110 45 112 61 120 71 82 129 92 131 16 105 43 138 74 31 95 130 102 17 81 14 70 77 12 32 38 23 124 79 40 86 90 101 123 59 78 94 2 30 118 13 33 65 121 56 116 80 127 44 128 ...
output:
21 92 15 66 94 14 102 53 44 71 23 30 34 58 11 8 13 44 5 7 15 66 76 71 17 111 84 112 137 90 86 93 62 107 48 111 91 16 130 65 47 57 94 85 9 137 32 27 34 19 129 35 29 57 51 34 78 118 63 25 25 125 14 80 77 68 49 128 46 48 9 129 110 68 80 93 83 112 115 58 39 90 80 49 99 57 128 54 120 138 131 34 64 51 25 ...
result:
ok construction is correct.
Test #49:
score: 0
Accepted
time: 334ms
memory: 33208kb
input:
150 20965 140 45 102 99 102 76 9 81 45 94 24 123 52 60 114 75 80 38 51 33 47 49 134 66 39 107 28 141 21 89 3 18 138 12 57 26 77 96 58 43 88 119 10 59 109 98 35 42 11 74 73 140 126 86 56 41 44 90 108 93 46 54 34 83 144 65 27 15 78 14 61 72 4 139 13 48 142 71 101 37 122 25 115 145 5 85 22 16 23 36 136...
output:
12 122 75 46 98 11 52 8 73 106 118 9 97 66 136 27 102 109 127 96 132 133 103 101 56 8 11 138 123 75 117 88 116 100 72 84 102 17 45 88 137 61 60 89 21 91 6 93 110 47 73 69 110 91 15 4 52 107 133 89 88 134 138 37 82 16 65 69 33 2 6 75 74 79 26 103 87 43 110 61 65 72 127 122 137 38 41 67 31 75 69 129 1...
result:
ok construction is correct.
Test #50:
score: 0
Accepted
time: 392ms
memory: 36132kb
input:
150 22317 149 103 74 87 10 60 134 108 54 24 40 13 133 128 31 77 11 135 148 66 137 94 33 105 107 39 91 123 30 89 101 67 65 55 72 145 21 61 76 113 139 121 46 122 22 84 82 19 12 131 125 36 51 126 112 69 129 85 95 38 28 7 48 14 149 70 63 130 111 50 41 117 109 71 83 35 64 44 23 49 78 144 90 124 27 98 114...
output:
56 112 66 118 104 48 118 35 49 88 110 23 139 130 17 144 103 144 100 144 75 124 23 60 22 139 55 134 28 140 88 43 123 68 120 104 62 110 105 6 148 18 51 115 72 105 59 51 96 61 91 72 142 67 118 18 106 49 39 126 114 4 62 130 64 52 142 39 50 80 146 103 67 28 149 6 31 109 60 78 97 110 121 14 104 2 10 44 10...
result:
ok construction is correct.
Test #51:
score: 0
Accepted
time: 387ms
memory: 35948kb
input:
150 22316 149 66 109 81 34 109 53 56 134 62 125 84 57 89 50 100 136 14 124 146 86 78 16 118 55 54 128 44 147 10 142 129 63 107 45 148 19 123 116 113 59 17 95 105 24 5 150 43 141 1 74 85 26 93 112 143 108 30 88 65 83 104 9 97 115 90 114 145 38 13 35 126 11 29 2 92 91 52 121 82 60 151 28 140 22 72 117...
output:
93 43 109 65 94 17 141 42 81 34 125 27 46 1 88 15 61 48 13 5 127 125 50 58 84 113 127 21 106 93 109 120 20 45 44 107 95 112 98 53 63 32 53 13 53 89 42 106 1 70 32 19 60 99 124 31 78 28 38 90 28 46 5 42 51 116 102 86 19 131 46 41 100 140 115 11 38 104 110 86 82 113 68 91 49 3 104 55 98 49 88 122 2 66...
result:
ok construction is correct.
Extra Test:
score: 0
Extra Test Passed