제출 #645501

#제출 시각아이디문제언어결과실행 시간메모리
645501TimDeeSpeedrun (RMI21_speedrun)C++17
0 / 100
95 ms8548 KiB
#include "speedrun.h" #include <bits/stdc++.h> using namespace std; void assignHints(int id,int n, int*a, int*b) { if (id==1) { setHintLen(n); for(int i=0;i<n-1;++i) { int u=a[i],v=b[i]; setHint(u,v,1); setHint(v,u,1); } } if (id==2) { setHintLen(20); vector<int>deg(n+1,0); for(int i=0;i<n-1;++i) deg[a[i]]++; for(int i=0;i<n-1;++i) deg[b[i]]++; int mx=0; for(int i=1;i<=n;++i) if (deg[i]>deg[mx]) mx=i; for (int i=1; i<=n; ++i) { if (i==mx) continue; for (int j=11; j>0; --j) { setHint(i,j,!!(mx&(1<<(j-1)))); } } } } int n; vector<vector<int>> adj(1e3+1,vector<int>(1e3+1,0)); void dfs(int u, int p) { for (int j=1; j<=n; ++j) { adj[u][j]=getHint(j); } for (int i=1; i<=n; ++i) { if (i==p) continue; if (adj[u][i]) { goTo(i); dfs(i,u); } } if (p==-1) return; goTo(p); } void speedrun(int id,int N,int start) { n=N; if (id==1) { dfs(start,-1); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...