QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#306106 | #7769. Axium Crisis | C1942huangjiaxu | 100 ✓ | 4954ms | 162348kb | C++14 | 2.5kb | 2024-01-16 12:56:28 | 2024-01-16 12:56:28 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int M=1.2e7+5;
typedef unsigned char uc;
int T,o,n,u[18],v[18],w[18],ca,tp,fr[18][18],dis[18][18];
vector<int>e[18];
struct node{
int W,S,x,y;
}a[M];
int d[M],h[M],T1[M],T2[M];
int p[M<<1];
uc dp[18][1<<17],va[M<<1];
bool cmp(node a,node b){
return a.W==b.W?dis[a.x][a.y]<dis[b.x][b.y]:a.W<b.W;
}
void dfs(int x,int y,int S,int W){
if(S)a[ca++]={W,S,y,x};
for(auto z:e[x])if(!(S>>z&1)){
int t=u[z]^v[z]^x;
dis[y][t]=dis[y][x]+1,fr[y][t]=z;
if(w[z]<2)dfs(t,y,S|1<<z,W|w[z]<<(n-1-dis[y][t]));
else dfs(t,y,S|1<<z,W),dfs(t,y,S|1<<z,W|1<<(n-1-dis[y][t]));
}
}
inline void chg(int i,int j,int k){
if(dp[i][j]!=k){
p[tp]=(i<<n-1)|j,va[tp]=dp[i][j];
dp[i][j]=k,++tp;
}
}
inline void revoke(int t){
while(tp>t)--tp,dp[p[tp]>>n-1][p[tp]&((1<<n-1)-1)]=va[tp];
}
void solve(){
scanf("%d",&n),ca=0;
for(int i=0;i<n;++i)e[i].clear();
for(int i=0;i<n-1;++i){
scanf("%d%d%d",&u[i],&v[i],&w[i]);
e[u[i]].push_back(i);
e[v[i]].push_back(i);
}
for(int i=0;i<n;++i)fr[i][i]=-1,dfs(i,i,0,0);
sort(a,a+ca,cmp);
for(int i=0;i<ca;++i)d[i]=dis[a[i].x][a[i].y];
for(int i=1;i<ca;++i){
h[i]=min(d[i],d[i-1]);
if(a[i].W!=a[i-1].W)h[i]=min(h[i],n-(33-__builtin_clz(a[i-1].W^a[i].W)));
}
for(int i=0;i<n;++i)for(int j=0;j<1<<n-1;++j)dp[i][j]=!i;
for(int i=0;i<ca;++i){
T1[i]=tp;
for(int j=i-1,D=d[j];~j&&D>h[i];D=min(D,h[j--])){
for(int k=a[j].S;k<1<<n-1;k=(k+1)|a[j].S)if(dp[D][k]){
if(dp[D][k]>dp[h[i]][k])chg(h[i],k,dp[D][k]);
chg(D,k,0);
}
}
T2[i]=tp;
for(int k=a[i].S;k<1<<n-1;k=(k+1)|a[i].S){
int w=dp[d[i]][k];
for(int D=h[i];~D;--D)w=max(w,dp[D][k^a[i].S]+d[i]-D);
chg(d[i],k,w);
}
}
int D=0,ans=0,S=(1<<n-1)-1;
for(int i=0;i<=d[ca-1];++i)if(dp[i][(1<<n-1)-1]>ans)ans=dp[i][(1<<n-1)-1],D=i;
printf("%d\n",ans);
vector<int>tmp;
for(int i=ca-1;~i;--i){
revoke(T2[i]);
if((S|a[i].S)==S&&D==d[i]){
for(int j=h[i];~j;--j)if(dp[j][S^a[i].S]+d[i]-j==ans){
D=j,S^=a[i].S,ans-=d[i]-j;
tmp.push_back(i);
break;
}
}
revoke(T1[i]);
while(dp[D][S]!=ans)++D;
}
for(auto z:tmp){
int x=a[z].x,y=a[z].y;
while(~fr[x][y]){
w[fr[x][y]]=a[z].W>>(n-1-dis[x][y])&1;
y^=u[fr[x][y]]^v[fr[x][y]];
}
}
printf("%d\n",tmp.size());
for(int i=0;i<n-1;++i)printf("%d%c",w[i]," \n"[i==n-2]);
for(auto z:tmp)printf("%d %d\n",a[z].x,a[z].y);
}
int main(){
scanf("%d%d",&T,&o);
puts("1");
while(T--)solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 2ms
memory: 18100kb
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 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 0 1 3 0 2 1 4 2 0 1 1 3 0 0 1 4 1 0 0 0 0 3 4 1 0 0 0 2 1 4 2 0 0 1 3 2 1 0 4 1 0 1 0 0 2 3 2 0 0 0 2 1 3 0 4 1 0 1 0 3 2 4 1 0 0 0 3 1 4 2 0 0 1 1 2 ...
result:
ok Accepted. Good Job!
Subtask #2:
score: 10
Accepted
Test #3:
score: 10
Accepted
time: 10ms
memory: 20176kb
input:
3000 3 4 0 1 1 0 3 1 0 2 0 4 3 2 0 0 1 1 1 2 0 4 1 0 0 2 3 1 3 1 0 4 2 1 0 2 0 1 3 0 0 4 2 3 1 3 0 1 2 1 0 4 2 3 1 2 1 1 2 0 1 4 0 2 0 1 0 0 3 0 0 4 3 1 1 0 2 0 2 3 0 6 4 0 0 3 1 1 2 3 0 0 5 1 1 5 0 4 2 3 1 3 0 0 3 1 1 4 0 3 0 1 2 0 0 2 1 4 0 2 1 3 1 0 2 1 1 4 2 0 0 2 3 1 1 3 0 6 3 1 0 3 4 1 4 0 1 2...
output:
1 4 2 1 1 0 3 0 2 1 4 1 0 1 0 3 0 4 1 0 1 0 0 2 4 1 0 1 0 3 1 4 1 1 1 0 1 0 3 2 1 1 1 3 0 2 1 3 2 0 0 0 3 1 2 0 4 1 1 0 0 0 1 6 1 0 1 0 1 0 2 4 4 2 1 0 1 3 1 0 2 4 1 0 0 1 3 1 4 1 1 0 1 3 0 4 1 0 1 0 1 0 5 3 0 1 1 1 1 0 4 1 5 1 2 4 2 1 0 0 1 0 3 2 4 2 1 0 1 3 1 1 0 3 2 1 1 1 3 0 2 1 3 1 0 1 0 2 4 2 ...
result:
ok Accepted. Good Job!
Test #4:
score: 10
Accepted
time: 4ms
memory: 18404kb
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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0 1 0 0 1 2 0 4 3 1 5 6 1 0 0 0 0 0 1 2 4 1 0 0 0 0 2 6 1 0 0 0 0 0 1 5 4 1 0 0 0 3 0 4 1 0 0 0 0 1 4 2 0 0 0 0 0 0 5 1 2 4 2 0 1 0 3 0 1 2 4 ...
result:
ok Accepted. Good Job!
Test #6:
score: 10
Accepted
time: 14ms
memory: 18432kb
input:
3000 0 6 1 3 2 0 4 0 1 4 2 3 5 1 0 2 0 6 0 5 0 0 4 1 0 2 0 3 0 0 1 0 0 6 4 1 2 2 1 1 5 0 2 5 3 1 2 3 0 4 2 0 0 1 0 2 1 3 0 4 2 3 1 0 1 1 2 1 0 4 0 3 1 1 0 2 2 3 0 4 1 3 1 2 3 0 0 1 2 6 1 0 1 4 1 1 5 1 1 3 1 1 2 1 2 4 0 3 1 1 3 2 1 2 1 4 1 2 1 0 2 0 3 1 1 6 0 2 1 1 2 1 0 5 0 2 4 1 2 3 1 6 3 2 1 0 2 0...
output:
1 6 1 0 0 0 1 0 2 5 5 3 0 1 0 0 0 4 1 2 5 3 0 6 1 0 1 0 1 0 0 4 4 1 0 0 0 3 2 4 2 1 1 0 3 2 2 0 4 1 1 0 0 2 1 4 1 1 0 0 0 2 5 3 1 1 1 1 0 0 4 1 5 2 3 4 2 1 0 1 2 1 1 0 4 1 1 0 1 0 3 6 2 1 1 0 1 1 1 3 5 4 6 2 1 0 1 0 1 0 4 0 1 4 2 1 0 1 3 2 0 1 4 1 0 0 0 0 3 6 1 1 0 0 1 1 1 3 3 2 0 0 0 3 1 2 0 3 2 0 ...
result:
ok Accepted. Good Job!
Subtask #4:
score: 10
Accepted
Dependency #2:
100%
Accepted
Test #7:
score: 10
Accepted
time: 51ms
memory: 20328kb
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 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 2 5 6 1 1 1 0 1 0 0 5 6 1 0 1 1 0 0 0 3 6 1 0 0 1 0 1 0 2 5 2 0 0 0 1 0 5 4 1 0 6 1 1 1 0 1 0 4...
result:
ok Accepted. Good Job!
Subtask #5:
score: 10
Accepted
Dependency #3:
100%
Accepted
Dependency #4:
100%
Accepted
Test #9:
score: 10
Accepted
time: 126ms
memory: 20452kb
input:
3000 4 6 2 5 2 3 4 0 2 1 0 0 1 0 0 3 2 6 2 0 2 1 4 0 5 3 0 0 4 2 0 3 0 8 4 6 2 2 5 2 1 0 2 5 0 2 1 4 2 4 7 2 3 7 2 6 0 4 0 5 2 0 2 1 0 1 0 2 5 3 2 8 5 6 2 6 3 2 6 7 2 7 4 2 2 6 2 1 4 2 0 4 2 6 1 5 0 2 1 0 3 1 0 5 0 0 2 4 0 6 5 1 2 0 5 0 2 4 2 2 5 0 4 3 0 8 7 6 0 6 1 0 2 0 0 7 3 0 3 2 0 4 0 0 5 1 0 6...
output:
1 6 1 0 0 0 0 0 5 4 6 2 1 0 0 0 0 2 0 1 5 8 2 1 0 0 0 0 0 0 6 4 3 2 6 1 0 0 0 0 0 3 4 7 3 0 0 0 0 1 1 0 1 4 5 2 3 0 5 2 0 0 0 0 0 4 0 1 3 6 2 1 0 0 0 0 5 1 3 0 8 1 0 0 0 0 0 0 0 4 5 6 1 0 0 0 0 0 2 5 5 2 0 0 0 0 0 4 2 5 0 8 2 0 1 0 0 0 0 0 0 1 5 6 8 2 0 0 1 0 0 0 0 2 3 7 5 6 1 0 0 0 0 0 5 3 6 1 0 0 ...
result:
ok Accepted. Good Job!
Test #10:
score: 10
Accepted
time: 77ms
memory: 20360kb
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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1 1 1 0 0 2 1 0 7 3 4 4 1 0 1 0 2 0 7 3 1 1 1 0 0 1 1 0 4 1 5 6 3 7 2 0 1 1 0 1 1 3 6 1 5 5 4 0 0 1 0 ...
result:
ok Accepted. Good Job!
Test #12:
score: 10
Accepted
time: 230ms
memory: 29308kb
input:
3000 3 8 4 5 1 6 4 0 3 7 1 1 6 1 0 2 1 5 7 0 1 2 0 8 6 1 1 1 4 0 6 7 0 6 0 1 2 1 1 6 3 0 5 0 1 8 1 0 0 7 3 0 1 4 0 2 1 0 6 5 0 3 4 1 5 2 1 8 0 4 1 5 2 1 3 0 0 7 0 1 0 2 0 0 1 1 6 3 1 7 3 6 1 1 0 0 0 4 1 5 2 1 5 4 0 5 6 0 8 0 1 1 7 4 0 1 2 1 0 6 0 4 5 0 6 3 1 1 4 1 11 1 3 0 3 0 0 3 5 1 8 3 0 9 8 1 3 ...
output:
1 8 2 1 0 1 1 1 0 0 3 7 7 0 7 3 1 0 0 1 1 0 1 2 1 4 5 3 7 7 2 0 0 0 0 0 1 1 1 7 0 6 7 3 1 1 0 1 0 1 1 7 1 4 6 0 5 7 2 1 0 1 1 0 0 2 5 1 3 7 3 1 0 1 0 0 1 1 1 2 5 3 7 4 8 5 0 0 1 0 1 0 0 1 1 0 5 7 9 10 2 4 1 6 0 3 8 2 0 1 0 0 1 0 0 1 6 0 7 8 1 0 1 1 1 1 0 0 7 6 7 3 0 0 0 0 1 0 1 4 2 7 1 6 0 7 1 1 0 0...
result:
ok Accepted. Good Job!
Subtask #7:
score: 5
Accepted
Test #13:
score: 5
Accepted
time: 317ms
memory: 20664kb
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 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3 1 0 0 1 0 0 2 4 0 3 1 6 10 3 0 0 0 0 1 0...
result:
ok Accepted. Good Job!
Test #15:
score: 15
Accepted
time: 4954ms
memory: 162348kb
input:
3000 2 8 0 5 2 2 6 2 2 3 2 4 3 2 1 5 2 1 6 2 7 4 2 8 2 3 2 1 5 2 6 7 2 1 4 2 6 0 2 2 5 2 3 7 2 7 4 3 2 0 6 2 6 1 2 2 4 2 4 5 2 5 6 2 6 2 0 2 1 2 2 2 4 2 4 3 2 2 5 2 7 6 4 2 1 4 2 5 4 2 3 6 2 0 2 2 4 2 2 8 3 4 2 6 3 2 2 3 2 5 3 2 0 7 2 3 0 2 1 3 2 8 1 5 2 1 2 2 2 4 2 1 6 2 0 1 2 7 1 2 3 2 2 8 7 5 2 7...
output:
1 8 1 0 0 0 0 0 0 0 7 0 8 1 0 0 0 0 0 0 0 0 4 6 3 0 0 1 1 0 0 6 1 2 4 3 0 6 2 0 1 0 0 0 1 5 0 3 7 2 0 0 1 0 0 0 5 1 3 0 7 3 1 0 0 0 0 0 1 4 5 6 1 7 2 6 4 0 0 0 1 0 1 1 3 2 7 1 5 6 0 4 8 2 0 0 0 0 0 0 1 6 7 3 0 11 1 0 0 0 0 0 0 0 0 0 0 9 5 8 2 1 0 0 0 0 0 0 2 6 3 7 8 2 0 0 0 0 1 0 0 4 6 2 7 8 2 0 0 1...
result:
ok Accepted. Good Job!
Test #16:
score: 15
Accepted
time: 4880ms
memory: 96552kb
input:
3000 2 8 7 2 2 5 2 2 4 2 2 0 2 2 6 2 2 1 2 2 3 2 2 8 6 4 2 4 7 2 0 4 2 3 2 2 3 4 2 5 3 2 5 1 2 8 0 1 2 4 0 2 3 2 2 6 7 2 6 2 2 5 3 2 7 1 2 10 3 1 2 8 3 2 7 3 2 4 3 2 2 3 2 9 3 2 0 3 2 6 3 2 3 5 2 7 2 5 2 3 2 2 5 0 2 2 1 2 6 2 2 4 2 2 8 2 7 2 2 6 2 2 5 2 2 4 2 0 2 2 2 3 2 2 1 2 7 5 2 2 1 5 2 4 2 2 3 ...
output:
1 6 4 1 1 0 0 0 1 0 7 4 2 5 0 1 6 3 7 3 0 1 0 1 0 0 0 3 2 0 7 6 1 8 1 0 0 0 0 0 0 0 4 5 7 5 0 1 1 0 0 0 1 1 1 7 0 6 2 5 3 4 8 1 9 6 3 0 1 0 0 1 0 3 2 1 6 0 4 6 4 1 1 0 0 0 1 0 7 5 2 6 0 3 1 4 7 1 0 0 0 0 0 0 1 0 6 3 1 0 1 0 0 0 4 1 0 6 5 3 8 1 0 0 0 0 0 0 0 3 2 7 1 0 0 0 0 0 0 5 3 8 2 0 0 0 0 1 0 0 ...
result:
ok Accepted. Good Job!
Subtask #9:
score: 10
Accepted
Dependency #6:
100%
Accepted
Dependency #7:
100%
Accepted
Test #17:
score: 10
Accepted
time: 525ms
memory: 34964kb
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 3 0 1 1 1 0 0 1 3 0 7 4 1 5 8 1 0 1 1 1 0 1 0 3 7 10 7 0 0 1 1 1 1 0 1 0 1 0 0 0 1 1 0 9 1 4 15 5 0 5 13 6 10 12 8 16 11 14 1 0 1 0 0 0 0 1 1 1 0 0 1 1 9 13 7 3 0 0 1 0 0 1 0 7 5 2 1 4 0 7 3 1 1 1 1 1 1 0 7 2 4 3 6 0 8 2 1 1 1 0 1 1 0 2 5 3 0 7 3 1 1 1 0 0 1 1 5 0 2 6 7 1 8 5 1 0 1 0 0 1 0 0 0 1...
result:
ok Accepted. Good Job!
Test #18:
score: 10
Accepted
time: 456ms
memory: 33216kb
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 1 0 0 0 1 1 0 1 1 6 8 5 1 1 0 0 0 0 1 0 0 1 8 9 2 0 3 10 6 7 4 1 8 2 1 1 0 0 0 0 1 1 7 6 4 7 1 1 1 0 1 0 0 4 3 7 2 0 1 1 1 0 1 6 2 6 5 8 5 0 0 1 0 0 1 0 1 0 1 10 3 6 5 1 8 0 9 2 4 6 2 0 1 1 1 0 0 2 4 5 7 3 1 0 0 0 0 0 1 4 1 0 5 2 3 11 1 0 1 0 1 0 1 1 0 0 1 0 5 7 3 1 0 0 0 1 0 0 6 4 0 1 3 5 7 2 1...
result:
ok Accepted. Good Job!
Subtask #10:
score: 10
Accepted
Dependency #5:
100%
Accepted
Dependency #8:
100%
Accepted
Dependency #9:
100%
Accepted
Test #19:
score: 10
Accepted
time: 1193ms
memory: 86700kb
input:
3000 0 8 3 2 0 0 2 1 4 1 1 5 4 0 3 6 1 7 5 1 6 1 0 8 3 1 2 4 5 0 1 6 2 5 0 0 3 2 0 7 5 2 2 4 0 8 4 7 1 5 3 0 4 0 1 6 5 1 3 1 2 2 4 1 3 4 2 11 3 2 0 8 2 0 1 5 2 0 8 2 3 9 2 0 7 2 4 3 0 6 9 2 6 5 0 10 9 2 11 10 1 2 8 4 2 8 7 2 0 4 2 8 6 2 3 9 2 2 9 2 2 1 2 0 3 2 5 8 2 7 3 5 0 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