# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1083495 | 2024-09-03T10:30:17 Z | SamueleVid | 참나무 (IOI23_beechtree) | C++17 | 2000 ms | 10072 KB |
#include <bits/stdc++.h> using namespace std; constexpr int MAXN = 2e5 + 5; constexpr int MAXM = 2e5 + 5; int depth[MAXN]; vector<int> adj[MAXN]; vector<int> P; vector<int> C; set<int> colori_prof[3]; int numero[3]; void dfs(int u) { colori_prof[depth[u]].insert(C[u]); numero[depth[u]] ++; for (auto x : adj[u]) { if (x == P[u]) continue; depth[x] = depth[u] + 1; dfs(x); } } vector<int> beechtree(int N, int M, vector<int> P, vector<int> C) { :: P = P; :: C = C; for (int i = 1; i < N; i ++) { adj[P[i]].push_back(i); adj[i].push_back(P[i]); } depth[0] = 0; dfs(0); vector<int> res(N, 1); bool condivide_uno = 0; for (auto x : colori_prof[2]) { if (colori_prof[1].count(x)) condivide_uno = 1; } if (colori_prof[2].size() == 1 && colori_prof[1].size() == numero[1] && condivide_uno) { res[0] = 1; } else { res[0] = 0; } return res; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 4952 KB | Output is correct |
2 | Runtime error | 6 ms | 10072 KB | Execution killed with signal 11 |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 4956 KB | Output is correct |
2 | Correct | 2 ms | 4956 KB | Output is correct |
3 | Execution timed out | 2076 ms | 4956 KB | Time limit exceeded |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 4956 KB | Output is correct |
2 | Correct | 2 ms | 4956 KB | Output is correct |
3 | Execution timed out | 2076 ms | 4956 KB | Time limit exceeded |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 4952 KB | Output is correct |
2 | Incorrect | 2 ms | 4956 KB | 2nd lines differ - on the 4th token, expected: '0', found: '1' |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 4956 KB | Output is correct |
2 | Correct | 2 ms | 4956 KB | Output is correct |
3 | Correct | 3 ms | 4952 KB | Output is correct |
4 | Incorrect | 2 ms | 4956 KB | 2nd lines differ - on the 1st token, expected: '1', found: '0' |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 4952 KB | Output is correct |
2 | Runtime error | 6 ms | 10072 KB | Execution killed with signal 11 |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 4956 KB | Output is correct |
2 | Correct | 2 ms | 4956 KB | Output is correct |
3 | Correct | 3 ms | 4952 KB | Output is correct |
4 | Incorrect | 2 ms | 4956 KB | 2nd lines differ - on the 1st token, expected: '1', found: '0' |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 4952 KB | Output is correct |
2 | Runtime error | 6 ms | 10072 KB | Execution killed with signal 11 |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 4956 KB | Output is correct |
2 | Correct | 2 ms | 4956 KB | Output is correct |
3 | Correct | 3 ms | 4952 KB | Output is correct |
4 | Incorrect | 2 ms | 4956 KB | 2nd lines differ - on the 1st token, expected: '1', found: '0' |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 4952 KB | Output is correct |
2 | Runtime error | 6 ms | 10072 KB | Execution killed with signal 11 |
3 | Halted | 0 ms | 0 KB | - |