Submission #480527

#TimeUsernameProblemLanguageResultExecution timeMemory
480527HaidaraEaster Eggs (info1cup17_eastereggs)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #include<grader.h> #define rep(i,x,n) for(int i=x;i<n;i++) #define FOR(i,n) rep(i,0,n) using namespace std; vector<int>graph[maxn],ord; void dfs(int st=1,int par=-1) { ord.push_back(st); for(auto i:graph[st]) { if(i==par) continue; dfs(i,st); } } int findEgg(int n,vector< pair<int,int> >edges) { for(auto i:edges) { graph[i.ff].push_back(i.ss); graph[i.ss].push_back(i.ff); } dfs(); int l=0,r=n-1; while(l<r) { int mid=l+(r-l)/2; if(query(vector<int>(ord.begin(),ord.begin()+mid))) r=mid; else l=mid+1; } return ord[r]; }

Compilation message (stderr)

eastereggs.cpp:6:18: error: 'maxn' was not declared in this scope
    6 | vector<int>graph[maxn],ord;
      |                  ^~~~
eastereggs.cpp: In function 'void dfs(int, int)':
eastereggs.cpp:10:16: error: 'graph' was not declared in this scope; did you mean 'isgraph'?
   10 |     for(auto i:graph[st])
      |                ^~~~~
      |                isgraph
eastereggs.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >)':
eastereggs.cpp:21:9: error: 'graph' was not declared in this scope; did you mean 'isgraph'?
   21 |         graph[i.ff].push_back(i.ss);
      |         ^~~~~
      |         isgraph
eastereggs.cpp:21:17: error: 'struct std::pair<int, int>' has no member named 'ff'
   21 |         graph[i.ff].push_back(i.ss);
      |                 ^~
eastereggs.cpp:21:33: error: 'struct std::pair<int, int>' has no member named 'ss'
   21 |         graph[i.ff].push_back(i.ss);
      |                                 ^~
eastereggs.cpp:22:17: error: 'struct std::pair<int, int>' has no member named 'ss'
   22 |         graph[i.ss].push_back(i.ff);
      |                 ^~
eastereggs.cpp:22:33: error: 'struct std::pair<int, int>' has no member named 'ff'
   22 |         graph[i.ss].push_back(i.ff);
      |                                 ^~