제출 #1124452

#제출 시각아이디문제언어결과실행 시간메모리
1124452gdragonEaster Eggs (info1cup17_eastereggs)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define TASK "long" #define fi first #define se second #define ll long long #define pb push_back #define ALL(x) (x).begin(), (x).end() #define GETBIT(mask, i) ((mask) >> (i) & 1) #define MASK(i) ((1LL) << (i)) #define SZ(x) ((int)(x).size()) #define mp make_pair #define CNTBIT(mask) __builtin_popcount(mask) template<class X, class Y> bool maximize(X &x, Y y){ if (x < y) {x = y; return true;} return false;}; template<class X, class Y> bool minimize(X &x, Y y){ if (x > y) {x = y; return true;} return false;}; typedef pair<int, int> ii; const int N = 1e5 + 5; const int inf = 1e9 + 7; const long long INF = (long long)1e18 + 7; const int mod = 1e9 + 7; void add(int &x, int y) {x += y; if (x >= mod) x -= mod;} void sub(int &x, int y) {x -= y; if (x < 0) x += mod;} int mul(int x, int y) {return 1LL * x * y % mod;} // -----------------------------------------// int n; vector<int> adj[N]; int tin[N], node[N]; int timer = 0; void dfs(int u, int p) { tin[u] = ++timer; node[timer] = u; for(int v: adj[u]) if (v != p) { dfs(v, u); } tout[u] = timer; } int findEgg(int N, vector<pair<int, int>> bridges) { n = N; for(auto [u, v]: bridges) { adj[u].push_back(v); adj[v].push_back(u); } dfs(1, -1); vector<int> islands; int l = 1, r = n, ans = -1; while(l <= r) { int mid = (l + r) >> 1; while(SZ(islands) < mid) islands.push_back(node[SZ(islands) + 1]); while(SZ(islands) > mid) islands.pop_back(); if (query(islands) == 1) { ans = node[mid]; r = mid - 1; } else l = mid + 1; } return ans; }

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

eastereggs.cpp: In function 'void dfs(int, int)':
eastereggs.cpp:35:5: error: 'tout' was not declared in this scope; did you mean 'stdout'?
   35 |     tout[u] = timer;
      |     ^~~~
      |     stdout
eastereggs.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >)':
eastereggs.cpp:50:13: error: 'query' was not declared in this scope
   50 |         if (query(islands) == 1) {
      |             ^~~~~