QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#667115 | #7158. Carnival General | Warinchai_s# | 100 ✓ | 33ms | 17656kb | C++14 | 1.8kb | 2024-10-22 21:06:42 | 2024-10-22 21:06:56 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int r[1005][1005];
int no[1005][1005];
vector<int>adj[1005];
vector<int>rv[1005];
int in[1005];
int vis[1005];
int bf[1005];
priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>>pq;
int st=0;
int cnt=0;
int n;
void dfs(int u,int p=-1){
for(auto x:adj[u])in[x]--;
bf[u]=p;
st=u;
cnt++;
int mn=1e4,id=-1;
for(auto x:adj[u])if(x!=p)if(!vis[x]&&in[x]<mn)mn=in[x],id=x;
if(id==-1){
assert(cnt==n);
return;
}
vis[id]=1;
dfs(id,u);
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cin>>n;
for(int i=0;i<n;i++){
//cerr<<"i:"<<i<<"\n";
for(int j=0;j<i;j++){
cin>>r[i][j];
if(j>(i-1)/2){
no[i][r[i][j]]=1;
no[r[i][j]][i]=1;
//cerr<<"no:"<<i<<' '<<r[i][j]<<"\n";
}
}
}
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
if(i==j)continue;
if(!no[i][j])adj[i].push_back(j),adj[j].push_back(i),in[j]++,in[i]++;
}
}
for(int i=0;i<n;i++){
pq.push({in[i],i});
}
auto [a,b]=pq.top();
pq.pop();
vis[b]=1;
dfs(b);
int x=0;
vector<int>v;
while(st!=-1){
//cout<<st<<" ";
v.push_back(st);
st=bf[st];
}
assert(v.size()==n);
for(int i=1;i<n-1;i++){
assert(no[v[i]][v[i-1]]==0);
assert(no[v[i-1]][v[i]]==0);
assert(no[v[i+1]][v[i]]==0);
assert(no[v[i]][v[i+1]]==0);
}
assert(no[v[0]][v[1]]==0);
assert(no[v[n-2]][v[n-1]]==0);
map<int,int>mp;
for(auto x:v){
assert(mp[x]==0);
mp[x]++;
}
//assert(0);
for(auto x:v)cout<<x<<" ";
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 11
Accepted
Test #1:
score: 11
Accepted
time: 1ms
memory: 7660kb
input:
2 0
output:
1 0
result:
ok correct
Test #2:
score: 11
Accepted
time: 1ms
memory: 6096kb
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: 26ms
memory: 17568kb
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: 5956kb
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: 1ms
memory: 5876kb
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: 23
Accepted
Test #6:
score: 23
Accepted
time: 1ms
memory: 5856kb
input:
2 0
output:
1 0
result:
ok correct
Test #7:
score: 23
Accepted
time: 1ms
memory: 6120kb
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:
98 48 97 17 96 47 95 7 94 46 93 2 92 45 91 0 90 44 89 16 88 43 87 6 86 42 85 1 84 41 83 15 82 40 81 5 80 39 79 3 78 38 77 14 76 37 75 13 74 36 73 4 72 35 71 12 70 34 69 11 68 33 67 10 66 32 65 9 64 31 63 8 62 30 61 18 60 29 59 19 58 28 57 20 56 27 55 21 54 26 53 22 52 25 51 23 50 24 49
result:
ok correct
Test #8:
score: 23
Accepted
time: 22ms
memory: 16796kb
input:
1000 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 ...
output:
998 285 996 119 994 49 992 20 990 8 988 3 986 1 984 0 982 284 980 118 978 48 976 19 974 7 972 283 970 117 968 47 966 18 964 2 962 282 960 116 958 46 956 17 954 6 952 281 950 115 948 45 946 5 944 280 942 114 940 44 938 16 936 279 934 113 932 43 930 15 928 4 926 278 924 112 922 42 920 277 918 111 916 ...
result:
ok correct
Test #9:
score: 23
Accepted
time: 15ms
memory: 16800kb
input:
999 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:
998 498 997 180 996 497 995 75 994 496 993 31 992 495 991 12 990 494 989 4 988 493 987 1 986 492 985 0 984 491 983 179 982 490 981 74 980 489 979 30 978 488 977 11 976 487 975 3 974 486 973 178 972 485 971 73 970 484 969 29 968 483 967 10 966 482 965 177 964 481 963 72 962 480 961 28 960 479 959 9 9...
result:
ok correct
Test #10:
score: 23
Accepted
time: 0ms
memory: 5684kb
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:
6 2 5 0 7 3 1 4
result:
ok correct
Test #11:
score: 23
Accepted
time: 0ms
memory: 5712kb
input:
5 0 0 1 0 1 2 0 1 2 3
output:
4 1 3 0 2
result:
ok correct
Subtask #3:
score: 29
Accepted
Test #12:
score: 29
Accepted
time: 0ms
memory: 5704kb
input:
2 0
output:
1 0
result:
ok correct
Test #13:
score: 29
Accepted
time: 0ms
memory: 5744kb
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: 29
Accepted
time: 0ms
memory: 5960kb
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:
6 2 5 0 7 3 1 4
result:
ok correct
Test #15:
score: 29
Accepted
time: 0ms
memory: 5680kb
input:
8 0 0 1 0 1 2 2 1 0 3 4 3 0 2 1 4 3 0 5 2 1 6 5 2 1 4 0 3
output:
6 3 0 5 7 1 4 2
result:
ok correct
Test #16:
score: 29
Accepted
time: 0ms
memory: 5888kb
input:
8 0 1 0 0 1 2 3 2 1 0 0 1 2 3 4 5 4 3 2 1 0 0 1 2 3 4 5 6
output:
7 2 1 5 0 3 6 4
result:
ok correct
Test #17:
score: 29
Accepted
time: 0ms
memory: 7940kb
input:
3 0 0 1
output:
2 0 1
result:
ok correct
Test #18:
score: 29
Accepted
time: 1ms
memory: 5720kb
input:
5 0 1 0 0 2 1 1 3 2 0
output:
4 3 2 1 0
result:
ok correct
Test #19:
score: 29
Accepted
time: 1ms
memory: 5736kb
input:
6 0 0 1 0 1 2 0 2 1 3 0 2 3 4 1
output:
4 2 0 5 3 1
result:
ok correct
Test #20:
score: 29
Accepted
time: 0ms
memory: 5700kb
input:
7 0 1 0 2 0 1 2 0 1 3 0 1 4 2 3 3 2 4 0 5 1
output:
6 4 2 3 0 5 1
result:
ok correct
Test #21:
score: 29
Accepted
time: 1ms
memory: 5656kb
input:
8 0 1 0 0 1 2 3 2 0 1 3 1 0 4 2 4 2 0 3 5 1 6 4 3 1 5 2 0
output:
5 3 0 1 7 6 4 2
result:
ok correct
Test #22:
score: 29
Accepted
time: 1ms
memory: 5888kb
input:
8 0 0 1 2 1 0 3 0 2 1 4 0 3 1 2 4 0 2 5 3 1 4 5 1 2 0 6 3
output:
7 5 4 0 6 2 3 1
result:
ok correct
Test #23:
score: 29
Accepted
time: 1ms
memory: 5684kb
input:
8 0 0 1 0 1 2 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 2 0 1
result:
ok correct
Test #24:
score: 29
Accepted
time: 1ms
memory: 5660kb
input:
8 0 1 0 2 1 0 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 2 6 1 5 0 4
result:
ok correct
Test #25:
score: 29
Accepted
time: 1ms
memory: 5660kb
input:
8 0 1 0 1 0 2 1 3 0 2 1 3 0 2 4 1 3 5 0 2 4 1 3 5 0 2 4 6
output:
7 0 5 6 3 4 1 2
result:
ok correct
Test #26:
score: 29
Accepted
time: 1ms
memory: 5956kb
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
Test #27:
score: 29
Accepted
time: 1ms
memory: 5740kb
input:
5 0 0 1 0 1 2 0 1 2 3
output:
4 1 3 0 2
result:
ok correct
Test #28:
score: 29
Accepted
time: 1ms
memory: 5716kb
input:
4 0 1 0 0 2 1
output:
3 2 1 0
result:
ok correct
Subtask #4:
score: 37
Accepted
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Test #29:
score: 37
Accepted
time: 1ms
memory: 5920kb
input:
2 0
output:
1 0
result:
ok correct
Test #30:
score: 37
Accepted
time: 0ms
memory: 6116kb
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 #31:
score: 37
Accepted
time: 26ms
memory: 17528kb
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 #32:
score: 37
Accepted
time: 1ms
memory: 5744kb
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 #33:
score: 37
Accepted
time: 0ms
memory: 8040kb
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:
98 48 97 17 96 47 95 7 94 46 93 2 92 45 91 0 90 44 89 16 88 43 87 6 86 42 85 1 84 41 83 15 82 40 81 5 80 39 79 3 78 38 77 14 76 37 75 13 74 36 73 4 72 35 71 12 70 34 69 11 68 33 67 10 66 32 65 9 64 31 63 8 62 30 61 18 60 29 59 19 58 28 57 20 56 27 55 21 54 26 53 22 52 25 51 23 50 24 49
result:
ok correct
Test #34:
score: 37
Accepted
time: 22ms
memory: 16596kb
input:
1000 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 ...
output:
998 285 996 119 994 49 992 20 990 8 988 3 986 1 984 0 982 284 980 118 978 48 976 19 974 7 972 283 970 117 968 47 966 18 964 2 962 282 960 116 958 46 956 17 954 6 952 281 950 115 948 45 946 5 944 280 942 114 940 44 938 16 936 279 934 113 932 43 930 15 928 4 926 278 924 112 922 42 920 277 918 111 916 ...
result:
ok correct
Test #35:
score: 37
Accepted
time: 18ms
memory: 16672kb
input:
999 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:
998 498 997 180 996 497 995 75 994 496 993 31 992 495 991 12 990 494 989 4 988 493 987 1 986 492 985 0 984 491 983 179 982 490 981 74 980 489 979 30 978 488 977 11 976 487 975 3 974 486 973 178 972 485 971 73 970 484 969 29 968 483 967 10 966 482 965 177 964 481 963 72 962 480 961 28 960 479 959 9 9...
result:
ok correct
Test #36:
score: 37
Accepted
time: 1ms
memory: 5660kb
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:
6 2 5 0 7 3 1 4
result:
ok correct
Test #37:
score: 37
Accepted
time: 1ms
memory: 5916kb
input:
8 0 0 1 0 1 2 2 1 0 3 4 3 0 2 1 4 3 0 5 2 1 6 5 2 1 4 0 3
output:
6 3 0 5 7 1 4 2
result:
ok correct
Test #38:
score: 37
Accepted
time: 1ms
memory: 5916kb
input:
8 0 1 0 0 1 2 3 2 1 0 0 1 2 3 4 5 4 3 2 1 0 0 1 2 3 4 5 6
output:
7 2 1 5 0 3 6 4
result:
ok correct
Test #39:
score: 37
Accepted
time: 1ms
memory: 5936kb
input:
3 0 0 1
output:
2 0 1
result:
ok correct
Test #40:
score: 37
Accepted
time: 1ms
memory: 5768kb
input:
5 0 1 0 0 2 1 1 3 2 0
output:
4 3 2 1 0
result:
ok correct
Test #41:
score: 37
Accepted
time: 1ms
memory: 5656kb
input:
6 0 0 1 0 1 2 0 2 1 3 0 2 3 4 1
output:
4 2 0 5 3 1
result:
ok correct
Test #42:
score: 37
Accepted
time: 1ms
memory: 5744kb
input:
7 0 1 0 2 0 1 2 0 1 3 0 1 4 2 3 3 2 4 0 5 1
output:
6 4 2 3 0 5 1
result:
ok correct
Test #43:
score: 37
Accepted
time: 1ms
memory: 5732kb
input:
8 0 1 0 0 1 2 3 2 0 1 3 1 0 4 2 4 2 0 3 5 1 6 4 3 1 5 2 0
output:
5 3 0 1 7 6 4 2
result:
ok correct
Test #44:
score: 37
Accepted
time: 1ms
memory: 5632kb
input:
8 0 0 1 2 1 0 3 0 2 1 4 0 3 1 2 4 0 2 5 3 1 4 5 1 2 0 6 3
output:
7 5 4 0 6 2 3 1
result:
ok correct
Test #45:
score: 37
Accepted
time: 1ms
memory: 5744kb
input:
8 0 0 1 0 1 2 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 2 0 1
result:
ok correct
Test #46:
score: 37
Accepted
time: 0ms
memory: 5716kb
input:
8 0 1 0 2 1 0 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 2 6 1 5 0 4
result:
ok correct
Test #47:
score: 37
Accepted
time: 1ms
memory: 5724kb
input:
8 0 1 0 1 0 2 1 3 0 2 1 3 0 2 4 1 3 5 0 2 4 1 3 5 0 2 4 6
output:
7 0 5 6 3 4 1 2
result:
ok correct
Test #48:
score: 37
Accepted
time: 28ms
memory: 15368kb
input:
1000 0 1 0 0 1 2 3 2 1 0 0 1 2 3 4 5 4 3 2 1 0 0 1 2 3 4 5 6 7 6 5 4 3 2 1 0 0 1 2 3 4 5 6 7 8 9 8 7 6 5 4 3 2 1 0 0 1 2 3 4 5 6 7 8 9 10 11 10 9 8 7 6 5 4 3 2 1 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 ...
output:
999 334 332 330 328 326 324 322 320 318 316 314 312 310 308 306 304 302 300 298 296 294 292 290 288 286 284 282 280 278 276 274 272 270 268 266 264 262 260 258 256 254 252 250 248 246 244 242 240 238 236 234 232 230 228 226 224 222 997 220 995 218 993 216 991 214 989 212 987 210 985 208 983 206 981 ...
result:
ok correct
Test #49:
score: 37
Accepted
time: 29ms
memory: 16480kb
input:
1000 0 0 1 0 1 2 2 3 0 1 2 0 4 1 3 5 4 1 3 2 0 5 4 2 0 3 6 1 4 5 6 3 2 1 0 7 5 3 4 1 8 2 7 6 0 7 2 8 1 0 5 4 6 9 3 6 7 3 0 1 9 5 10 8 2 4 10 8 0 1 3 2 7 11 4 5 6 9 4 3 11 6 8 9 0 7 10 5 1 2 12 7 2 4 5 6 11 0 8 1 3 13 9 12 10 2 0 3 12 10 5 8 1 4 11 13 9 6 7 14 10 8 5 6 4 3 12 13 15 11 1 0 7 2 14 9 5 ...
output:
971 862 830 720 493 335 241 228 190 135 48 1 878 627 943 759 741 867 472 936 786 315 215 917 518 372 801 259 913 884 742 567 244 356 217 530 960 628 276 543 410 394 761 689 272 819 834 770 734 764 547 513 760 594 533 386 755 316 874 988 825 661 981 666 392 149 746 183 524 479 463 444 261 693 361 806...
result:
ok correct
Test #50:
score: 37
Accepted
time: 1ms
memory: 5720kb
input:
17 0 0 1 2 1 0 2 0 1 3 2 1 3 4 0 3 2 1 5 4 0 2 4 6 1 0 5 3 6 4 1 2 0 5 7 3 2 4 3 8 0 5 1 7 6 7 5 9 4 3 1 8 6 0 2 2 10 6 5 0 8 3 7 1 4 9 5 4 10 6 1 9 0 7 8 2 3 11 6 2 11 12 3 5 7 1 4 10 0 8 9 8 10 4 11 6 3 2 7 9 13 1 5 12 0 3 2 12 14 5 6 4 11 7 1 0 8 10 13 9 9 4 13 7 1 11 12 14 8 2 6 0 15 10 3 5
output:
15 14 11 6 2 3 13 5 12 10 4 8 9 16 7 1 0
result:
ok correct
Test #51:
score: 37
Accepted
time: 2ms
memory: 6772kb
input:
171 0 0 1 1 2 0 2 0 1 3 1 4 2 3 0 5 3 0 1 4 2 6 1 5 4 2 3 0 3 1 5 4 7 2 0 6 8 4 1 6 2 7 5 0 3 3 0 9 8 4 5 6 7 1 2 8 5 2 7 1 9 10 6 0 3 4 7 9 8 2 11 1 10 5 6 3 4 0 4 11 2 8 3 1 7 5 0 9 6 10 12 0 3 13 7 8 6 12 4 2 1 5 10 11 9 6 12 5 9 7 1 14 2 10 8 0 11 3 4 13 2 3 8 9 12 14 7 13 0 10 4 5 6 15 1 11 0 3...
output:
164 119 109 90 81 71 58 50 107 55 18 162 125 116 84 21 96 35 146 129 38 80 105 60 10 97 86 147 56 45 113 170 155 127 37 149 130 104 131 8 5 42 7 145 30 138 144 69 22 118 110 26 31 168 106 136 85 166 25 165 150 41 140 47 43 48 157 111 16 161 92 123 53 39 159 82 108 29 154 158 15 169 70 61 135 124 102...
result:
ok correct
Test #52:
score: 37
Accepted
time: 7ms
memory: 11328kb
input:
412 0 0 1 2 1 0 0 2 3 1 4 0 2 3 1 3 1 2 5 4 0 4 1 0 5 2 6 3 1 4 3 6 2 0 7 5 7 2 0 5 1 6 8 3 4 6 7 4 0 9 8 3 5 2 1 0 9 2 4 10 3 1 5 8 6 7 0 2 9 1 10 5 7 6 8 4 3 11 2 7 12 4 5 11 1 0 6 8 9 3 10 8 13 10 4 2 12 7 9 6 5 1 3 11 0 4 2 8 14 1 6 5 12 0 3 7 13 10 11 9 10 7 8 11 15 12 9 14 4 3 1 0 6 13 2 5 4 1...
output:
407 400 395 329 285 258 236 219 173 301 121 3 243 338 232 187 108 299 231 226 276 209 379 235 164 322 195 66 95 2 371 222 203 398 261 386 323 207 190 393 58 341 297 153 224 194 102 191 337 150 394 363 217 112 242 279 205 109 166 408 355 374 221 48 220 358 307 238 145 353 135 328 47 361 211 158 317 2...
result:
ok correct
Test #53:
score: 37
Accepted
time: 28ms
memory: 16020kb
input:
997 0 1 0 2 0 1 0 3 1 2 3 4 1 2 0 1 2 3 5 4 0 4 0 5 2 3 6 1 3 5 2 7 0 6 1 4 0 2 4 5 3 1 8 6 7 5 2 4 9 1 3 8 6 0 7 1 2 0 5 3 4 9 7 8 10 6 1 10 11 0 8 7 4 5 9 6 3 2 2 6 10 8 7 4 9 0 5 3 12 11 1 7 10 1 13 9 4 2 5 12 0 8 11 3 6 3 10 7 4 13 12 6 2 9 8 14 11 5 0 1 2 7 6 15 3 11 0 14 12 4 9 10 13 1 8 5 7 1...
output:
959 914 854 766 743 719 594 578 433 372 58 736 582 786 732 729 950 897 168 91 888 778 661 371 908 292 253 243 166 982 871 750 180 839 387 965 781 645 923 94 921 428 621 553 401 935 970 785 497 323 266 852 96 724 909 659 50 866 409 989 955 912 745 633 17 57 328 969 919 680 641 614 122 830 9 792 630 7...
result:
ok correct
Test #54:
score: 37
Accepted
time: 33ms
memory: 16360kb
input:
999 0 1 0 0 1 2 3 2 0 1 2 3 4 1 0 1 4 3 0 2 5 5 3 2 1 6 0 4 2 6 3 5 0 4 1 7 4 7 2 3 6 8 5 0 1 6 8 1 0 4 7 3 9 2 5 10 2 8 7 1 3 6 5 4 9 0 5 11 10 3 8 0 2 7 9 6 1 4 8 3 11 4 10 2 7 0 9 5 12 6 1 3 6 7 1 9 10 5 13 11 2 12 8 0 4 1 7 4 3 2 11 8 12 13 0 14 5 6 9 10 3 14 0 13 11 6 2 9 8 1 4 10 7 5 12 15 6 9...
output:
924 858 841 822 751 707 687 663 648 579 412 811 484 845 683 676 597 749 646 622 11 606 596 231 502 190 973 342 516 546 362 343 721 978 889 197 96 903 720 971 526 950 875 812 50 57 828 620 830 537 499 92 587 344 463 795 211 39 953 185 533 288 820 278 276 15 963 754 815 737 681 769 679 74 367 666 381 ...
result:
ok correct
Test #55:
score: 37
Accepted
time: 30ms
memory: 16412kb
input:
1000 0 1 0 0 2 1 1 0 2 3 1 2 4 3 0 4 0 5 2 3 1 2 0 4 6 1 3 5 7 2 5 6 4 0 1 3 3 7 1 8 5 2 0 4 6 7 5 6 1 9 8 3 0 4 2 9 2 0 1 8 6 3 4 7 5 10 1 6 11 3 0 9 7 5 8 2 10 4 2 5 0 3 6 8 1 12 4 9 11 10 7 0 9 12 10 1 5 4 6 3 8 13 11 7 2 1 6 5 8 10 9 12 4 0 2 14 13 7 11 3 14 7 11 10 4 6 3 13 12 8 9 5 2 0 15 1 11...
output:
956 835 804 674 494 303 300 292 282 197 465 912 850 805 253 609 437 248 818 564 845 757 629 865 758 901 78 879 545 806 768 994 874 694 656 510 463 360 365 121 441 280 701 134 741 831 588 453 962 920 794 294 176 891 808 735 751 297 43 909 427 331 117 85 23 462 50 667 575 928 663 354 777 249 22 952 85...
result:
ok correct
Test #56:
score: 37
Accepted
time: 27ms
memory: 17656kb
input:
1000 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 ...
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 #57:
score: 37
Accepted
time: 18ms
memory: 16896kb
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 499 498 998 497 997 496 996 495 995 494 994 493 993 492 992 491 991 490 990 489 989 488 988 487 987 486 986 485 985 484 984 483 983 482 982 481 981 480 980 479 979 478 978 477 977 476 976 475 975 474 974 473 973 472 972 471 971 470 970 469 969 468 968 467 967 466 966 465 965 464 964 463 963 462 ...
result:
ok correct
Test #58:
score: 37
Accepted
time: 22ms
memory: 16644kb
input:
1000 0 1 0 1 0 2 1 3 0 2 1 3 0 2 4 1 3 5 0 2 4 1 3 5 0 2 4 6 1 3 5 7 0 2 4 6 1 3 5 7 0 2 4 6 8 1 3 5 7 9 0 2 4 6 8 1 3 5 7 9 0 2 4 6 8 10 1 3 5 7 9 11 0 2 4 6 8 10 1 3 5 7 9 11 0 2 4 6 8 10 12 1 3 5 7 9 11 13 0 2 4 6 8 10 12 1 3 5 7 9 11 13 0 2 4 6 8 10 12 14 1 3 5 7 9 11 13 15 0 2 4 6 8 10 12 14 1 ...
output:
999 0 997 998 995 996 993 994 991 992 989 990 987 988 985 986 983 984 981 982 979 980 977 978 975 976 973 974 971 972 969 970 967 968 965 966 963 964 961 962 959 960 957 958 955 956 953 954 951 952 949 950 947 948 945 946 943 944 941 942 939 940 937 938 935 936 933 934 931 932 929 930 927 928 925 92...
result:
ok correct
Test #59:
score: 37
Accepted
time: 1ms
memory: 5648kb
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
Test #60:
score: 37
Accepted
time: 1ms
memory: 5708kb
input:
5 0 0 1 0 1 2 0 1 2 3
output:
4 1 3 0 2
result:
ok correct
Test #61:
score: 37
Accepted
time: 1ms
memory: 5664kb
input:
4 0 1 0 0 2 1
output:
3 2 1 0
result:
ok correct
Extra Test:
score: 0
Extra Test Passed