Submission #1053963

#TimeUsernameProblemLanguageResultExecution timeMemory
1053963SulAEaster Eggs (info1cup17_eastereggs)C++17
Compilation error
0 ms0 KiB
#include "grader.h" #include <bits/stdc++.h> using namespace std; vector<int> adj[513], preorder; void dfs(int u = 1, int p = 0) { preorder.push_back(u); for (int ch : adj[u]) if (ch != p) dfs(ch, u); } int findEgg (int n, vector<pair<int,int>> bridges) { for (auto pair] : bridges) { int u = pair.first, v = pair.second; adj[u].push_back(v); adj[v].push_back(u); } dfs(); int l = 0, r = n-1; while (r > l) { int mid = (l+r)/2; vector<int> myquery{}; for (int i = 0; i <= mid; i++) myquery.push_back(preorder[i]); bool res = query(myquery) == 1; // cout << "MY QUERY IS "; // for (int u : myquery) cout << u << " "; // cout << '\n'; if (res) r = mid; else l = mid+1; } return preorder[l]; }

Compilation message (stderr)

eastereggs.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >)':
eastereggs.cpp:13:19: error: expected ';' before ']' token
   13 |     for (auto pair] : bridges) {
      |                   ^
      |                   ;
eastereggs.cpp:13:19: error: expected primary-expression before ']' token
eastereggs.cpp:13:19: error: expected ';' before ']' token
   13 |     for (auto pair] : bridges) {
      |                   ^
      |                   ;
eastereggs.cpp:13:19: error: expected primary-expression before ']' token
eastereggs.cpp:13:19: error: expected ')' before ']' token
   13 |     for (auto pair] : bridges) {
      |         ~         ^
      |                   )
eastereggs.cpp:13:19: error: expected primary-expression before ']' token
eastereggs.cpp:13:15: warning: unused variable 'pair' [-Wunused-variable]
   13 |     for (auto pair] : bridges) {
      |               ^~~~