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 mp make_pair
#define INF 10000000
#define MOD 1000000007
#define MID ((l+r)/2)
#define HASHMOD 2305843009213693951
#define ll long long
#define ull unsigned long long
#define F first
#define S second
typedef pair<ll, ll> ii;
typedef pair<ii, int> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef map<int, int> mii;
#define EPS 1e-6
#define FOR(i,n) for(int i=0;i<((int)(n));i++)
#define FORi(i,a,b) for(int i=((int)(a));i<((int)(b));i++)
#define FOA(v, a) for(auto v : a)
int s=0, n;
int cnt[1000000];
vector<vi> nxt;
vector<int> C, X, Y;
void create_circuit(int M, std::vector<int> A) {
n = A.size();
FOR(i,n+1) cnt[i] = 0;
nxt.assign(M+1, vi());
C.assign(M+1, 0);
nxt[0].push_back(A[0]);
FORi(i,1,n) nxt[A[i-1]].push_back(A[i]);
nxt[A[n-1]].push_back(0);
FOR(x,M+1){
int q = nxt[x].size();
if(q==1){
C[x] = nxt[x][0];
}
else if(q==2){
C[x] = -(++s);
X.push_back(nxt[x][0]);
Y.push_back(nxt[x][1]);
}
else if(q==3){
C[x] = -(++s);
X.push_back(-(++s));
X.push_back(nxt[x][0]);
Y.push_back(nxt[x][2]);
Y.push_back(nxt[x][1]);
}
else if(q==4){
C[x] = -(++s);
X.push_back(-(++s));
Y.push_back(-(++s));
X.push_back(nxt[x][0]);
Y.push_back(nxt[x][2]);
X.push_back(nxt[x][1]);
Y.push_back(nxt[x][3]);
}
}
#ifdef LOCAL
FOA(v,C) cout<<v<<" ";
cout<<endl;
FOA(v,X) cout<<v<<" ";
cout<<endl;
FOA(v,Y) cout<<v<<" ";
cout<<endl;
#endif
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... |