#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();
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;i++)
vis[A[i]].pb(i);
for(int i=1;i<=M;i++)
{
if(!vis[i].size())
continue;
if(vis[i].size()==1)
{
C[i]=A[vis[i][0]+1];
continue;
}
if(vis[i].size()==2)
{
C[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[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[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 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
20 ms |
6980 KB |
Output is correct |
3 |
Correct |
16 ms |
5584 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
8 ms |
4180 KB |
Output is correct |
6 |
Correct |
26 ms |
8340 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
20 ms |
6980 KB |
Output is correct |
3 |
Correct |
16 ms |
5584 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
8 ms |
4180 KB |
Output is correct |
6 |
Correct |
26 ms |
8340 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
40 ms |
7800 KB |
Output is correct |
9 |
Correct |
36 ms |
9228 KB |
Output is correct |
10 |
Correct |
57 ms |
11932 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
300 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
20 ms |
6980 KB |
Output is correct |
3 |
Correct |
16 ms |
5584 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
8 ms |
4180 KB |
Output is correct |
6 |
Correct |
26 ms |
8340 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
40 ms |
7800 KB |
Output is correct |
9 |
Correct |
36 ms |
9228 KB |
Output is correct |
10 |
Correct |
57 ms |
11932 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
300 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
63 ms |
11448 KB |
Output is correct |
15 |
Correct |
39 ms |
7240 KB |
Output is correct |
16 |
Correct |
53 ms |
10280 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
0 ms |
212 KB |
Output is correct |
20 |
Correct |
55 ms |
12396 KB |
Output is correct |
21 |
Correct |
0 ms |
212 KB |
Output is correct |
22 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
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 |
- |