QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#671705 | #7158. Carnival General | njoop | 0 | 1ms | 3672kb | C++17 | 822b | 2024-10-24 14:08:17 | 2024-10-24 14:08:19 |
answer
#include <bits/stdc++.h>
using namespace std;
int n, in;
bool arr[1010][1010];
vector<int> ans;
int main() {
cin >> n;
for(int i=1; i<n; i++) {
for(int j=0; j<i; j++) {
cin >> in;
if(j <= i/2) arr[i+1][in] = 1;
}
}
ans.push_back(0);
for(int i=1; i<n; i++) {
if(arr[i][ans[0]]) {
ans.insert(ans.begin(), i);
goto cont;
}
for(int j=0; j<i-2; j++) {
if(arr[i][ans[j]] && arr[i][ans[j+1]]) {
ans.insert(ans.begin()+j+1, i);
goto cont;
}
}
if(arr[i][ans[i-1]]) {
ans.insert(ans.begin()+i-1, i);
}
cont:;
}
for(int i: ans) {
cout << i << " ";
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3672kb
input:
2 0
output:
0
result:
wrong output format Unexpected end of file - int32 expected
Subtask #2:
score: 0
Wrong Answer
Test #6:
score: 0
Wrong Answer
time: 1ms
memory: 3596kb
input:
2 0
output:
0
result:
wrong output format Unexpected end of file - int32 expected
Subtask #3:
score: 0
Wrong Answer
Test #12:
score: 0
Wrong Answer
time: 1ms
memory: 3604kb
input:
2 0
output:
0
result:
wrong output format Unexpected end of file - int32 expected
Subtask #4:
score: 0
Skipped
Dependency #1:
0%