This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
typedef pair<ll,ll> pii;
const ll MAXN = 2e5+5;
const ll INF = 1e9+7;
void create_circuit(int M, std::vector<int> A) {
int n = A.size(),k,S=-1,i;
vector<vector<int>>adj(M+5);
std::vector<int> X, Y;
std::vector<int> C(M + 1);
C[0]=A[0];
for(i=0;i<n-1;i++){
//C[A[i]]=A[i+1];
adj[A[i]].pb(A[i+1]);
}
adj[A[n-1]].pb(0);
for(i=1;i<=M;i++){
k=adj[i].size();
if(k==1){
C[i]=adj[i][0];
}else if(k==2){
C[i]=S;
X.pb(adj[i][0]);
Y.pb(adj[i][1]);
S--;
}else if(k==3){
C[i]=S;
X.pb(S-1);
Y.pb(S-2);
S--;
X.pb(adj[i][0]);
Y.pb(adj[i][2]);
S--;
X.pb(adj[i][1]);
Y.pb(-C[i]-1);
S--;
}else if(k==4){
C[i]=S;
X.pb(S-1);
Y.pb(S-2);
S--;
X.pb(adj[i][0]);
Y.pb(adj[i][2]);
S--;
X.pb(adj[i][1]);
Y.pb(adj[i][3]);
S--;
}
}
answer(C, X, Y);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |