Submission #764881

#TimeUsernameProblemLanguageResultExecution timeMemory
764881vjudge1Speedrun (RMI21_speedrun)C++17
0 / 100
1 ms592 KiB
#include <bits/stdc++.h> #include "speedrun.h" using namespace std; const int MAXN=1e3+5; vector<vector<int> > g(MAXN); void assignHints(int subtask, int N, int A[], int B[]) { for(int i=1; i<=N; i++) { g[A[i]].push_back(B[i]); g[B[i]].push_back(A[i]); } if(subtask==3) { for(int i=1; i<=N; i++)g[i].clear(); setHintLen(20); vector<int> us(N+1, 0), pr(N+1, 0); queue<int> q; q.push(1); us[1]=1; while(!q.empty()) { int v=q.front(); q.pop(); for(int j=1; j<=10; j++) { setHint(v, j, (pr[v] & (1<<(j-1) ) ? 1 : 0) ); } int cnt=0; for(auto to : g[v]) { if(!us[to]) { pr[to]=v; q.push(to); cnt++; if(cnt==2) { for(int j=11; j<=20; j++) { setHint(v, j, (to&(1<<(j-11)) ? 1 : 0)); } }else { for(int j=1; j<=10; j++) { setHint(v, j, (to & (1<<(j-1) ) ? 1 : 0) ); } } us[to]=1; } } } } } int Us[MAXN]; void dfs(int v, int p) { Us[v]=1; int x=0, y=0; for(int j=1; j<=10; j++) { if(getHint(j))x+=(1<<(j-1)); } for(int j=11; j<=20; j++) { if(getHint(j))y+=(1<<(j-11)); } if(x>0 && !Us[x]) { bool ok=goTo(x); if(ok)dfs(x, v); else { exit(0); } } if(y>0 && !Us[y]) { bool ok=goTo(y); if(ok)dfs(y, v); else { exit(0); } } if(p!=v)goTo(p); else return; } void speedrun(int subtask, int N, int start) { if(subtask==3) { for(int i=1; i<=N; i++)Us[i]=0; int l=getLength(); dfs(start, start); } }

Compilation message (stderr)

speedrun.cpp: In function 'void speedrun(int, int, int)':
speedrun.cpp:75:7: warning: unused variable 'l' [-Wunused-variable]
   75 |   int l=getLength();
      |       ^
#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...