제출 #1116589

#제출 시각아이디문제언어결과실행 시간메모리
1116589vladiliusEaster Eggs (info1cup17_eastereggs)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; #define pb push_back #define ff first #define ss second int findEgg(int n, vector<pii> ed){ vector<int> g[n]; for (auto [x, y]: ed){ g[x].pb(y); g[y].pb(x); } vector<int> a(n); int timer = 0; function<void(int, int)> dfs = [&](int v, int pr){ a[timer++] = v; for (int i: g[v]){ if (i == pr) continue; dfs(i, v); } }; dfs(0, 0); auto check = [&](int x){ vector<int> f; for (int i = 0; i <= x; i++){ f.pb(a[i]); } return query(f); }; int l = 0, r = n - 1; while (l + 1 < r){ int m = (l + r) / 2; if (check(m)){ r = m; } else { l = m + 1; } } if (check(l)) r = l; return a[r]; }

컴파일 시 표준 에러 (stderr) 메시지

eastereggs.cpp: In lambda function:
eastereggs.cpp:31:16: error: 'query' was not declared in this scope
   31 |         return query(f);
      |                ^~~~~