Submission #857396

#TimeUsernameProblemLanguageResultExecution timeMemory
857396mychecksedadBeech Tree (IOI23_beechtree)C++17
5 / 100
58 ms16044 KiB
#include <beechtree.h> #include <bits/stdc++.h> using namespace std; #define pb push_back #define all(x) x.begin(), x.end() const int N = 2e5+100; vector<array<int, 2>> g[N]; vector<int> ans; vector<int> beechtree(int n, int m, vector<int> P, vector<int> C){ for(int i = 1; i < n; ++i){ g[P[i]].pb({i, C[i]}); } ans.resize(n); bool ok = 1; for(int i = n - 1; i >= 0; --i){ if(!ok) ans[i] = 0; else{ if(i < n - 1 && C[i] != C[i + 1]) ok = 0, ans[i] = 1; else ans[i] = 1; } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...