Submission #499484

#TimeUsernameProblemLanguageResultExecution timeMemory
499484andrei_boacaSpeedrun (RMI21_speedrun)C++17
Compilation error
0 ms0 KiB
#include "speedrun.h" #include <bits/stdc++.h> //#include "grader.cpp" typedef pair<int,int> pii; vector<int> muchii[1005]; vector<int> st; int n,par[1005]; bool use[1005]; void dfs(int nod) { st.push_back(nod); use[nod]=1; for(auto i:muchii[nod]) if(!use[i]) { par[i]=nod; dfs(i); } } void assignHints(int subtask, int N, int A[], int B[]) { n=N; for(int i=1;i<n;i++) { muchii[A[i]].push_back(B[i]); muchii[B[i]].push_back(A[i]); } dfs(1); setHintLen(20); for(int i=0;i<st.size();i++) { int p=par[st[i]]; int nod=st[i]; int lg=0; for(int bit=9;bit>=0;bit--) { lg++; if((p>>bit)&1) setHint(nod,lg,1); else setHint(nod,lg,0); } int nxt=0; if(i+1<st.size()) nxt=st[i+1]; for(int bit=9;bit>=0;bit--) { lg++; if((nxt>>bit)&1) setHint(nod,lg,1); else setHint(nod,lg,0); } } } pii getvals() { int nxt=0,p=0; for(int i=1;i<=10;i++) p=p*2+getHint(i); for(int i=11;i<=20;i++) nxt=nxt*2+getHint(i); return {nxt,p}; } int nrused=0; void DFS(int nod) { if(use[nod]==0) { use[nod]=1; nrused++; } if(nrused==n) return; pii x=getvals(); int nxt,p; tie(nxt,p)=x; if(nxt==0) { goTo(p); DFS(p); } else if(!use[nxt]) { while(!goTo(nxt)) { goTo(p); pii x=getvals(); if(use[p]==0) { use[p]=1; nrused++; } if(nrused==n) return; p=x.second; } DFS(nxt); } else { goTo(p); DFS(p); } } void speedrun(int subtask, int N, int start) { n=N; for(int i=1;i<=n;i++) use[i]=0; DFS(start); }

Compilation message (stderr)

speedrun.cpp:5:9: error: 'pair' does not name a type
    5 | typedef pair<int,int> pii;
      |         ^~~~
speedrun.cpp:6:1: error: 'vector' does not name a type
    6 | vector<int> muchii[1005];
      | ^~~~~~
speedrun.cpp:7:1: error: 'vector' does not name a type
    7 | vector<int> st;
      | ^~~~~~
speedrun.cpp: In function 'void dfs(int)':
speedrun.cpp:12:5: error: 'st' was not declared in this scope; did you mean 'std'?
   12 |     st.push_back(nod);
      |     ^~
      |     std
speedrun.cpp:14:16: error: 'muchii' was not declared in this scope
   14 |     for(auto i:muchii[nod])
      |                ^~~~~~
speedrun.cpp: In function 'void assignHints(int, int, int*, int*)':
speedrun.cpp:25:9: error: 'muchii' was not declared in this scope
   25 |         muchii[A[i]].push_back(B[i]);
      |         ^~~~~~
speedrun.cpp:30:19: error: 'st' was not declared in this scope; did you mean 'std'?
   30 |     for(int i=0;i<st.size();i++)
      |                   ^~
      |                   std
speedrun.cpp: At global scope:
speedrun.cpp:56:1: error: 'pii' does not name a type
   56 | pii getvals()
      | ^~~
speedrun.cpp: In function 'void DFS(int)':
speedrun.cpp:75:5: error: 'pii' was not declared in this scope
   75 |     pii x=getvals();
      |     ^~~
speedrun.cpp:77:5: error: 'tie' was not declared in this scope; did you mean 'std::tie'?
   77 |     tie(nxt,p)=x;
      |     ^~~
      |     std::tie
In file included from /usr/include/c++/10/functional:54,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from speedrun.cpp:2:
/usr/include/c++/10/tuple:1615:5: note: 'std::tie' declared here
 1615 |     tie(_Elements&... __args) noexcept
      |     ^~~
speedrun.cpp:77:16: error: 'x' was not declared in this scope
   77 |     tie(nxt,p)=x;
      |                ^
speedrun.cpp:88:16: error: expected ';' before 'x'
   88 |             pii x=getvals();
      |                ^~
      |                ;