# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1066705 | 2024-08-20T05:10:08 Z | LittleOrange | Beech Tree (IOI23_beechtree) | C++17 | 1 ms | 348 KB |
#include "beechtree.h" #include<bits/stdc++.h> using namespace std; using ll = int; std::vector<int> beechtree(int N, int M, std::vector<int> P, std::vector<int> C) { ll n = N; ll m = M; vector<vector<ll>> ch(n); for(ll i = 1;i<n;i++) ch[P[i]].push_back(i); vector<ll> ord; { function<void(ll)> dfs; dfs = [&](ll i){ ord.push_back(i); for(ll j : ch[i]) dfs(j); }; dfs(0); } vector<ll> rord = ord; reverse(rord.begin(),rord.end()); vector<ll> bad(n,0); for(ll i : rord){ vector<ll> v; for(ll j : ch[i]){ if (bad[j]) bad[i] = 1; v.push_back(C[j]); if(ch[i].size()<ch[j].size()) bad[i] = 1; } sort(v.begin(),v.end()); if (unique(v.begin(),v.end())!=v.end()) bad[i] = 1; } vector<ll> ans(n); for(ll i = 0;i<n;i++) ans[i] = !bad[i]; return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Incorrect | 1 ms | 348 KB | 2nd lines differ - on the 1st token, expected: '0', found: '1' |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Incorrect | 0 ms | 348 KB | 2nd lines differ - on the 1st token, expected: '0', found: '1' |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Incorrect | 0 ms | 348 KB | 2nd lines differ - on the 1st token, expected: '0', found: '1' |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Incorrect | 0 ms | 348 KB | 2nd lines differ - on the 1st token, expected: '0', found: '1' |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Incorrect | 0 ms | 348 KB | 2nd lines differ - on the 1st token, expected: '0', found: '1' |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Incorrect | 1 ms | 348 KB | 2nd lines differ - on the 1st token, expected: '0', found: '1' |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Incorrect | 0 ms | 348 KB | 2nd lines differ - on the 1st token, expected: '0', found: '1' |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Incorrect | 1 ms | 348 KB | 2nd lines differ - on the 1st token, expected: '0', found: '1' |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Incorrect | 0 ms | 348 KB | 2nd lines differ - on the 1st token, expected: '0', found: '1' |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Incorrect | 1 ms | 348 KB | 2nd lines differ - on the 1st token, expected: '0', found: '1' |
3 | Halted | 0 ms | 0 KB | - |