| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1354908 | hsuan._.0528 | Carnival (EGOI23_carnival) | C++20 | 19 ms | 4464 KiB |
//pa
#include<bits/stdc++.h>
using namespace std;
#define LL long long
const int maxn = 1000 + 10;
int n;
int a[maxn][maxn];
vector<int> v, temp;
signed main(){
ios_base::sync_with_stdio(0); cin.tie(0);
cin>>n;
for(int i=0; i<n; i++){
for(int j=0; j<i; j++){
int aa; cin>>aa;
if((j+1) <= (i+1)/2){
a[i][aa]=a[aa][i]=1;
}
}
}
v.push_back(0); v.push_back(1);
for(int i=2; i<n; i++){
temp.clear();
int j=0;
if(a[i][ v[0] ]) temp.push_back(i);
else{
temp.push_back(v[j]);
for(j=1; j<i; j++){
if(a[i][ v[j-1] ] and a[i][ v[j] ]){
temp.push_back(i);
break;
}
temp.push_back(v[j]);
}
if(j==i) temp.push_back(i);
}
for(; j<i; j++){
temp.push_back(v[j]);
}
v=temp;
}
for(int i: v) cout<<i<<" ";
}| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
