Submission #650486

#TimeUsernameProblemLanguageResultExecution timeMemory
650486Koful123Xylophone (JOI18_xylophone)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include <xylophone.h> using namespace std; void solve(int n){ vector<int> v(n+1),th(n+1),se(n+1); for(int i=1;i<=n;i++){ se[i] = query(i-1,i); if(i != 1) th[i] = query(i-2,i); } for(int i=1;i<=n;i++){ int ok = 1; v[1] = i; for(int j=2;j<=n;j++){ if(th[i] == se[i-1]){ v[i] = v[i-1] + (v[i-2] > v[i-1] ? se[i] : -se[i]); } else{ if(v[i-2] > v[i-1]){ if(se[i] == th[i]) v[i] = v[i-1] + se[i]; else v[i] = v[i-1] - se[i]; } else{ if(th[i] == se[i]) v[i] = v[i-1] - se[i]; else v[i] = v[i-1] + se[i];; } } if(vis[v[i]]){ ok = 0; break; } } if(!ok) continue; for(int i=1;i<=n;i++){ answer(i,v[i]); } } }

Compilation message (stderr)

xylophone.cpp: In function 'void solve(int)':
xylophone.cpp:27:7: error: 'vis' was not declared in this scope
   27 |    if(vis[v[i]]){
      |       ^~~