#include "doll.h"
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define all(x) x.begin(),x.end()
typedef long long ll;
#define INF 99999999999999
#define pb push_back
void create_circuit(int M, std::vector<int> A) {
int N = A.size()+1;
A.pb(0);
vector<int> C(M + 1);
vector<vector<int>>vis(M+1);
vector<int>sw(M+1,0);
ll idx=0;
vector<int> X, Y;
C[0]=A[0];
for(int i=0;i<N-1;i++)
vis[A[i]].pb(i);
for(int i=1;i<=M;i++)
{
if(!vis[i].size())
continue;
if(vis[i].size()==1)
{
C[A[i]]=A[vis[i][0]+1];
continue;
}
if(vis[i].size()==2)
{
C[A[i]]=-(idx+1);
X.pb(A[vis[i][0]+1]);
Y.pb(A[vis[i][1]+1]);
idx++;
continue;
}
if(vis[i].size()==3)
{
C[A[i]]=-(idx+1);
X.pb(-(idx+2));
Y.pb(-(idx+3));
X.pb(A[vis[i][0]+1]);
Y.pb(-(idx+1));
X.pb(A[vis[i][1]+1]);
Y.pb(A[vis[i][2]+1]);
idx+=3;
continue;
}
C[A[i]]=-(idx+1);
X.pb(-(idx+2));
Y.pb(-(idx+3));
X.pb(A[vis[i][0]+1]);
Y.pb(A[vis[i][2]+1]);
X.pb(A[vis[i][1]+1]);
Y.pb(A[vis[i][3]+1]);
idx+=3;
}
answer(C, X, Y);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |