QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#667263 | #7158. Carnival General | spycoderyt# | 11 | 72ms | 3792kb | C++14 | 856b | 2024-10-22 21:56:42 | 2024-10-22 21:56:50 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,x;
cin>>n;
vector<int > v;
v.push_back(0);
for(int i = 1;i<n;i++) {
set<int> tmp;
for(int j = 0;j<i;j++) {
cin>>x;
if(j>(i-1)/2)tmp.insert(x);
}
// cerr << i << "\n";
// for(auto e : tmp)cerr<<e<<" ";
// cerr<<"\n";
if(tmp.find(v[0]) == tmp.end()) v.insert(v.begin(),i);
else if (tmp.find(v[v.size()-1]) == tmp.end()) v.insert(v.begin()+v.size(),i);
else {
for(int j = 1;j+1<v.size();j++) {
if(tmp.find(v[i]) == tmp.end() && tmp.find(v[i+1]) == tmp.end()) {
v.insert(v.begin() + j + 1, i);
break;
}
}
}
}
for(auto e : v)cout<<e<< " ";
}
详细
Subtask #1:
score: 11
Accepted
Test #1:
score: 11
Accepted
time: 0ms
memory: 3588kb
input:
2 0
output:
1 0
result:
ok correct
Test #2:
score: 11
Accepted
time: 1ms
memory: 3600kb
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: 72ms
memory: 3604kb
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: 0ms
memory: 3764kb
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: 3600kb
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: 3572kb
input:
2 0
output:
1 0
result:
ok correct
Test #7:
score: 0
Wrong Answer
time: 1ms
memory: 3584kb
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:
63 31 98 97 96 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 15 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 7 30 29 28 27 26 25 24 22 21 20 19 18 17 16 3 14 13 12 10 9 8 1 6 4 0 2 5 11 23 47 95
result:
wrong answer Enemies 99 and 98 are next to each other
Subtask #3:
score: 0
Wrong Answer
Test #12:
score: 29
Accepted
time: 0ms
memory: 3792kb
input:
2 0
output:
1 0
result:
ok correct
Test #13:
score: 29
Accepted
time: 0ms
memory: 3732kb
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: 3568kb
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:
7 3 1 6 4 0 2 5
result:
wrong answer Enemies 7 and 5 are next to each other
Subtask #4:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
0%