QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#786962 | #2810. Speedrun | Bula | Compile Error | / | / | C++23 | 1.4kb | 2024-11-27 04:11:24 | 2024-11-27 04:11:24 |
Judging History
speedrun
#include "speedrun.h"
#include<bits/stdc++.h>
using namespace std;
const int Nx = 1e3 + 5;
vector<int> adj[Nx], par(N), ord;
void dfs(int v, int p){
par[v] = p;
ord.push_back(v);
for(auto x : adj[v]){
if(x == p) continue;
dfs(x, v);
}
}
void assignHints(int subtask, int n, int A[], int B[]){
for(int i = 1; i <= n - 1; i++){
adj[A[i]].push_back(B[i]);
adj[B[i]].push_back(A[i]);
}
setHintLen(20);
dfs(1, 0);
for(int i = 1; i <= n; i++){
for(int j = 0; j < 10; j++){
if(par[i] & (1 << j)) setHint(i, j + 1, 1);
}
}
for(int i = 1; i < ord.size(); i++){
for(int j = 0; j < 10; j++){
if(ord[i] & (1 << j)) setHint(ord[i - 1], j + 11, 1);
}
}
}
void speedrun(int subtask, int n, int start){
int cur = start, targ = 0;
set<int> st;
while(st.size() < n){
st.insert(cur);
int p = 0, nxt = 0;
for(int j = 1; j <= 10; j++){
p += getHint(j) * (1 << (j - 1));
nxt += getHint(j + 10) * (1 << (j - 1));
}
if(nxt > 0 && st.find(nxt) == st.end() && goTo(nxt)){
cur = nxt;
}else if(targ > 0 && goTo(targ)){
cur = targ;
targ = 0;
}
else{
goTo(p);
cur = p;
targ = nxt;
}
}
}
详细
speedrun.code:5:26: error: ‘N’ was not declared in this scope; did you mean ‘Nx’? 5 | vector<int> adj[Nx], par(N), ord; | ^ | Nx speedrun.code: In function ‘void dfs(int, int)’: speedrun.code:9:14: error: ‘x’ does not name a type 9 | for(auto x : adj[v]){ | ^ speedrun.code:12:6: error: expected ‘;’ before ‘}’ token 12 | } | ^ | ; 13 | } | ~ speedrun.code:13:1: error: expected primary-expression before ‘}’ token 13 | } | ^ speedrun.code:12:6: error: expected ‘;’ before ‘}’ token 12 | } | ^ | ; 13 | } | ~ speedrun.code:13:1: error: expected primary-expression before ‘}’ token 13 | } | ^ speedrun.code:12:6: error: expected ‘)’ before ‘}’ token 12 | } | ^ | ) 13 | } | ~ speedrun.code:9:8: note: to match this ‘(’ 9 | for(auto x : adj[v]){ | ^ speedrun.code:13:1: error: expected primary-expression before ‘}’ token 13 | } | ^ grader_speedrun.cpp: In function ‘int readvalue()’: grader_speedrun.cpp:9:9: warning: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 9 | fscanf(input, "%d", &val); | ~~~~~~^~~~~~~~~~~~~~~~~~~