제출 #1241563

#제출 시각아이디문제언어결과실행 시간메모리
1241563SalihSahin참나무 (IOI23_beechtree)C++20
컴파일 에러
0 ms0 KiB
#include "bits/stdc++.h" #include "beechtree.h" #define pb push_back using namespace std; const int N = 2e5 + 5; vector<int> perm; vector<pair<int, int> > edges; void dfs(int node){ perm.pb(node); for(auto itr: ch[node]){ edges.pb(itr); dfs(itr.first); } } vector<int> beechtree(int N, int M, vector<int> P, vector<int> C){ vector<int> cnt(M+1); vector<int> ans(N, 1); for(int i = 0; i < N; i++){ perm.clear(); edges.clear(); dfs(i); sort(perm.begin(), perm.end()); bool check = 0; vector<int> cnt(M); do{ if(perm[0] != i) continue; vector<int> pos(N); for(int j = 0; j < perm.size(); j++){ pos[perm[j]] = j; } bool yes = 1; for(int j = 1; j < perm.size(); j++){ if(pos[P[perm[j]]] != cnt[C[perm[j]]]) yes = 0; cnt[C[perm[j]]]++; } check |= yes; }while(next_permutation(perm.begin(), perm.end())); ans[i] = check; } return ans; }

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

beechtree.cpp: In function 'void dfs(int)':
beechtree.cpp:13:18: error: 'ch' was not declared in this scope
   13 |    for(auto itr: ch[node]){
      |                  ^~