#include <bits/stdc++.h>
#include "speedrun.h"
#define pii pair<int, int>
using namespace std;
const int NMAX = 1002;
vector<int> v[NMAX];
int n,l,t[NMAX],tour[NMAX],pos[NMAX],k;
int st[NMAX];
void euler(int nod, int tata = -1){
if(tata > 0){
t[nod] = tata;
}
if(!pos[nod]){
tour[++k] = nod;
pos[nod] = k;
}
for(int fiu: v[nod]){
if(fiu == tata){
continue;
}
euler(fiu, nod);
}
}
pii split(int x){
int mask = (1<<10)-1;
return {x&mask, x>>10};
}
void assignHints (int subtask , int N, int A[], int B[]){
n = N;
setHintLen(41);
for(int i = 1; i < N; i++){
v[A[i]].push_back(B[i]);
v[B[i]].push_back(A[i]);
}
euler(1);
for(int i = 1; i <= n; i++){
int val = t[i] + ((tour[pos[i]+1]) << 10);
pii aux = split(val);
for(int j = 0; j < 20; j++){
int bt = ((val>>j)&1);
//setHint(i, j, bt);
}
}
}
int getWholeHint(){
int ans = 0;
for(int i = 0; i < 20; i++){
ans += (1<<i)*getHint(i);
}
return ans;
}
void speedrun(int subtask , int N, int start){
n = N;
l = getLength();
while(start != 1){
int val = getWholeHint();
start = split(val).first;
goTo(start);
}
int vf = 0;
st[++vf] = 1;
int cnt = 1;
while(cnt != n){
int nxt = split(getWholeHint()).second;
while(!goTo(nxt)){
vf--;
goTo(st[vf]);
}
goTo(nxt);
st[++vf] = nxt;
cnt++;
}
}
Compilation message
speedrun.cpp: In function 'void assignHints(int, int, int*, int*)':
speedrun.cpp:44:17: warning: unused variable 'bt' [-Wunused-variable]
44 | int bt = ((val>>j)&1);
| ^~
speedrun.cpp:42:13: warning: variable 'aux' set but not used [-Wunused-but-set-variable]
42 | pii aux = split(val);
| ^~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
928 KB |
Invalid bit index for getHint |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
The length is too large |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
The length is too large |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
924 KB |
Invalid bit index for getHint |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
The length is too large |
2 |
Halted |
0 ms |
0 KB |
- |