Submission #1221336

#TimeUsernameProblemLanguageResultExecution timeMemory
1221336im2xtreme참나무 (IOI23_beechtree)C++20
Compilation error
0 ms0 KiB
#include <iostream>
#include <vector>
#include <unordered_map>
#include <queue>
#include "beechtree.h"
using namespace std;

const int MAXN = 200005;

vector<int> tree[MAXN];

vector<int> beechtree(int N, int M, vector<int> P, vector<int> C) {
    vector<int> result(N, 1);  // Assume beautiful until proven otherwise

    // Build the tree
    for (int i = 0; i < N; ++i) tree[i].clear();
    for (int i = 1; i < N; ++i) {
        tree[P[i]].push_back(i);
    }

    // Process each node as subtree root
    for (int root = 0; root < N; ++root) {
        vector<int> perm;                  // Beautiful permutation we’re trying to construct
        unordered_map<int, int> color_cnt; // Frequency of colo

Compilation message (stderr)

beechtree.cpp: In function 'std::vector<int> beechtree(int, int, std::vector<int>, std::vector<int>)':
beechtree.cpp:24:43: error: expected '}' at end of input
   24 |         unordered_map<int, int> color_cnt; // Frequency of colo
      |                                           ^
beechtree.cpp:22:42: note: to match this '{'
   22 |     for (int root = 0; root < N; ++root) {
      |                                          ^
beechtree.cpp:24:43: error: expected '}' at end of input
   24 |         unordered_map<int, int> color_cnt; // Frequency of colo
      |                                           ^
beechtree.cpp:12:67: note: to match this '{'
   12 | vector<int> beechtree(int N, int M, vector<int> P, vector<int> C) {
      |                                                                   ^
beechtree.cpp:24:43: warning: no return statement in function returning non-void [-Wreturn-type]
   24 |         unordered_map<int, int> color_cnt; // Frequency of colo
      |                                           ^