QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#671502 | #7158. Carnival General | njoop | 11 | 56ms | 4532kb | C++17 | 818b | 2024-10-24 12:55:27 | 2024-10-24 12:55:29 |
Judging History
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=0; i<n; i++) {
for(int j=0; j<i; j++) {
cin >> in;
if(j <= i/2) arr[i][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-1; 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, i);
}
cont:;
}
for(int i: ans) {
cout << i << " ";
}
return 0;
}
詳細信息
Subtask #1:
score: 11
Accepted
Test #1:
score: 11
Accepted
time: 1ms
memory: 3684kb
input:
2 0
output:
1 0
result:
ok correct
Test #2:
score: 11
Accepted
time: 1ms
memory: 3652kb
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 4 3 2 1 0
result:
ok correct
Test #3:
score: 11
Accepted
time: 56ms
memory: 4532kb
input:
1000 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...
output:
999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 970 969 968 967 966 965 964 963 962 961 960 959 958 957 956 955 954 953 952 951 950 949 948 947 946 945 944 943 942 941 940 939 938 937 936 935 934 933 932 931 930 929 928 927 926 925 ...
result:
ok correct
Test #4:
score: 11
Accepted
time: 1ms
memory: 3684kb
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 4 3 2 1 0
result:
ok correct
Test #5:
score: 11
Accepted
time: 0ms
memory: 3548kb
input:
6 0 1 0 2 1 0 3 2 1 0 4 3 2 1 0
output:
5 4 3 2 1 0
result:
ok correct
Subtask #2:
score: 0
Wrong Answer
Test #6:
score: 23
Accepted
time: 0ms
memory: 3616kb
input:
2 0
output:
1 0
result:
ok correct
Test #7:
score: 0
Wrong Answer
time: 1ms
memory: 3636kb
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:
64 32 65 16 66 33 67 8 68 34 69 17 70 35 71 4 72 36 73 18 74 37 75 9 76 38 77 19 78 39 79 2 80 40 81 20 82 41 83 10 84 42 85 21 86 43 87 5 88 44 89 22 90 45 91 11 92 46 93 23 94 47 95 1 96 48 97 24 98 49 12 50 25 51 6 52 26 53 13 54 27 55 3 56 28 57 14 58 29 59 7 60 30 61 15 62 31 63 0
result:
wrong answer Enemies 65 and 33 are next to each other
Subtask #3:
score: 0
Wrong Answer
Test #12:
score: 29
Accepted
time: 0ms
memory: 3540kb
input:
2 0
output:
1 0
result:
ok correct
Test #13:
score: 29
Accepted
time: 0ms
memory: 3548kb
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 4 3 2 1 0
result:
ok correct
Test #14:
score: 0
Wrong Answer
time: 0ms
memory: 3656kb
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:
4 2 5 1 6 3 7 0
result:
wrong answer Enemies 5 and 3 are next to each other
Subtask #4:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
0%