# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
1010749 |
2024-06-29T10:23:05 Z |
우민규(#10884) |
참나무 (IOI23_beechtree) |
C++17 |
|
2000 ms |
2097152 KB |
#include "beechtree.h"
#include <bits/stdc++.h>
using namespace std;
std::vector<int> beechtree(int n, int m, std::vector<int> p,
std::vector<int> c) {
vector<int> perm(n);
iota(perm.begin(), perm.end(), 0);
vector<int> cols;
for (auto c : c) cols.push_back(c);
sort(cols.begin(), cols.end());
cols.resize(unique(cols.begin(), cols.end()) - cols.begin());
for (auto& c : c) c = lower_bound(cols.begin(), cols.end(), c) - cols.begin();
m = cols.size();
vector<vector<int>> subtree(n);
for (int i = 0; i < n; ++i) subtree[i].push_back(i);
for (int i = n - 1; i > 0; --i) {
subtree[p[i]].insert(subtree[p[i]].end(), subtree[i].begin(),
subtree[i].end());
}
vector<int> poss(n);
for (int i = 0; i < n; ++i) {
vector<int> perm = subtree[i];
do {
vector<int> cnt(m);
bool pos = true;
for (auto v : perm) {
if (v == perm[0]) continue;
if (perm[cnt[c[v]]] != p[v]) {
pos = false;
}
cnt[c[v]] += 1;
}
if (pos) {
poss[i] = true;
break;
}
} while (next_permutation(perm.begin() + 1, perm.end()));
}
return poss;
}
#ifndef EVAL
#include "grader.cpp"
#endif
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Execution timed out |
2096 ms |
348 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
436 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
436 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
344 KB |
Output is correct |
13 |
Correct |
0 ms |
432 KB |
Output is correct |
14 |
Incorrect |
0 ms |
348 KB |
2nd lines differ - on the 2nd token, expected: '1', found: '0' |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
436 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Runtime error |
876 ms |
2097152 KB |
Execution killed with signal 9 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
2031 ms |
348 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
436 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Runtime error |
876 ms |
2097152 KB |
Execution killed with signal 9 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Execution timed out |
2096 ms |
348 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
436 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
432 KB |
Output is correct |
10 |
Incorrect |
0 ms |
348 KB |
2nd lines differ - on the 2nd token, expected: '1', found: '0' |
11 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Execution timed out |
2096 ms |
348 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
436 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
432 KB |
Output is correct |
10 |
Incorrect |
0 ms |
348 KB |
2nd lines differ - on the 2nd token, expected: '1', found: '0' |
11 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Execution timed out |
2096 ms |
348 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |