Submission #524224

#TimeUsernameProblemLanguageResultExecution timeMemory
524224CSQ31Easter Eggs (info1cup17_eastereggs)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "grader.h" using namespace std; vector<int>adj[1000],a; void dfs(int v,int u){ a.push_back(v); for(int x:adj[v]){ if(x==u)continue; dfs(x,v); } } int findEgg (int n, vector < pair < int, int > > bridges) { for(auto x:bridges){ adj[x.first].push_back(x.second); adj[x.second].push_back(x.first); } dfs(1,0); int l = 0,r = n-1; while(r>=l){ int mid = (l+r)/2; vector<int>b; for(int i=0;i<=mid;i++)b.push_back(a[i]); if(query(b))r=mid-1; else l=mid+1; } assert(l<n) return a[l]; }

Compilation message (stderr)

eastereggs.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >)':
eastereggs.cpp:29:2: error: expected ';' before 'return'
   29 |  return a[l];
      |  ^~~~~~
eastereggs.cpp:30:1: warning: control reaches end of non-void function [-Wreturn-type]
   30 | }
      | ^