#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;
}
}
rep(x,1,n+1) cout<<nxt[x]<<" "; cout<<endl;
}
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);
}
}
Compilation message
speedrun.cpp: In function 'void assignHints(int, int, int*, int*)':
speedrun.cpp:20:20: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
20 | #define rep(x,s,e) for (auto x=(s)-((s)>(e));x!=(e)-((s)>(e));(s)<(e)?x++:x--)
| ^~~
speedrun.cpp:68:2: note: in expansion of macro 'rep'
68 | rep(x,1,n+1) cout<<nxt[x]<<" "; cout<<endl;
| ^~~
speedrun.cpp:68:34: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
68 | rep(x,1,n+1) cout<<nxt[x]<<" "; cout<<endl;
| ^~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
169 ms |
336 KB |
assignHints must not call getHint, getLength or goTo |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
128 ms |
336 KB |
assignHints must not call getHint, getLength or goTo |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
137 ms |
416 KB |
assignHints must not call getHint, getLength or goTo |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
158 ms |
460 KB |
assignHints must not call getHint, getLength or goTo |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
173 ms |
336 KB |
assignHints must not call getHint, getLength or goTo |
2 |
Halted |
0 ms |
0 KB |
- |