Submission #933574

#TimeUsernameProblemLanguageResultExecution timeMemory
933574vjudge1Speedrun (RMI21_speedrun)C++17
Compilation error
0 ms0 KiB
#define F first #define S second #define PB push_back using namespace std; typedef long long ll; typedef pair<int, int> ii; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<ii> vii; typedef vector<pair<int, ii>> viii; typedef vector<vii> vvii; typedef vector<ll> vll; typedef vector<vll> vvll; vvi al; int par; int findPar(int n){ int ans=1; for(int i=1;i<=n;i++) if(al[i].size()>1) ans=i; return ans; } void assignHints(int subtasks, int n, int a[], int b[]){ al.resize(n+1, vi()); for(int i=1;i<n;i++){ al[a[i]].PB(b[i]); al[b[i]].PB(a[i]); } par=findPar(n); setHintLen(1); } void speedRun(int subtasks, int n, int start){ bool vis[n+1]; memset(vis, false, n+1); vis[start]=true; if(start!=par){ goTo(par); vis[par]=true; } for(int i=1;i<=n;i++){ if(!vis[i]){ vis[i]=true; goTo(i); goTo(par); } } }

Compilation message (stderr)

speedrun.cpp:7:9: error: 'pair' does not name a type
    7 | typedef pair<int, int> ii;
      |         ^~~~
speedrun.cpp:8:9: error: 'vector' does not name a type
    8 | typedef vector<int> vi;
      |         ^~~~~~
speedrun.cpp:9:9: error: 'vector' does not name a type
    9 | typedef vector<vi> vvi;
      |         ^~~~~~
speedrun.cpp:10:9: error: 'vector' does not name a type
   10 | typedef vector<ii> vii;
      |         ^~~~~~
speedrun.cpp:11:9: error: 'vector' does not name a type
   11 | typedef vector<pair<int, ii>> viii;
      |         ^~~~~~
speedrun.cpp:12:9: error: 'vector' does not name a type
   12 | typedef vector<vii> vvii;
      |         ^~~~~~
speedrun.cpp:13:9: error: 'vector' does not name a type
   13 | typedef vector<ll> vll;
      |         ^~~~~~
speedrun.cpp:14:9: error: 'vector' does not name a type
   14 | typedef vector<vll> vvll;
      |         ^~~~~~
speedrun.cpp:16:1: error: 'vvi' does not name a type
   16 | vvi al;
      | ^~~
speedrun.cpp: In function 'int findPar(int)':
speedrun.cpp:22:12: error: 'al' was not declared in this scope; did you mean 'll'?
   22 |         if(al[i].size()>1)
      |            ^~
      |            ll
speedrun.cpp: In function 'void assignHints(int, int, int*, int*)':
speedrun.cpp:28:5: error: 'al' was not declared in this scope; did you mean 'a'?
   28 |     al.resize(n+1, vi());
      |     ^~
      |     a
speedrun.cpp:28:20: error: 'vi' was not declared in this scope
   28 |     al.resize(n+1, vi());
      |                    ^~
speedrun.cpp:34:5: error: 'setHintLen' was not declared in this scope
   34 |     setHintLen(1);
      |     ^~~~~~~~~~
speedrun.cpp: In function 'void speedRun(int, int, int)':
speedrun.cpp:39:5: error: 'memset' was not declared in this scope
   39 |     memset(vis, false, n+1);
      |     ^~~~~~
speedrun.cpp:1:1: note: 'memset' is defined in header '<cstring>'; did you forget to '#include <cstring>'?
  +++ |+#include <cstring>
    1 | 
speedrun.cpp:42:9: error: 'goTo' was not declared in this scope
   42 |         goTo(par);
      |         ^~~~
speedrun.cpp:48:13: error: 'goTo' was not declared in this scope
   48 |             goTo(i);
      |             ^~~~