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;
typedef long long ll;
typedef vector<int>vi;
#define pb push_back
#define all(x) begin(x),end(x)
#define sz(v) (int)v.size()
#define FOR(i,a,b) for(int i=a; i<b; i++)
#define ROF(i,a,b) for(int i=b-1; i>=a; i--)
//------------------------------------------
int N;
void create_circuit(int M, vi a) {
N=sz(a);
vi adj[M+1];
adj[0].pb(a[0]);
FOR(i,0,N){
if(i==N-1) adj[a[i]].pb(0);
else adj[a[i]].pb(a[i+1]);
}
int cnt=0;
vi ans(M+1),X,Y;
FOR(i,0,M+1) if(sz(adj[i])){
int n=sz(adj[i]);
vi vec=adj[i];
if(n==1){
ans[i]=vec[0];
}
else if(n==2){
cnt++;
ans[i]=-cnt;
X.pb(vec[0]);
Y.pb(vec[1]);
}
else if(n==3){
cnt++;
ans[i]=-cnt;
X.pb(-(cnt+1));
Y.pb(-(cnt+2));
X.pb(vec[0]);
Y.pb(-cnt);
X.pb(vec[1]);
Y.pb(vec[2]);
cnt+=2;
}
else if(n==4){
cnt++;
ans[i]=-cnt;
X.pb(-(cnt+1));
Y.pb(-(cnt+2));
X.pb(vec[0]);
Y.pb(vec[2]);
X.pb(vec[1]);
Y.pb(vec[3]);
cnt+=2;
}
}
answer(ans,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... |