# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1061899 | 2024-08-16T15:02:05 Z | mychecksedad | Beech Tree (IOI23_beechtree) | C++17 | 1 ms | 348 KB |
#include "beechtree.h" #include <bits/stdc++.h> using namespace std; #define pb push_back #define all(x) x.begin(),x.end() #define ll long long #define ff first #define ss second #define vi vector<int> const int N = 3005; const ll INF = 1e18; vector<int> g[N], s[N]; vi res; int col[N], n, m, par[N]; bool ok = 1; void dfs(int v){ for(int u: g[v]){ dfs(u); par[u] = v; for(int x: s[u]) s[v].pb(x); } sort(all(s[v])); bool okkk = 0; if(s[v].empty()) okkk = 1; do{ vector<int> f = s[v]; f.insert(f.begin(), v); vector<int> co(m); bool good = 1; for(int i = 1; i < f.size(); ++i){ if(f[co[col[f[i]]]] != par[f[i]]){ good = 0; break; } co[col[f[i]]]++; } if(good){ okkk = 1; break; } }while(next_permutation(all(s[v]))); s[v].pb(v); // ok = ok & okkk; res[v] = okkk; } std::vector<int> beechtree(int nn, int mm, std::vector<int> P, std::vector<int> C) {n=nn, m=mm; res.resize(n); // for(int i = 1; i < n; ++i){ // g[P[i]].pb(i); // col[i] = C[i]; // } // dfs(0); bool ok = 1; res[n - 1] = 1; for(int i = n - 2; i >= 0; --i){ if(ok == 0){ res[i] = ok; }else if(C[i] != C[i + 1]){ ok = 0; res[i] = ok; }else{ res[i] = 1; } } return res; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | 2nd lines differ - on the 2nd token, expected: '1', found: '0' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | 2nd lines differ - on the 1st token, expected: '1', found: '0' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | 2nd lines differ - on the 1st token, expected: '1', found: '0' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 344 KB | 2nd lines differ - on the 2nd token, expected: '1', found: '0' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | 2nd lines differ - on the 1st token, expected: '1', found: '0' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | 2nd lines differ - on the 2nd token, expected: '1', found: '0' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | 2nd lines differ - on the 1st token, expected: '1', found: '0' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | 2nd lines differ - on the 2nd token, expected: '1', found: '0' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | 2nd lines differ - on the 1st token, expected: '1', found: '0' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | 2nd lines differ - on the 2nd token, expected: '1', found: '0' |
2 | Halted | 0 ms | 0 KB | - |