QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#455014 | #7769. Axium Crisis | zqs | 75 | 5167ms | 91168kb | C++14 | 4.5kb | 2024-06-25 17:40:42 | 2024-06-25 17:40:43 |
Judging History
answer
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cassert>
using std::min;
const int N = 18 * 18 * 18 + 5, INF = 100000000;
struct Edge {int to, id, nxt, w;} e[37];
int LCP(bool *a, bool *b, int la, int lb) {
for (int i = 1; i <= min(la, lb); ++ i) if (a[i] != b[i]) return i - 1;
return min(la, lb);
}
struct node {
bool str[19]; int len, S, u, v;
inline bool operator < (const node &rhs) const {
for (int i = 1; i <= min(len, rhs.len); ++ i)
if (str[i] < rhs.str[i]) return true;
else if (str[i] > rhs.str[i]) return false;
return len < rhs.len;
}
} a[N];
int head[19], sta[19], f[19][1 << 17 | 1], lst[19][1 << 17 | 1], top, tot, m, nows;
int nf[19][1 << 17 | 1], nlst[19][1 << 17 | 1];
inline void ae(int u, int v, int w, int id) {
e[++ tot].to = v, e[tot].w = w, e[tot].id = id, e[tot].nxt = head[u], head[u] = tot;
}
int rtnow;
//
void dfs(int u, int fa) {
if (top) {
int pre = min(top, 2);
for (int S = 0; S < 1 << pre; ++ S) {
bool flg = true; ++ m;
for (int i = 1; i <= pre; ++ i) {
if (sta[i] != 2 && (S >> i - 1 & 1) != sta[i]) {flg = false; break;}
a[m].str[i] = S >> i - 1 & 1;
}
if (!flg) {-- m; continue;}
for (int i = pre + 1; i <= top; ++ i) a[m].str[i] = (sta[i] == 1);
assert(top);
a[m].len = top, a[m].S = nows, a[m].u = rtnow, a[m].v = u;
}
}
for (int i = head[u]; i; i = e[i].nxt) if (e[i].to != fa) {
int v = e[i].to; sta[++ top] = e[i].w, nows |= 1 << e[i].id;
dfs(v, u), -- top, nows ^= 1 << e[i].id;
}
}
int stk[50000005], pre[50000005], b[N], w[19], pthu[19], pthv[19], eg[19], cur;
bool find(int u, int tar, int fa) {
if (u == tar) return true;
bool flg = false;
for (int i = head[u]; i; i = e[i].nxt) if (e[i].to != fa) {
eg[++ cur] = e[i].id; bool tmp = find(e[i].to, tar, u);
if (tmp) {flg = true; break;}
else -- cur;
}
return flg;
}
int main() {
puts("1"); int _; scanf("%d%*d", &_);
while (_ --) {
memset(head, 0, sizeof head), tot = m = top = 0;
int n; scanf("%d", &n);
memset(w, 0, sizeof w);
for (int i = 0, u, v, W; i < n - 1; ++ i) {
scanf("%d%d%d", &u, &v, &W), ++ u, ++ v, ae(u, v, W, i), ae(v, u, W, i);
if (W == 1) w[i + 1] = 1;
}
for (int i = 1; i <= n; ++ i) rtnow = i, dfs(i, -1);
std::sort(a + 1, a + m + 1);
top = 0, b[0] = b[m] = 0;
for (int i = 1; i < m; ++ i)
b[i] = LCP(a[i].str, a[i + 1].str, a[i].len, a[i + 1].len);
for (int j = 0; j <= n; ++ j)
for (int S = 0; S < 1 << n - 1; ++ S) f[j][S] = -INF, lst[j][S] = 0;
f[0][0] = 0;
for (int i = 1; i <= m; ++ i) {
for (int j = 0; j <= b[i]; ++ j)
for (int S = 0; S < 1 << n - 1; ++ S) nf[j][S] = -INF, nlst[j][S] = 0;
for (int j = 0; j <= b[i - 1]; ++ j)
for (int S = 0; S < 1 << n - 1; ++ S) if (f[j][S] >= 0) {
int t = min(b[i], j);
if (nf[t][S] < f[j][S]) nf[t][S] = f[j][S], nlst[t][S] = lst[j][S];
if (!(S & a[i].S)) {
int S0 = S | a[i].S;
if (nf[b[i]][S0] < f[j][S] + a[i].len - j) {
nf[b[i]][S0] = f[j][S] + a[i].len - j;
nlst[b[i]][S0] = ++ top, stk[top] = i;
pre[top] = lst[j][S];
}
}
}
for (int j = 0; j <= b[i]; ++ j)
for (int S = 0; S < 1 << n - 1; ++ S)
f[j][S] = nf[j][S], lst[j][S] = nlst[j][S];
}
int ans = 0, mxi = 0, mxj = 0;
for (int i = 0; i <= n; ++ i)
for (int S = 0; S < 1 << n - 1; ++ S)
if (f[i][S] > ans) ans = f[mxi = i][mxj = S];
int now = lst[mxi][mxj], len = 0;
while (now) {
int i = stk[now];
cur = 0, find(a[i].u, a[i].v, -1);
for (int j = 1; j <= cur; ++ j) w[eg[j] + 1] = a[i].str[j];
pthu[++ len] = a[i].u, pthv[len] = a[i].v;
now = pre[now];
}
printf("%d\n%d\n", ans + 1, len);
for (int i = 1; i < n; ++ i) printf("%d ", w[i]);
puts("");
for (int i = 1; i <= len; ++ i) printf("%d %d\n", pthu[i] - 1, pthv[i] - 1);
}
return 0;
}
詳細信息
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 2ms
memory: 18032kb
input:
1000 0 4 0 2 0 2 3 0 2 1 0 4 3 2 1 0 2 1 1 2 2 4 0 2 2 0 1 0 3 0 0 4 1 2 1 3 2 0 2 0 1 4 0 2 0 0 3 0 2 1 0 4 0 2 1 0 3 1 0 1 1 4 3 1 0 2 1 2 3 0 2 4 3 1 1 3 0 1 2 3 0 4 1 0 0 2 0 2 2 3 2 4 1 2 0 3 0 0 2 3 2 3 2 1 0 0 2 1 4 3 0 1 1 2 1 2 3 0 4 2 1 0 3 0 1 1 0 1 4 3 2 1 3 1 1 0 1 1 4 1 2 1 1 3 0 3 0 1...
output:
1 3 1 0 0 0 3 0 4 2 1 1 0 2 3 1 0 4 2 1 0 0 2 3 1 0 4 2 1 0 1 1 0 3 2 4 1 0 0 0 3 1 3 1 1 1 1 3 2 4 1 0 0 1 0 2 4 2 1 1 0 1 0 3 2 4 1 0 1 1 3 1 4 2 0 0 1 3 1 0 3 3 1 0 1 0 1 4 1 1 1 0 1 0 4 1 0 1 1 3 2 4 1 1 1 1 2 0 4 1 1 0 1 2 0 4 2 1 0 0 3 0 3 1 4 1 0 1 0 2 1 4 1 0 1 1 3 0 3 1 0 ...
result:
ok Accepted. Good Job!
Test #2:
score: 10
Accepted
time: 0ms
memory: 20076kb
input:
1000 0 4 2 0 0 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 3 1 1 1 1 3 1 3 1 0 0 0 2 1 4 1 1 0 0 1 0 6 2 0 1 0 1 0 0 2 0 4 4 2 1 0 1 2 1 3 0 4 2 0 0 1 2 3 2 1 4 1 1 0 1 0 3 4 2 0 1 0 3 0 3 1 5 2 0 1 1 1 1 0 4 1 2 4 2 1 0 0 1 3 2 0 4 1 1 0 1 3 0 3 1 1 1 1 2 0 3 1...
result:
ok Accepted. Good Job!
Test #4:
score: 10
Accepted
time: 11ms
memory: 26172kb
input:
3000 3 3 0 1 0 1 2 0 4 2 1 1 0 2 0 0 3 1 6 3 4 1 1 4 0 1 5 1 2 1 1 3 0 0 4 0 2 1 1 2 0 1 3 1 4 0 3 1 2 0 1 1 2 0 6 1 2 0 0 3 0 2 5 0 0 2 1 4 2 0 4 2 0 0 2 1 1 3 1 1 4 1 0 1 1 2 0 3 0 1 4 1 3 0 2 1 1 0 2 0 4 1 3 0 2 1 0 1 0 0 4 3 1 0 2 3 0 0 1 1 4 1 0 0 2 0 0 3 0 0 4 2 1 1 1 0 1 2 3 0 4 3 0 1 1 0 0 2...
output:
1 3 1 0 0 2 0 4 1 1 0 1 3 1 6 2 1 0 1 1 0 2 5 0 1 4 1 1 0 1 3 0 4 1 1 1 0 3 1 5 2 0 0 0 1 0 2 3 1 5 4 1 0 1 1 3 0 4 1 1 0 1 3 2 4 2 0 1 0 2 3 2 0 3 1 0 0 0 3 2 4 1 0 0 1 0 2 3 1 0 0 0 2 1 4 1 1 1 0 0 3 4 2 1 0 0 3 1 3 2 6 1 1 0 0 1 0 3 1 4 1 0 1 1 3 1 4 2 0 1 0 1 3 2 1 4 1 0 0 1 2 ...
result:
ok Accepted. Good Job!
Subtask #3:
score: 10
Accepted
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Test #5:
score: 10
Accepted
time: 47ms
memory: 34664kb
input:
3000 4 4 2 0 0 1 2 0 1 3 0 4 1 2 2 0 2 2 3 2 2 4 3 1 2 3 2 0 0 2 0 4 0 3 2 2 1 2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4 1 1 0 1 3 0 6 2 1 1 0 1 1 1 4 5 3 6 1 1 0 1 0 1 1 4 4 2 1 0 1 3 1 2 0 4 1 0 1 1 3 0 6 2 1 0 0 1 1 4 3 4 1 3 1 0 0 0 3 0 3 ...
result:
ok Accepted. Good Job!
Subtask #4:
score: 10
Accepted
Dependency #2:
100%
Accepted
Test #7:
score: 10
Accepted
time: 213ms
memory: 43452kb
input:
3000 3 8 1 2 1 3 7 0 7 0 1 7 4 0 6 5 0 6 4 1 2 0 0 5 3 1 0 3 2 1 0 1 0 4 0 1 5 3 2 0 4 0 0 4 1 0 2 0 1 6 5 4 1 4 1 1 4 2 1 0 4 1 4 3 1 5 4 1 0 4 3 0 2 1 1 3 0 1 8 3 6 0 1 4 1 2 3 1 0 6 1 0 7 1 2 1 0 7 5 0 8 4 5 0 5 7 0 3 0 0 2 4 1 1 2 0 5 6 0 6 3 1 5 4 1 0 4 0 0 4 3 0 2 4 1 5 1 0 0 1 2 0 2 3 1 0 4 1...
output:
1 8 2 1 0 1 0 0 1 0 1 5 7 3 5 1 0 1 0 1 4 2 5 2 0 0 0 1 2 1 3 2 3 1 1 1 1 1 1 1 5 5 1 0 0 1 1 0 2 8 2 0 1 1 1 1 0 0 7 4 7 5 7 2 0 0 0 1 0 0 1 6 0 7 1 5 2 0 0 0 1 2 3 1 0 5 1 0 0 1 1 4 3 6 2 1 0 1 0 0 1 5 2 4 6 2 0 1 1 1 0 0 4 1 2 5 1 0 0 0 0 1 3 5 8 2 0 1 1 0 0 1 0 0 7 0 1 6 1 0 1 1 1 0...
result:
ok Accepted. Good Job!
Test #8:
score: 10
Accepted
time: 203ms
memory: 37176kb
input:
3000 3 6 3 1 1 1 4 0 1 0 1 1 2 0 5 1 0 6 0 3 1 2 4 1 1 5 1 1 4 0 4 0 0 6 2 5 0 1 5 1 3 4 0 4 0 0 3 2 1 8 2 5 0 6 7 0 0 3 0 6 0 1 1 4 0 7 5 1 3 4 1 11 7 6 1 3 5 1 2 7 1 7 10 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 0 0 0 4 2 8 2 0 0 0 0 1 1 0 6 5 0 1 8 2 0 0 1 0 0 0 0 2 7 3 5 6 1 1 1 0 0 0 5 3 6 1 1 0...
result:
ok Accepted. Good Job!
Test #10:
score: 10
Accepted
time: 293ms
memory: 45876kb
input:
3000 0 6 4 0 0 1 4 1 5 3 0 3 2 1 0 5 1 8 1 7 0 6 1 0 4 2 0 4 1 1 5 4 0 4 3 0 0 4 1 8 3 1 0 2 3 0 3 0 0 4 7 0 5 7 0 7 6 0 7 3 0 6 5 2 2 4 0 2 0 3 2 5 4 2 1 3 2 4 2 3 1 3 0 1 1 3 1 5 0 2 1 2 4 0 1 4 2 3 4 0 6 1 0 0 4 2 0 4 5 0 3 5 0 2 0 0 5 0 1 0 0 2 0 0 3 0 0 4 0 6 1 4 1 1 3 1 1 5 1 0 2 0 1 2 0 5 0 2...
output:
1 6 1 0 1 0 1 1 1 2 6 2 0 0 0 1 0 0 1 0 5 7 2 4 1 0 0 0 0 0 0 0 4 1 6 1 1 0 0 1 0 2 1 3 1 1 1 1 2 0 5 2 1 0 1 0 1 0 3 4 6 1 0 0 0 0 0 1 3 3 1 0 0 0 0 1 2 6 2 1 1 1 0 0 5 4 0 3 5 2 1 0 0 0 0 3 4 1 5 2 0 1 1 1 0 2 4 1 5 6 2 1 1 1 1 1 0 1 4 2 5 7 5 2 0 1 1 0 2 1 3 4 8 2 1 1 0 1 0 1 1 3 4 ...
result:
ok Accepted. Good Job!
Subtask #6:
score: 10
Accepted
Dependency #4:
100%
Accepted
Test #11:
score: 10
Accepted
time: 2192ms
memory: 61744kb
input:
3000 3 8 3 5 1 4 1 0 4 6 1 5 6 0 7 5 0 3 2 1 3 0 1 8 1 4 1 0 3 0 7 3 1 5 2 1 5 3 1 5 1 0 6 0 1 8 1 4 1 1 2 1 0 1 0 6 7 1 3 5 1 6 4 0 4 5 0 8 7 0 0 1 4 0 3 1 1 4 2 1 2 6 0 4 5 0 7 3 1 8 7 0 0 5 7 1 4 2 0 1 3 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0 0 1 0 0 ...
result:
ok Accepted. Good Job!
Subtask #7:
score: 5
Accepted
Test #13:
score: 5
Accepted
time: 5083ms
memory: 91168kb
input:
3000 1 11 2 5 0 10 2 0 6 2 0 2 8 0 0 2 0 2 1 0 2 4 0 2 9 0 2 3 0 7 2 0 11 7 8 0 6 4 0 1 6 0 2 8 0 8 0 0 6 3 0 9 5 0 5 8 0 1 2 0 9 10 0 8 1 4 0 2 3 0 6 5 0 6 7 0 2 4 0 7 3 0 1 0 0 8 4 0 0 0 5 0 7 2 0 0 2 0 0 6 0 0 1 0 0 3 0 11 5 1 0 7 2 0 9 2 0 4 9 0 0 2 0 8 5 0 0 6 0 3 6 0 4 10 0 1 7 0 7 6 2 0 0 5 0...
output:
1 3 1 0 0 0 0 0 0 0 0 0 0 5 10 8 1 0 0 0 0 0 0 0 0 0 0 10 4 8 1 0 0 0 0 0 0 0 0 5 4 1 0 0 0 0 0 0 0 7 4 8 1 0 0 0 0 0 0 0 0 0 0 8 3 7 1 0 0 0 0 0 0 3 1 5 1 0 0 0 0 4 0 7 1 0 0 0 0 0 0 2 4 11 1 0 0 0 0 0 0 0 0 0 0 7 5 4 1 0 0 0 0 0 0 0 4 7 8 1 0 0 0 0 0 0 0 5 6 4 1 0 0 0 0 0 0 0 0 0 0 4 3...
result:
ok Accepted. Good Job!
Subtask #8:
score: 0
Time Limit Exceeded
Test #14:
score: 0
Time Limit Exceeded
input:
3000 2 8 4 7 2 4 3 2 3 2 2 4 5 2 1 4 2 6 4 2 0 1 2 8 1 5 2 0 7 2 3 2 2 3 1 2 5 7 2 4 0 2 6 4 2 8 1 3 2 5 3 2 7 6 2 2 6 2 0 7 2 4 6 2 0 5 2 8 5 7 2 2 6 2 1 6 2 4 5 2 4 0 2 0 1 2 7 3 2 11 2 7 2 0 9 2 8 9 2 10 7 2 6 9 2 9 3 2 4 10 2 7 5 2 7 9 2 1 9 2 8 2 6 2 1 5 2 4 1 2 1 3 2 6 1 2 0 1 2 6 7 2 14 2 6 2...
output:
1 7 2 0 0 0 0 1 0 1 0 2 7 5 8 1 0 0 1 1 0 0 0 2 6 8 2 1 1 0 0 0 0 0 1 2 6 4 8 1 0 1 1 0 0 0 0 2 3 9 4 0 0 0 1 1 0 1 1 0 0 4 0 6 1 2 5 3 8 6 2 1 0 0 0 1 0 0 2 5 3 4 7 4 1 0 0 0 0 1 1 1 0 0 0 0 0 10 3 7 0 12 6 13 8 6 1 0 0 1 1 0 0 5 6 2 0 1 1 0 0 0 6 3 2 1 10 2 0 0 0 0 0 0 1 0 0 1 3 7 8 0 8 ...
result:
Subtask #9:
score: 10
Accepted
Dependency #6:
100%
Accepted
Dependency #7:
100%
Accepted
Test #17:
score: 10
Accepted
time: 4990ms
memory: 74856kb
input:
3000 3 8 1 2 0 4 6 1 2 4 1 3 4 1 4 0 0 5 6 0 4 7 1 8 6 0 0 2 6 1 5 4 1 0 4 1 2 3 0 7 1 1 5 1 0 17 8 7 0 15 7 0 5 7 1 4 5 1 2 5 1 16 5 1 10 16 0 14 5 1 6 2 0 3 5 1 12 7 0 14 0 0 3 1 0 9 5 1 13 5 1 16 11 0 14 4 3 0 2 10 1 12 1 0 9 7 0 6 13 0 5 11 0 8 12 1 6 3 1 4 1 1 0 10 0 2 8 0 7 5 1 0 11 1 8 7 6 0 ...
output:
1 7 2 0 1 1 1 0 0 1 3 0 1 5 8 2 0 1 1 1 0 1 0 5 3 5 7 10 4 0 0 1 1 1 1 0 1 0 1 0 0 0 1 1 0 4 8 5 10 6 0 12 15 14 2 0 1 0 0 0 0 1 1 1 0 0 1 1 7 13 9 7 7 2 0 0 1 0 0 1 0 7 4 2 1 7 2 1 1 1 1 1 1 0 7 0 6 3 8 2 1 1 1 0 1 1 0 2 0 3 5 7 3 1 1 1 0 0 1 1 5 0 1 2 7 6 8 4 1 0 1 0 0 1 0 0 0 1 2 6 3 9 4...
result:
ok Accepted. Good Job!
Test #18:
score: 10
Accepted
time: 5167ms
memory: 74800kb
input:
3000 3 8 2 7 0 3 4 0 1 0 0 7 5 1 2 3 1 6 5 0 0 4 1 11 10 5 1 2 5 1 5 9 0 5 0 0 4 1 0 3 5 0 5 1 1 6 5 0 7 5 0 8 1 1 8 3 4 1 1 3 1 7 3 0 5 3 0 5 2 0 6 0 0 0 2 1 7 2 5 1 1 3 1 1 5 0 0 6 1 0 2 0 6 4 0 7 0 3 0 2 6 1 0 4 1 5 1 1 4 6 0 1 3 1 11 1 4 0 9 4 0 10 4 1 4 2 0 7 4 0 7 6 1 4 5 0 8 4 1 4 0 0 4 3 1 6...
output:
1 8 2 0 0 0 1 1 0 1 0 6 1 0 8 4 1 1 0 0 0 0 1 0 0 1 8 7 2 6 0 10 9 3 8 2 1 1 0 0 0 0 1 4 1 7 6 7 1 1 1 0 1 0 0 3 4 7 1 0 1 1 1 0 1 5 2 8 4 0 0 1 0 0 1 0 1 0 1 8 3 6 2 1 10 9 5 6 2 0 1 1 1 0 0 5 4 2 7 2 1 0 0 0 0 0 1 4 5 0 1 11 2 0 1 0 1 0 1 1 0 0 1 2 0 2 5 7 3 1 0 0 0 1 0 0 6 1 4 0 3 5 7 2...
result:
ok Accepted. Good Job!
Subtask #10:
score: 0
Skipped
Dependency #5:
100%
Accepted
Dependency #8:
0%