#include "speedrun.h"
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ii pair<ll,ll>
#define fi first
#define se second
#define endl '\n'
#define puf push_front
#define pof pop_front
#define pub push_back
#define pob pop_back
#define lb lower_bound
#define ub upper_bound
#define rep(x,s,e) for (auto x=(s)-((s)>(e));x!=(e)-((s)>(e));(s)<(e)?x++:x--)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int) (x).size()
mt19937 rng(chrono::system_clock::now().time_since_epoch().count());
int n;
vector<int> al[1005];
int nxt[1005];
int pp=0;
void dfs(int i,int p){
int temp=p;
rep(x,0,10){
setHint(i,10+x+1,temp&1);
temp>>=1;
}
nxt[pp]=i;
pp=i;
for (auto it:al[i]){
if (it==p) continue;
dfs(it,i);
}
}
void assignHints(signed subtask, signed N, signed A[], signed B[]) {
n=N;
rep(x,1,n){
al[A[x]].pub(B[x]);
al[B[x]].pub(A[x]);
}
setHintLen(20);
dfs(1,0);
rep(x,1,n+1){
int temp=nxt[x];
rep(y,0,10){
setHint(x,y+1,temp&1);
temp>>=1;
}
}
}
int getP(){
int res=0;
rep(x,20,10) res=res<<1|getHint(x+1);
return res;
}
int getN(){
int res=0;
rep(x,10,0) res=res<<1|getHint(x+1);
return res;
}
void speedrun(signed subtask, signed N, signed curr) {
while (curr!=1){
int temp=getP();
goTo(temp);
curr=temp;
}
vector<int> stk={curr};
rep(x,1,n){
int temp=getN();
while (!goTo(temp)){
stk.pob();
goTo(stk.back());
}
stk.pub(temp);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
120 ms |
760 KB |
Solution didn't visit every node |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
71 ms |
672 KB |
Solution didn't visit every node |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
171 ms |
892 KB |
Solution didn't visit every node |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
157 ms |
740 KB |
Solution didn't visit every node |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
165 ms |
712 KB |
Solution didn't visit every node |
2 |
Halted |
0 ms |
0 KB |
- |