답안 #1078112

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1078112 2024-08-27T12:51:09 Z MohamedFaresNebili 참나무 (IOI23_beechtree) C++17
컴파일 오류
0 ms 0 KB
back(v);
            for(auto u : adj[v])
                getSub(u, sub);
        }

        vector<int> beechtree(int N, int M, vector<int> P, vector<int> C) {
            vector<int> ans(N, 0);
            for(int l = 0; l < N; l++) adj[l].clear();
            for(int l = 1; l < N; l++)
                adj[P[l]].push_back(l);
            for(int l = 0; l < N; l++) {
                vector<int> sub; getSub(l, sub);
                sort(sub.begin() + 1, sub.end());
                do {
                    bool ok = true;
                    vector<int> cur(M, 0);
                    for(int i = 0; i < sub.size() && ok; i++) {
                        if(i > 0) ok &= (P[sub[i]] == sub[cur[C[sub[i]]]]);
                        cur[C[sub[i]]]++;
                    }
                    if(ok) { ans[l] = 1; break; }
                } while(!next_permutation(sub.begin() + 1, sub.end()));
            }
            return ans;
        }


Compilation message

beechtree.cpp:1:5: error: expected constructor, destructor, or type conversion before '(' token
    1 | back(v);
      |     ^
beechtree.cpp:2:13: error: expected unqualified-id before 'for'
    2 |             for(auto u : adj[v])
      |             ^~~
beechtree.cpp:4:9: error: expected declaration before '}' token
    4 |         }
      |         ^
beechtree.cpp:6:9: error: 'vector' does not name a type
    6 |         vector<int> beechtree(int N, int M, vector<int> P, vector<int> C) {
      |         ^~~~~~