QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#671705#7158. Carnival Generalnjoop0 1ms3672kbC++17822b2024-10-24 14:08:172024-10-24 14:08:19

Judging History

你现在查看的是最新测评结果

  • [2024-10-24 14:08:19]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:3672kb
  • [2024-10-24 14:08:17]
  • 提交

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%