QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#450879 | #8359. travel | definieren | 14 | 15ms | 61200kb | C++14 | 8.5kb | 2024-06-22 19:06:38 | 2024-06-22 19:06:39 |
Judging History
answer
#include <bits/stdc++.h>
#define fir first
#define sec second
#ifdef LOCAL
#define dbg(x) cerr << "In Line " << __LINE__ << " the " << #x << " = " << x << '\n';
#define dpi(x, y) cerr << "In Line " << __LINE__ << " the " << #x << " = " << x << " ; " << "the " << #y << " = " << y << '\n';
#define dbgf(fmt, args...) fprintf(stderr, fmt, ##args);
#else
#define dbg(x) void();
#define dpi(x, y) void();
#define dbgf(fmt, args...) void();
#endif
using namespace std;
using ll = long long;
using ull = unsigned long long;
using i128 = __int128_t;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using vi = vector<int>;
using vpii = vector<pii>;
bool Mbe;
constexpr int MOD = 998244353;
template<typename T> T add(T a, T b, T p = MOD) { return (a + b >= p) ? (a + b - p) : (a + b); }
template<typename T> T del(T a, T b, T p = MOD) { return (a - b < 0) ? (a - b + p) : (a - b); }
template<typename T> T mul(T a, T b, T p = MOD) { return 1ll * a * b % p; }
template<typename T> T cadd(T &a, T b, T p = MOD) { return a = add(a, b, p); }
template<typename T> T cdel(T &a, T b, T p = MOD) { return a = del(a, b, p); }
template<typename T> T cmul(T &a, T b, T p = MOD) { return a = mul(a, b, p); }
template<typename T> bool cmax(T &a, T b) { return a < b ? a = b, true : false; }
template<typename T> bool cmin(T &a, T b) { return a > b ? a = b, true : false; }
namespace FastIO {
constexpr int LEN = 1 << 20;
char in[LEN + 1], out[LEN + 1];
char *pin = in, *pout = out, *ein = in, *eout = out + LEN;
char gc() { return pin == ein && (ein = (pin = in) + fread(in, 1, LEN, stdin), ein == in) ? EOF : *pin ++; }
void pc(char c) { pout == eout && (fwrite(out, 1, LEN, stdout), pout = out); (*pout ++) = c; return; }
void Flush() { fwrite(out, 1, pout - out, stdout); pout = out; }
template<typename T> T Read() {
T x = 0; int f = 1; char ch = gc();
while (ch < '0' || ch > '9') f = (ch == '-' ? (~f + 1) : f), ch = gc();
while (ch >= '0' && ch <= '9') x = (x << 1) + (x << 3) + (ch ^ 48), ch = gc();
return x * f;
}
template<typename T> void Write(T x, char c) {
static char stk[40]; int tp = 0;
if (x < 0) pc('-'), x = ~x + 1;
do stk[tp++] = x % 10 + 48, x /= 10; while (x);
while (tp --) pc(stk[tp]); pc(c); return;
}
void Read(char *s) {
char ch = gc();
while (!((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') ||
(ch >= '0' && ch <= '9'))) ch = gc();
while ((ch != EOF) && ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') ||
(ch >= '0' && ch <= '9'))) *s = ch, s ++, ch = gc();
*s = '\0'; return;
}
void Write(char *s) {
while (*s != '\0') pc(*s), s ++; return;
}
void Puts(char *s) {
Write(s), pc('\n'); return;
}
}
#define getchar FastIO::gc
#define putchar FastIO::pc
#define Flush FastIO::Flush
#define Read FastIO::Read
#define Write FastIO::Write
#define Puts FastIO::Puts
constexpr int N = 5e5 + 5, LG = 19;
int n, op; ll k;
vector<int> G[N];
namespace Solve2 {
int rt, sz[N], mxp[N], dfn[N], ord[N], dfc, dep[N], bel[N];
pair<int, int> st[LG][N];
priority_queue<pair<int, int>> Q;
multiset<pair<int, int>> s;
vector<int> son, ans;
vector<pair<int, int>> dis[N], rng[N];
bool mrk[N];
void Get_Root(int u, int fa) {
sz[u] = 1, mxp[u] = 0;
for (auto v : G[u]) if (v ^ fa)
Get_Root(v, u), sz[u] += sz[v], cmax(mxp[u], sz[v]);
cmax(mxp[u], n - sz[u]), rt = mxp[u] < mxp[rt] ? u : rt;
return;
}
void Dfs1(int u, int fa, int anc) {
sz[ord[dfn[u] = ++ dfc] = u] = 1, bel[u] = anc;
st[0][dfn[u]] = make_pair(dep[u] = dep[fa] + 1, fa);
for (auto v : G[u]) if (v ^ fa) Dfs1(v, u, anc), sz[u] += sz[v];
return;
}
pair<int, int> ST_Query(int l, int r) {
int k = __lg(r - l + 1);
return min(st[k][l], st[k][r - (1 << k) + 1]);
}
int Get_Lca(int u, int v) {
if (u == v) return u;
if ((u = dfn[u]) > (v = dfn[v])) swap(u, v);
return ST_Query(u + 1, v).sec;
}
vector<int> Main(ll k, int o) {
mxp[0] = n + 1, Get_Root(1, rt = 0);
sz[rt] = dep[rt] = 0, dfn[rt] = dfc = 1, bel[rt] = rt, ord[1] = rt;
for (auto u : G[rt]) son.emplace_back(u), Dfs1(u, rt, u), sz[rt] += sz[u];
for (int i = 1; i < LG; i ++)
for (int j = 1; j + (1 << i) - 1 <= n; j ++)
st[i][j] = min(st[i - 1][j], st[i - 1][j + (1 << i - 1)]);
{
ll L = 2 * (n - 1), R = 0;
for (int u = 1; u <= n; u ++) R += dep[u]; R <<= 1;
// cout << L << ' ' << R << endl;
if ((k & 1) || k < L || k > R) return vector<int>(1, -1);
k = (R - k) >> 1;
};
for (int i = 1; i <= n; i ++) {
if (bel[ord[i]] != bel[ord[i + 1]]) continue;
dis[bel[ord[i]]].emplace_back(dep[Get_Lca(ord[i], ord[i + 1])], ord[i]);
}
for (auto u : son) if (dis[u].size())
sort(dis[u].begin(), dis[u].end()), Q.emplace(make_pair(dis[u].size(), u));
// for (auto u : son) {
// cout << u << ": ";
// for (auto dist : dis[u]) cout << dist.fir << ' ';
// cout << endl;
// }
if (k) {
while (Q.size()) {
int u = Q.top().sec; Q.pop();
int dist, v; tie(dist, v) = dis[u].back();
if (dist < k) k -= dist, dis[u].pop_back(), mrk[v] = true;
else {
while (dis[u].back().fir > k) dis[u].pop_back();
mrk[dis[u].back().sec] = true, k = 0; break;
}
if (dis[u].size()) Q.emplace(dis[u].size(), u);
}
}
for (int l = 1, r; l <= n; l = r + 1) {
r = l;
while (bel[ord[r + 1]] == bel[ord[l]] && mrk[ord[r]]) r ++;
rng[bel[ord[l]]].emplace_back(l, r);
}
{
vector<pair<int, int>> ret;
// for (int i = 1; i <= n; i ++) cout << ord[i] << ' '; cout << endl;
// for (auto u : son) for (auto _ : rng[u])
// cout << u << ": " << '[' << _.fir << ',' << _.sec << ']' << endl;
// cout << endl;
for (auto u : son) s.insert({rng[u].size(), u});
if (!o) {
int u = (*-- s.end()).sec; s.erase(-- s.end());
reverse(rng[u].begin(), rng[u].end());
int l, r; tie(l, r) = rng[u].back(); rng[u].pop_back();
reverse(rng[u].begin(), rng[u].end());
s.insert({rng[u].size(), u}); ret.emplace_back(l, r);
}
ret.emplace_back(dfn[rt], dfn[rt]);
while (s.size() > 1) {
int u = (*-- s.end()).sec; s.erase(-- s.end());
int v = (*-- s.end()).sec; s.erase(-- s.end());
int l, r; tie(l, r) = rng[u].back(); rng[u].pop_back(); ret.emplace_back(l, r);
tie(l, r) = rng[v].back(); rng[v].pop_back(); ret.emplace_back(l, r);
if (rng[u].size()) s.insert({rng[u].size(), u});
if (rng[v].size()) s.insert({rng[v].size(), v});
}
if (s.size()) {
int u = (*s.begin()).sec, l, r;
tie(l, r) = rng[u].back(); ret.emplace_back(l, r);
}
if (o) {
for (auto _ : ret)
for (int i = _.sec; i >= _.fir; i --)
ans.emplace_back(ord[i]);
} else {
for (int i = 0; i + 1 < ret.size(); i ++) {
int l, r; tie(l, r) = ret[i];
for (int j = l; j <= r; j ++) ans.emplace_back(ord[j]);
}
int l, r; tie(l, r) = ret.back();
for (int i = r; i >= l; i --) ans.emplace_back(ord[i]);
}
};
return ans;
}
void Clear() {
rt = dfc = 0; while (Q.size()) Q.pop();
son.clear(), s.clear(), ans.clear();
for (int i = 1; i <= n; i ++) {
sz[i] = mxp[i] = dfn[i] = ord[i] = dep[i] = 0, G[i].clear();
bel[i] = 0, mrk[i] = false, dis[i].clear(), rng[i].clear();
for (int j = 0; j < LG; j ++) st[j][i] = {0, 0};
}
return;
}
}
namespace Solve1 {
int dep[N];
int Dfs(int u, int fa) {
dep[u] = dep[fa] + 1; int mx = u, x;
for (auto v : G[u]) if (v ^ fa)
x = Dfs(v, u), mx = dep[mx] < dep[x] ? x : mx;
return mx;
}
int Get_Diameter() {
int u = Dfs(1, 0), v = Dfs(u, 0);
// dpi(u, v)
return dep[v] - 1;
}
vector<int> Main() {
{
ll L = 2 * (n - 1) - Get_Diameter();
// dbg(L)
if (k < L) return vector<int>(1, -1);
};
return Solve2::Main(k + 2 - (k & 1), k & 1);
}
void Clear() {
Solve2::Clear();
for (int i = 1; i <= n; i ++) dep[i] = 0;
return;
}
}
void slv() {
n = Read<int>(), k = Read<ll>(), op = Read<int>();
for (int i = 1; i < n; i ++) {
int u = Read<int>(), v = Read<int>();
G[u].emplace_back(v), G[v].emplace_back(u);
}
if (n == 1) { k ? Puts("-1") : Puts("1"); return; }
if (n == 2) { k == op ? Puts("1 2") : Puts("-1"); return; }
auto ans = (op == 1 ? Solve1::Main() : Solve2::Main(k, 1));
for (auto u : ans) Write(u, ' '); Puts(""); return;
}
void clr() {
op == 1 ? Solve1::Clear() : Solve2::Clear();
return;
}
bool Med;
int main() {
#ifdef LOCAL
freopen("!in.in", "r", stdin);
freopen("!out.out", "w", stdout);
fprintf(stderr, "%.3lf Mb\n", fabs((&Mbe - &Med) / 1048576.0));
#endif
// int T = 1;
int T = Read<int>();
while (T --) slv(), clr();
Flush();
#ifdef LOCAL
fprintf(stderr, "%d ms\n", (int)clock());
#endif
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 2
Accepted
Test #1:
score: 2
Accepted
time: 10ms
memory: 42304kb
input:
0
output:
result:
ok Accepted.
Subtask #2:
score: 2
Acceptable Answer
Test #2:
score: 2
Acceptable Answer
time: 4ms
memory: 44616kb
input:
5 9 28 2 8 6 6 3 3 2 9 5 4 1 1 5 5 2 2 7 9 16 2 1 3 7 8 4 2 2 9 9 8 8 6 6 3 3 5 9 12 1 7 5 5 9 9 2 2 8 6 1 1 8 8 4 4 3 9 22 1 8 5 2 4 4 1 1 6 6 9 7 9 9 5 5 3 9 27 1 2 6 4 8 8 1 5 9 9 1 1 7 7 6 6 3
output:
2 4 8 1 9 6 7 5 3 8 4 2 9 7 5 1 3 6 -1 5 9 4 2 3 7 6 1 8 1 3 5 4 2 9 8 6 7
result:
points 0.50 Partially Correct | type = 2
Test #3:
score: 2
Acceptable Answer
time: 10ms
memory: 42604kb
input:
5 9 16 2 4 3 3 1 7 6 2 8 8 6 6 1 1 5 9 5 9 12 1 6 7 5 4 4 1 1 3 3 2 2 7 8 7 7 9 9 14 1 1 2 2 3 6 4 8 9 9 3 3 4 5 4 4 7 9 12 1 9 4 4 1 1 5 3 2 2 6 6 5 8 5 5 7 9 9 1 8 7 7 3 3 2 2 9 4 9 9 1 1 6 6 5
output:
1 2 8 7 6 9 5 4 3 -1 9 8 3 4 6 5 7 2 1 -1 -1
result:
points 0.50 Partially Correct | type = 2
Test #4:
score: 2
Acceptable Answer
time: 8ms
memory: 44576kb
input:
5 9 13 1 4 7 7 8 8 5 1 9 2 5 3 5 5 9 9 6 9 16 2 7 3 1 5 5 8 8 9 2 3 4 9 9 3 3 6 9 26 1 1 3 3 8 8 9 7 4 2 6 6 9 9 4 4 5 9 25 1 5 3 7 2 2 4 4 9 6 1 1 9 9 3 3 8 9 14 1 3 8 8 5 5 4 7 6 6 4 4 2 2 9 9 1
output:
-1 9 1 5 8 4 6 2 7 3 8 9 5 1 2 7 3 6 4 9 8 7 5 6 2 4 3 1 6 7 4 5 8 3 2 9 1
result:
points 0.50 Partially Correct | type = 2
Test #5:
score: 2
Acceptable Answer
time: 8ms
memory: 44628kb
input:
5 9 27 1 8 2 6 9 9 1 4 5 5 1 1 2 2 7 7 3 9 16 2 2 6 6 9 7 8 8 4 1 4 5 4 4 9 9 3 9 30 1 6 7 9 4 4 2 2 5 1 5 5 3 3 7 7 8 9 12 1 4 1 8 6 6 3 2 5 5 1 1 3 3 7 7 9 9 22 1 2 3 7 8 8 1 1 9 9 5 5 3 3 4 6 4
output:
1 3 6 7 4 8 9 5 2 4 3 2 6 9 7 8 5 1 3 5 8 9 6 4 7 2 1 -1 3 5 8 7 4 6 9 1 2
result:
points 0.50 Partially Correct | type = 2
Test #6:
score: 4
Accepted
time: 6ms
memory: 46616kb
input:
5 9 18 2 7 3 3 8 8 4 4 9 9 1 1 5 2 6 5 6 9 26 2 8 3 3 9 9 5 4 2 2 5 6 7 7 5 5 1 9 25 1 1 5 5 9 9 6 2 4 7 6 6 8 8 4 4 3 9 26 2 1 9 9 4 4 6 5 7 3 7 7 6 6 2 2 8 9 26 2 1 4 4 6 6 8 3 9 9 2 5 8 8 7 7 2
output:
9 2 6 5 7 3 8 4 1 5 8 6 3 4 9 7 2 1 6 3 1 2 4 5 9 8 7 6 1 3 9 8 5 7 4 2 8 1 3 9 4 2 7 6 5
result:
ok Accepted.
Test #7:
score: 2
Acceptable Answer
time: 3ms
memory: 61200kb
input:
5 9 13 1 2 4 5 8 8 1 6 9 9 7 7 1 1 4 4 3 9 29 2 3 2 1 8 8 4 4 6 6 7 5 2 2 9 9 7 9 15 2 1 3 3 7 7 2 2 9 4 5 5 9 9 6 6 8 9 31 1 2 9 9 8 8 6 6 5 5 4 7 4 4 1 1 3 9 21 2 7 2 2 5 1 4 3 6 6 5 9 4 4 5 5 8
output:
-1 -1 -1 5 3 2 1 9 8 7 6 4 -1
result:
points 0.50 Partially Correct | type = 2
Test #8:
score: 4
Accepted
time: 6ms
memory: 46696kb
input:
5 1 0 1 1 0 2 1 0 2 1 0 1 1 0 2
output:
1 1 1 1 1
result:
ok Accepted.
Subtask #3:
score: 4
Acceptable Answer
Dependency #2:
50%
Acceptable Answer
Test #9:
score: 4
Acceptable Answer
time: 3ms
memory: 46840kb
input:
5 13 37 1 3 12 12 7 4 13 13 11 11 8 8 6 1 2 10 9 9 7 7 5 5 6 6 2 13 42 1 2 4 4 13 13 5 5 7 7 12 8 6 6 9 1 10 10 11 3 9 9 12 12 11 13 15 1 9 2 2 11 12 4 4 5 5 6 6 3 3 11 8 13 13 1 7 11 11 10 10 1 13 48 1 11 3 3 4 12 1 7 5 5 8 8 2 2 1 10 1 1 4 4 6 13 9 9 6 13 68 2 13 4 6 5 2 1 1 9 9 11 11 12 12 7 7 5 ...
output:
6 4 13 10 9 11 3 12 7 1 8 5 2 11 12 3 4 2 1 6 8 13 10 9 5 7 -1 4 1 13 7 6 9 5 11 8 12 10 3 2 5 10 2 3 1 13 9 4 11 8 12 7 6
result:
points 0.50 Partially Correct | type = 2
Test #10:
score: 4
Acceptable Answer
time: 10ms
memory: 48940kb
input:
5 13 34 2 2 7 5 11 13 1 1 3 8 9 9 6 6 11 11 3 3 7 7 12 12 4 4 10 13 17 1 2 7 7 11 11 9 10 12 12 4 6 13 13 4 4 8 8 3 3 1 1 9 9 5 13 33 1 7 6 6 1 1 10 10 13 9 4 11 12 12 13 8 13 2 4 4 13 13 3 5 3 13 17 1 8 11 11 13 13 3 3 5 10 2 2 1 1 6 12 7 6 5 5 4 4 9 9 7 13 15 1 5 1 8 3 2 13 13 11 11 6 6 7 7 9 9 1 ...
output:
3 8 9 6 10 4 12 5 2 13 11 7 1 -1 13 2 11 7 6 1 9 5 12 10 8 4 3 -1 -1
result:
points 0.50 Partially Correct | type = 2
Test #11:
score: 8
Accepted
time: 12ms
memory: 48688kb
input:
5 13 24 2 1 5 11 12 12 2 2 10 4 9 9 3 6 13 13 8 8 5 5 10 10 3 3 7 13 28 2 13 5 5 7 7 3 9 6 4 10 8 12 1 12 12 6 6 3 3 2 2 10 10 11 13 50 2 4 13 13 8 8 10 10 1 3 5 12 7 7 1 1 9 9 5 5 2 6 2 11 2 13 64 2 10 3 3 9 9 7 7 11 11 5 5 13 6 2 2 8 4 8 1 13 13 8 8 12 13 52 2 13 12 12 8 8 10 5 6 6 11 9 2 7 2 1 10...
output:
10 6 13 8 1 5 7 4 9 3 11 12 2 3 1 8 12 9 11 4 10 13 5 7 6 2 1 4 11 6 13 2 8 3 5 12 10 9 7 13 10 12 3 4 9 6 7 2 11 8 5 1 2 3 1 13 5 12 6 8 11 10 9 7 4
result:
ok Accepted.
Test #12:
score: 8
Accepted
time: 6ms
memory: 50756kb
input:
5 13 34 1 8 11 11 2 2 10 9 6 3 1 4 13 13 7 7 6 6 12 12 1 1 10 10 5 13 31 1 11 1 1 9 9 5 6 7 7 2 13 4 4 2 2 10 10 12 12 8 8 5 5 3 13 28 2 2 8 8 9 9 6 6 7 4 13 13 11 11 7 7 5 5 1 12 1 1 3 3 10 13 49 1 11 4 4 1 1 8 8 12 12 3 3 7 6 2 13 7 7 5 2 10 10 9 9 5 13 62 1 12 9 9 5 5 6 6 1 1 4 4 2 2 3 8 11 7 10 ...
output:
12 1 5 9 7 13 4 11 8 6 10 2 3 12 3 11 1 9 13 4 6 7 2 5 10 8 7 2 8 9 10 3 12 1 4 13 11 6 5 7 6 2 11 4 10 1 8 9 12 13 5 3 4 2 8 9 12 11 5 10 7 6 13 1 3
result:
ok Accepted.
Test #13:
score: 8
Accepted
time: 7ms
memory: 57044kb
input:
5 13 59 1 10 9 3 8 8 7 7 6 6 12 4 1 13 5 5 12 12 2 2 9 9 1 1 11 13 30 2 9 5 2 1 1 3 3 12 12 8 8 7 7 6 11 10 10 5 5 6 4 6 13 6 13 54 1 11 13 13 12 12 10 9 3 3 5 4 2 6 10 10 7 7 5 5 2 1 2 2 8 13 24 2 2 11 5 12 12 4 8 3 3 6 6 7 7 1 10 9 9 4 4 1 1 11 11 13 13 56 2 3 2 2 8 4 9 9 1 1 5 7 10 10 5 5 11 11 8...
output:
12 11 3 4 8 1 7 10 13 9 6 5 2 6 11 10 2 1 3 12 8 9 13 7 5 4 7 5 6 8 11 1 13 9 12 4 10 3 2 1 13 2 11 8 3 6 7 10 9 5 12 4 11 7 13 10 12 4 6 9 3 1 2 8 5
result:
ok Accepted.
Test #14:
score: 4
Acceptable Answer
time: 3ms
memory: 56848kb
input:
5 13 21 2 1 11 11 10 12 6 6 8 8 2 2 4 4 7 9 5 5 3 13 10 10 3 3 7 13 34 1 11 4 4 12 2 13 13 8 8 5 10 6 7 1 3 6 6 12 12 9 1 5 5 9 13 137 2 7 9 13 12 12 4 4 5 5 10 10 11 11 9 9 8 2 1 8 3 3 1 6 1 13 13 1 13 12 12 2 2 8 8 9 9 3 3 10 1 10 10 6 7 5 5 6 6 11 11 4 13 25 2 6 9 4 12 12 5 5 1 1 3 7 13 13 9 9 8 ...
output:
-1 5 9 6 10 3 7 4 11 1 12 2 13 8 -1 -1 -1
result:
points 0.50 Partially Correct | type = 2
Test #15:
score: 8
Accepted
time: 7ms
memory: 50584kb
input:
5 1 0 1 1 0 2 1 0 2 1 0 1 1 0 2
output:
1 1 1 1 1
result:
ok Accepted.
Subtask #4:
score: 0
Wrong Answer
Test #16:
score: 0
Wrong Answer
time: 11ms
memory: 52808kb
input:
200 9 38 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 26 2 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 10 30 2 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 9 30 2 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 10 28 2 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 41 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 44 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10...
output:
6 5 1 9 2 8 3 7 4 5 1 2 9 8 3 7 6 4 6 10 9 1 2 3 8 4 7 5 5 9 8 1 7 2 3 6 4 6 1 2 3 10 9 4 8 7 5 6 10 1 2 9 3 8 4 7 5 7 6 1 10 2 9 4 3 8 5 6 1 2 3 4 10 9 8 7 5 6 5 1 8 9 3 2 7 4 -1 6 1 2 3 10 9 8 4 7 5 6 1 2 3 4 10 9 8 7 5 6 10 1 2 9 3 8 4 7 5 5 1 9 2 8 7 3 6 4 6 1 2 10 3 9 4 8 7 5 5 9...
result:
wrong answer Integer -1 violates the range [1, 10]
Subtask #5:
score: 0
Skipped
Dependency #4:
0%
Subtask #6:
score: 6
Acceptable Answer
Dependency #3:
50%
Acceptable Answer
Test #42:
score: 12
Accepted
time: 15ms
memory: 54812kb
input:
5 28 65 1 11 9 9 16 16 22 22 21 21 12 14 5 5 27 7 4 4 28 28 20 20 24 8 1 1 25 13 3 3 6 6 2 2 15 17 18 18 19 19 12 12 23 15 24 24 25 25 10 10 27 27 23 23 26 30 74 1 24 2 21 25 4 26 26 15 15 6 6 18 5 20 20 19 19 12 12 8 17 3 3 13 13 29 29 9 27 7 7 14 11 1 1 8 8 16 16 30 30 28 22 2 10 28 28 14 14 18 18...
output:
27 26 13 3 6 2 15 7 4 28 20 24 17 18 19 11 9 16 22 21 12 8 1 25 14 23 10 5 14 18 2 24 22 25 21 23 4 28 30 16 8 12 19 20 5 1 11 10 29 13 3 17 26 7 27 9 15 6 12 5 19 2 20 21 8 18 6 15 10 7 3 13 25 26 23 22 9 11 17 4 16 14 27 24 1 15 28 7 25 4 5 2 9 17 11 6 13 14 27 24 12 8 20 18 3 23 26 29 22 16 30...
result:
ok Accepted.
Test #43:
score: 12
Accepted
time: 7ms
memory: 50912kb
input:
5 27 286 2 22 12 25 2 2 15 15 3 20 16 13 26 27 10 10 21 21 1 1 23 19 24 24 4 4 7 7 26 26 6 6 3 3 18 18 23 11 8 8 9 9 14 14 17 17 12 12 16 16 23 23 5 27 51 2 11 18 18 19 12 10 10 2 4 3 3 5 15 23 23 6 6 9 22 7 26 24 24 13 13 14 14 2 25 7 16 20 20 19 19 17 17 8 1 7 8 2 2 9 9 7 7 5 5 27 27 21 29 56 2 29...
output:
-1 -1 5 12 24 9 10 8 7 25 19 1 26 28 20 14 21 18 15 3 29 4 27 23 16 17 11 22 6 13 2 -1 -1
result:
ok Accepted.
Test #44:
score: 12
Accepted
time: 9ms
memory: 50648kb
input:
5 1 0 1 1 0 1 1 0 2 1 0 1 1 0 2
output:
1 1 1 1 1
result:
ok Accepted.
Test #45:
score: 12
Accepted
time: 3ms
memory: 48736kb
input:
5 27 172 1 17 8 8 13 13 7 7 22 22 3 3 18 15 20 2 25 27 9 9 10 14 6 21 4 4 26 26 10 10 25 25 12 16 19 24 19 12 19 19 1 11 23 23 20 20 6 6 1 5 18 18 1 29 209 1 9 7 7 16 16 12 12 4 4 24 19 25 28 17 17 6 6 1 1 11 11 13 29 15 15 21 5 22 22 27 14 13 13 20 8 24 24 21 21 2 2 25 25 27 27 26 26 23 23 20 20 3 ...
output:
19 1 21 5 26 4 17 27 8 9 11 10 13 2 23 25 7 15 12 22 20 24 3 14 16 18 6 27 10 8 18 9 7 3 16 14 12 28 17 6 4 1 24 11 29 13 15 20 21 23 2 5 26 19 25 22 27 8 2 12 10 5 22 23 26 9 11 18 13 20 1 19 17 24 16 4 15 14 7 6 28 25 21 3 23 16 21 4 11 5 13 26 14 24 15 1 8 20 25 3 2 9 7 6 19 17 12 27 22 18 10 ...
result:
ok Accepted.
Test #46:
score: 6
Acceptable Answer
time: 4ms
memory: 50928kb
input:
5 27 136 1 1 11 11 10 10 8 2 26 24 20 25 27 27 22 22 15 16 9 18 21 21 7 7 5 5 14 14 3 3 9 9 8 8 6 17 26 26 6 13 15 15 23 23 6 6 20 20 12 12 19 4 19 27 196 2 1 12 12 4 4 27 27 14 19 15 15 8 18 7 7 10 10 16 9 2 23 13 26 17 5 25 22 2 6 16 16 25 25 8 8 14 14 21 21 17 17 13 13 24 24 11 11 3 3 2 2 20 28 1...
output:
8 10 6 7 21 18 13 5 25 14 4 3 27 19 16 17 22 12 9 2 15 24 1 26 23 20 11 14 20 6 22 18 9 7 2 10 3 16 11 24 5 23 1 13 25 12 26 19 4 17 15 27 21 8 24 1 17 22 26 13 18 10 23 6 15 27 25 9 5 20 19 21 3 28 11 16 14 2 8 12 7 4 17 25 20 27 26 22 12 21 15 16 19 7 8 3 11 10 5 28 2 9 23 18 6 24 14 1 13 4 4 ...
result:
points 0.50 Partially Correct | type = 2
Test #47:
score: 6
Acceptable Answer
time: 4ms
memory: 48540kb
input:
5 30 66 1 20 19 19 8 8 18 18 24 28 17 3 15 23 16 12 29 29 1 1 11 11 25 25 21 21 2 4 5 5 9 9 14 7 10 10 2 2 13 6 15 15 17 17 13 13 27 22 27 26 27 27 14 30 24 24 16 16 14 29 172 2 20 7 7 27 27 11 26 14 14 17 22 8 29 1 1 21 5 9 24 16 12 18 4 19 19 3 3 25 25 21 23 28 2 8 28 8 8 15 10 18 18 21 21 16 6 9 ...
output:
14 27 17 28 15 3 6 16 23 24 18 8 19 20 30 21 25 11 1 29 12 10 7 26 22 9 5 4 2 13 9 13 23 10 28 12 2 18 22 4 19 8 3 15 25 26 29 14 1 17 20 21 7 24 27 16 11 6 5 2 19 9 21 28 5 13 14 27 20 25 1 7 26 17 16 23 15 10 22 3 12 4 18 8 6 11 24 4 19 23 6 7 18 2 16 15 5 3 14 10 17 22 12 9 24 8 26 20 27 1 25 ...
result:
points 0.50 Partially Correct | type = 2
Test #48:
score: 6
Acceptable Answer
time: 12ms
memory: 56920kb
input:
5 28 164 1 24 18 18 25 25 7 23 11 11 3 10 16 16 2 2 27 27 21 22 9 9 6 1 28 28 19 19 17 17 7 7 12 20 21 21 3 3 6 6 13 8 4 4 12 15 12 12 13 14 13 13 5 26 5 28 153 1 18 4 13 2 25 24 24 7 27 12 10 19 19 9 9 8 15 11 11 6 6 16 16 20 20 1 1 23 23 2 5 8 8 4 4 17 28 21 26 21 21 14 14 3 3 12 12 7 7 2 2 17 17 ...
output:
6 13 15 20 8 10 4 16 28 1 2 19 27 17 21 24 23 18 11 25 3 7 22 26 14 12 9 5 2 26 28 21 15 22 14 11 5 3 6 10 19 27 16 9 12 20 8 18 25 1 4 24 23 17 13 7 19 24 14 18 7 23 13 15 5 2 6 8 26 22 27 16 4 11 9 1 25 10 17 3 12 28 21 20 29 26 1 10 24 8 22 19 5 16 12 14 6 4 25 3 15 20 21 11 2 18 17 30 27 13 2...
result:
points 0.50 Partially Correct | type = 2
Test #49:
score: 12
Accepted
time: 7ms
memory: 54832kb
input:
5 28 90 2 28 3 8 6 26 11 11 15 15 16 5 12 1 27 27 13 21 9 9 22 14 20 4 2 10 18 18 19 19 16 23 6 6 13 13 12 17 16 25 20 20 12 12 3 3 2 2 24 24 22 22 16 16 7 28 92 1 1 11 11 24 14 3 4 10 10 23 23 2 2 26 22 5 15 17 17 18 18 20 20 19 19 28 28 16 12 3 3 9 25 5 6 21 21 16 16 7 9 24 24 13 7 26 26 8 13 27 2...
output:
2 25 14 20 7 17 23 8 6 1 27 13 10 18 19 26 11 15 16 5 21 12 9 28 22 24 4 3 7 26 27 13 24 11 1 9 3 14 12 6 4 25 21 10 22 28 19 20 18 17 15 23 8 5 16 2 6 7 9 15 8 5 4 21 10 19 23 22 24 16 1 14 25 18 17 26 2 13 11 3 27 20 12 22 2 26 25 19 9 28 13 14 15 5 21 10 6 20 23 4 16 8 27 18 11 3 17 29 24 12 7...
result:
ok Accepted.
Test #50:
score: 12
Accepted
time: 7ms
memory: 50700kb
input:
5 27 256 2 1 14 14 12 12 24 24 17 17 21 21 22 22 4 19 10 10 15 25 9 2 11 5 20 20 7 18 15 15 27 27 23 8 4 6 4 4 13 13 9 9 11 11 16 16 26 26 3 3 7 7 23 27 174 2 18 23 23 14 27 4 4 3 9 8 8 16 16 15 22 24 24 11 11 17 25 1 1 2 2 6 6 10 12 19 19 13 13 15 15 5 21 5 26 3 3 14 14 20 20 17 17 7 7 5 5 10 27 17...
output:
11 18 6 19 8 10 1 15 14 27 12 23 24 5 17 20 21 7 22 3 4 13 26 25 16 9 2 5 26 27 12 4 19 3 13 18 25 23 9 14 1 20 8 22 2 24 16 11 6 17 21 15 10 7 13 6 2 26 4 16 21 10 7 18 11 22 14 27 9 25 12 1 20 8 23 15 3 5 24 19 17 9 7 2 22 3 28 21 13 5 20 1 30 15 14 29 10 12 23 17 24 11 19 26 27 16 6 18 25 8 4 ...
result:
ok Accepted.
Test #51:
score: 6
Acceptable Answer
time: 4ms
memory: 56852kb
input:
5 27 75 1 19 4 22 14 15 23 23 1 1 26 26 9 9 13 6 18 18 7 7 16 20 27 25 10 10 21 17 27 12 13 3 11 11 5 8 14 24 4 4 16 16 5 5 14 14 13 13 27 27 21 21 2 29 156 2 12 21 21 29 29 7 7 22 22 27 20 10 10 1 1 24 24 25 25 26 26 23 5 6 6 14 9 17 19 4 11 4 3 14 16 8 28 15 15 8 8 17 17 14 14 23 23 4 18 27 13 27 ...
output:
13 2 25 10 21 24 19 4 6 18 7 16 3 11 5 15 23 17 8 1 20 22 26 27 14 12 9 23 2 28 13 15 18 16 12 21 29 20 8 7 10 9 22 1 17 27 24 3 11 25 5 19 26 6 14 4 14 18 4 6 11 17 22 5 13 10 1 12 16 25 23 27 28 19 3 2 29 26 7 8 9 24 21 15 20 29 20 16 4 6 26 25 12 8 18 17 3 23 13 24 11 22 5 1 9 28 19 2 27 7 15 ...
result:
points 0.50 Partially Correct | type = 2
Test #52:
score: 12
Accepted
time: 12ms
memory: 57060kb
input:
5 27 151 1 27 26 26 17 4 8 10 16 22 12 12 9 3 23 23 15 15 11 11 20 20 24 19 25 14 21 21 17 17 1 1 24 13 2 7 16 6 16 16 5 5 25 25 9 9 24 24 8 8 2 2 18 30 212 2 16 30 30 22 22 28 28 14 14 2 2 15 19 4 4 29 17 9 9 5 7 12 11 1 13 25 18 26 26 27 24 5 5 21 8 20 20 25 25 29 29 23 10 12 6 15 15 23 23 12 12 2...
output:
24 6 14 7 3 10 18 16 21 5 23 19 13 25 27 15 22 2 26 11 12 4 17 20 9 8 1 23 24 6 17 8 9 16 5 20 21 30 11 13 1 22 3 25 18 28 26 19 14 27 4 2 10 29 15 7 12 5 9 18 24 26 14 7 22 13 21 30 17 16 12 4 1 25 28 27 15 6 2 8 29 23 3 11 20 19 10 18 26 11 1 9 21 27 14 15 23 6 16 17 10 3 7 8 12 19 2 25 24 5 4 ...
result:
ok Accepted.
Subtask #7:
score: 0
Skipped
Dependency #4:
0%
Subtask #8:
score: 0
Skipped
Dependency #7:
0%
Subtask #9:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
50%
Acceptable Answer
Dependency #3:
50%
Acceptable Answer
Dependency #4:
0%