Submission #1226931

#TimeUsernameProblemLanguageResultExecution timeMemory
1226931mariaclaraBeech Tree (IOI23_beechtree)C++20
Compilation error
0 ms0 KiB
#include "beechtree.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pii; typedef vector<int> vi; typedef vector<ll> vl; #define all(x) x.begin(), x.end() #define sz(x) (int)x.size() #define mk make_pair #define pb push_back #define fr first #define sc second vector<vi> edges; vi beechtree(int N, int M, vi P, vi C) { vi ans(N); edges.clear(); edges.resize(N); for(int i = 1; i <= N-1; i++) edges[P[i]].pb(i), C[i]--; vi color_qtd(M), in_sub(N); for(int i = 0; i <= N-1; i++) { // check do i vi sub, sub_end; queue<int> fila; fila.push(i); while(!fila.empty()) { int x = fila.front(); fila.pop(); if(x != i and !in_sub[P[x]]) in_sub[P[x]] = 1, sub.pb(P[x]); if(edges[x].empty()) sub_end.pb(x); for(auto viz : edges[x]) fila.push(viz); } sort(all(sub), [](int a, int b){ return mk(sz(edges[a]), a) < mk(sz(edges[b]), b) }); for(auto it : sub_end) sub.pb(it); ans[i] = 1; for(int j = 1; j < sz(sub); j++) { if(P[sub[j]] != sub[color_qtd[C[sub[j]]]]) ans[i] = 0; color_qtd[C[sub[j]]]++; } for(auto it : sub) in_sub[it] = color_qtd[C[it]] = 0; } return ans; }

Compilation message (stderr)

beechtree.cpp: In lambda function:
beechtree.cpp:48:61: error: expected ';' before '}' token
   48 |             return mk(sz(edges[a]), a) < mk(sz(edges[b]), b)
      |                                                             ^
      |                                                             ;
   49 |         });
      |         ~