# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1008674 | 2024-06-26T16:33:05 Z | aaaaaarroz | Beech Tree (IOI23_beechtree) | C++17 | 2000 ms | 348 KB |
#include "beechtree.h" #include <bits/stdc++.h> using namespace std; vector<int>padre; vector<vector<int>>graph; vector<int>sub; void dfs(int nodo){ sub.push_back(nodo); for(int vecino:graph[nodo]){ if(vecino!=padre[nodo]){ dfs(vecino); } } } vector<int> beechtree(int n, int m, vector<int>P, vector<int>C){ padre=P; graph.resize(n,vector<int>()); for(int i=0;i<n;i++){ if(P[i]!=-1){ graph[i].push_back(P[i]); graph[P[i]].push_back(i); } } vector<int>ans; for(int i=0;i<n;i++){ sub.clear(); dfs(i); bool posible=false; while(next_permutation(next(sub.begin()),sub.end())){ bool bien=true; map<int,int>repeticiones; for(int i=1;i<sub.size();i++){ if(repeticiones[C[i]]!=P[i]){ bien=false; break; } repeticiones[C[i]]++; } posible|=bien; } ans.push_back(posible); } return ans; }
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 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 2nd token, expected: '1', found: '0' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2064 ms | 348 KB | Time limit exceeded |
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 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 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 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 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 2nd token, expected: '1', found: '0' |
2 | Halted | 0 ms | 0 KB | - |