Submission #1035458

#TimeUsernameProblemLanguageResultExecution timeMemory
1035458TsotneSVEaster Eggs (info1cup17_eastereggs)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; /* /\_/\ (= ._.) / > \> */ #define pb push_back int findEgg(int N, vector < pair < int, int > > bridges) { vector<vector<int>> g(N + 1); vector<int> tour; for(int i=0;i<N-1;i++) { int u = bridges[i].first,v = bridges[i].second; g[u].pb(v); g[v].pb(u); } function<void(int,int)> dfs = [&](int v,int p) { tour.pb(v); for(int i : g[v]) { if(i == p) continue; dfs(i,v); } }; dfs(1,0); int l = 0,r = N-1; while(l < r) { int mid = (l + r)/2; vector<int> islands; for(int i=l;i<=mid;i++) { islands.pb(tour[i]); } if(query(islands)) { r = mid; }else { l = mid + 1; } } return tour[r]; } #include <bits/stdc++.h> using namespace std; /* /\_/\ (= ._.) / > \> */ #define pb push_back int findEgg(int N, vector < pair < int, int > > bridges) { vector<vector<int>> g(N + 1); vector<int> tour; for(int i=0;i<N-1;i++) { int u = bridges[i].first,v = bridges[i].second; g[u].pb(v); g[v].pb(u); } function<void(int,int)> dfs = [&](int v,int p) { tour.pb(v); for(int i : g[v]) { if(i == p) continue; dfs(i,v); } }; dfs(1,0); int l = 0,r = N-1; while(l < r) { int mid = (l + r)/2; vector<int> islands; for(int i=l;i<=mid;i++) { islands.pb(tour[i]); } if(query(islands)) { r = mid; }else { l = mid + 1; } } return tour[r]; }

Compilation message (stderr)

eastereggs.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >)':
eastereggs.cpp:42:12: error: 'query' was not declared in this scope
   42 |         if(query(islands)) {
      |            ^~~~~
eastereggs.cpp: At global scope:
eastereggs.cpp:61:5: error: redefinition of 'int findEgg(int, std::vector<std::pair<int, int> >)'
   61 | int findEgg(int N, vector < pair < int, int > > bridges) {
      |     ^~~~~~~
eastereggs.cpp:10:5: note: 'int findEgg(int, std::vector<std::pair<int, int> >)' previously defined here
   10 | int findEgg(int N, vector < pair < int, int > > bridges) {
      |     ^~~~~~~
eastereggs.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >)':
eastereggs.cpp:93:12: error: 'query' was not declared in this scope
   93 |         if(query(islands)) {
      |            ^~~~~