QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#666986 | #7158. Carnival General | blackslex# | 0 | 1ms | 4068kb | C++14 | 885b | 2024-10-22 20:39:25 | 2024-10-22 20:39:34 |
answer
#include<bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
int n;
set<pii> s;
int main() {
scanf("%d", &n);
vector<vector<int>> c(n - 1);
vector<vector<int>> v(n, vector<int>());
vector<set<int>> s(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 = i / 2 + 1; j < i + 1; j++) s[i + 1].emplace(c[i][j]);
}
vector<int> ans{0};
for (int i = 1; i < n; i++) {
for (int j = 0; j < i; j++) {
bool ok = 1;
if (j && s[i].find(ans[j - 1]) != s[i].end()) ok = 0;
if (j != i - 1 && s[i].find(ans[j + 1]) != s[i].end()) ok = 0;
if (ok) {
ans.insert(ans.begin() + j, i);
break;
}
}
}
for (auto &e: ans) printf("%d ", e);
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 11
Accepted
time: 0ms
memory: 4064kb
input:
2 0
output:
1 0
result:
ok correct
Test #2:
score: 0
Wrong Answer
time: 1ms
memory: 3892kb
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:
98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 3 4 1 2 0
result:
wrong answer Enemies 5 and 2 are next to each other
Subtask #2:
score: 0
Wrong Answer
Test #6:
score: 23
Accepted
time: 0ms
memory: 4068kb
input:
2 0
output:
1 0
result:
ok correct
Test #7:
score: 0
Wrong Answer
time: 1ms
memory: 3992kb
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:
95 63 47 31 65 64 23 15 67 66 33 69 68 32 71 70 11 73 72 7 75 74 35 77 76 34 79 78 17 81 80 37 83 82 36 85 84 16 87 86 39 89 88 38 91 90 5 93 92 41 96 94 40 98 97 3 43 42 19 45 44 18 48 46 9 50 49 21 52 51 20 54 53 8 56 55 24 58 57 22 60 59 2 62 61 1 27 25 13 10 28 26 6 30 29 4 14 12 0
result:
wrong answer Enemies 96 and 64 are next to each other
Subtask #3:
score: 0
Wrong Answer
Test #12:
score: 29
Accepted
time: 0ms
memory: 3856kb
input:
2 0
output:
1 0
result:
ok correct
Test #13:
score: 0
Wrong Answer
time: 0ms
memory: 3852kb
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:
7 6 5 3 4 1 2 0
result:
wrong answer Enemies 5 and 2 are next to each other
Subtask #4:
score: 0
Skipped
Dependency #1:
0%