QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#666668 | #7158. Carnival General | blackslex# | 0 | 1ms | 4096kb | C++14 | 747b | 2024-10-22 19:32:37 | 2024-10-22 19:32:43 |
answer
#include<bits/stdc++.h>
using namespace std;
int n;
int main() {
scanf("%d", &n);
vector<vector<int>> c(n - 1);
vector<vector<bool>> f(n, vector<bool>(n));
for (int i = 0; i < n - 1; i++) {
c[i].resize(i + 1);
for (auto &e: c[i]) scanf("%d", &e);
for (int j = 0; j < (i + 1) / 2; j++) f[i + 1][j] = 1;
}
vector<int> ans(n); iota(ans.begin(), ans.end(), 0);
do {
bool ok = 1;
for (int i = 0; i < n; i++) {
if (i && !f[ans[i]][ans[i - 1]]) ok = 0;
if (i != n - 1 && !f[ans[i]][ans[i + 1]]) ok = 0;
}
if (ok) break;
} while (next_permutation(ans.begin(), ans.end()));
for (auto &e: ans) printf("%d ", e);
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Time Limit Exceeded
Test #1:
score: 11
Accepted
time: 0ms
memory: 4096kb
input:
2 0
output:
0 1
result:
ok correct
Test #2:
score: 0
Time Limit Exceeded
input:
99 0 1 0 2 1 0 3 2 1 0 4 3 2 1 0 5 4 3 2 1 0 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 10 9 8 7 6 5 4 3 2 1 0 11 10 9 8 7 6 5 4 3 2 1 0 12 11 10 9 8 7 6 5 4 3 2 1 0 13 12 11 10 9 8 7 6 5 4 3 2 1 0 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 16 1...
output:
result:
Subtask #2:
score: 0
Time Limit Exceeded
Test #6:
score: 23
Accepted
time: 0ms
memory: 3808kb
input:
2 0
output:
0 1
result:
ok correct
Test #7:
score: 0
Time Limit Exceeded
input:
99 0 0 1 0 1 2 0 1 2 3 0 1 2 3 4 0 1 2 3 4 5 0 1 2 3 4 5 6 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 10 0 1 2 3 4 5 6 7 8 9 10 11 0 1 2 3 4 5 6 7 8 9 10 11 12 0 1 2 3 4 5 6 7 8 9 10 11 12 13 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 1 ...
output:
result:
Subtask #3:
score: 0
Wrong Answer
Test #12:
score: 29
Accepted
time: 0ms
memory: 3692kb
input:
2 0
output:
0 1
result:
ok correct
Test #13:
score: 29
Accepted
time: 0ms
memory: 4088kb
input:
8 0 1 0 2 1 0 3 2 1 0 4 3 2 1 0 5 4 3 2 1 0 6 5 4 3 2 1 0
output:
0 1 2 3 4 5 6 7
result:
ok correct
Test #14:
score: 0
Wrong Answer
time: 1ms
memory: 3804kb
input:
8 0 0 1 0 1 2 0 1 2 3 0 1 2 3 4 0 1 2 3 4 5 0 1 2 3 4 5 6
output:
0 1 2 3 4 5 6 7
result:
wrong answer Enemies 2 and 3 are next to each other
Subtask #4:
score: 0
Skipped
Dependency #1:
0%