Submission #703958

#TimeUsernameProblemLanguageResultExecution timeMemory
703958boyliguanhanEaster Eggs (info1cup17_eastereggs)C++17
100 / 100
22 ms464 KiB
#include "grader.h" using namespace std; vector<int> order; vector<int> adj[513]; void dfs(int n, int p) { order.push_back(n); for (auto i : adj[n]) if (i != p) dfs(i, n); } int findEgg(int N, vector < pair < int, int > > bridges) { order.clear(); for (int i = 1; i <= N; i++) adj[i].clear(); for (auto i : bridges) adj[i.first].push_back(i.second), adj[i.second].push_back(i.first); dfs(1, 0); int l = 1, r = N; while (l < r) { int mid = l + r >> 1; if (query(vector<int>(order.begin(), order.begin() + mid))) r = mid; else l = mid + 1; } return order[l - 1]; }

Compilation message (stderr)

eastereggs.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >)':
eastereggs.cpp:22:21: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   22 |         int mid = l + r >> 1;
      |                   ~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...