제출 #516510

#제출 시각아이디문제언어결과실행 시간메모리
516510blueRegions (IOI09_regions)C++17
컴파일 에러
0 ms0 KiB
#include <iostream> #include <algorithm> #include <vector> using namespace std; using ll = long long; using vi = vector<int>; using vvi = vector<vi>; using vl = vector<ll>; using vvl = vector<vl>; #define sz(x) int(x.size()) const int maxN = 200'000; const int maxR = 500; int N, R, Q; vi H(1+maxN), S(1+maxN); vvl ans(1+maxR, vl(1+maxR, 0)); vl inc(1+maxR, 0); void dfs(int u) { for(int r = 1; r <= R; r++) ans[r][H[u]] += inc[r]; inc[H[u]]++; for(int v: children[u]) { dfs(v); subtree[u] += subtree[v]; } inc[H[u]]--; } int main() { // cout << "done\n"; ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> N >> R >> Q; cin >> H[1]; S[1] = 0; for(int i = 2; i <= N; i++) { cin >> S[i] >> H[i]; children[S[i]].push_back(i); } dfs(1); for(int q = 1; q <= Q; q++) { int r1, r2; cin >> r1 >> r2; cout << ans[r1][r2] << '\n'; cout.flush(); } return 0; // int r1, r2; // cin >> r1 >> r2; // cout << large_top[norm[r1]][r2] << '\n'; }

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

regions.cpp: In function 'void dfs(int)':
regions.cpp:31:16: error: 'children' was not declared in this scope
   31 |     for(int v: children[u])
      |                ^~~~~~~~
regions.cpp:34:9: error: 'subtree' was not declared in this scope
   34 |         subtree[u] += subtree[v];
      |         ^~~~~~~
regions.cpp: In function 'int main()':
regions.cpp:60:9: error: 'children' was not declared in this scope
   60 |         children[S[i]].push_back(i);
      |         ^~~~~~~~