#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long double ld;
typedef vector<vector<ll>> vll;
#define FOR(i, a, b) for(int i = a; i < b; i++)
#define ROF(i, a, b) for(int i = a; i >= b; i--)
#define pb push_back
#define ms memset
#define fi first
#define se second
void create_circuit(int M, vi A) {
int N = A.size();
vi C(M + 1);
C[0] = A[0];
vi nxt[M+1];
FOR(i,0,N-1){
nxt[A[i]].pb(A[i+1]);
}
nxt[A[N-1]].pb(0);
int cur = 1; vi X,Y;
FOR(i,1,M+1){
if (nxt[i].size()==1) C[i] = nxt[i][0];
if (nxt[i].size()==2){
C[i] = -cur; cur++;
X.pb(nxt[i][0]); Y.pb(nxt[i][1]);
}
if (nxt[i].size()==3){
C[i] = -cur;
X.pb(-cur-1); Y.pb(-cur-2);
X.pb(nxt[i][0]); Y.pb(-cur);
X.pb(nxt[i][1]); Y.pb(nxt[i][2]);
cur += 3;
}
if (nxt[i].size()==4){
C[i] = -cur;
X.pb(-cur-1); Y.pb(-cur-2);
X.pb(nxt[i][0]); Y.pb(nxt[i][2]);
X.pb(nxt[i][1]); Y.pb(nxt[i][3]);
cur+=3;
}
}
answer(C, X, Y);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
22 ms |
6488 KB |
Output is correct |
3 |
Correct |
16 ms |
5212 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
9 ms |
3932 KB |
Output is correct |
6 |
Correct |
24 ms |
7772 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
22 ms |
6488 KB |
Output is correct |
3 |
Correct |
16 ms |
5212 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
9 ms |
3932 KB |
Output is correct |
6 |
Correct |
24 ms |
7772 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
39 ms |
7392 KB |
Output is correct |
9 |
Correct |
34 ms |
8916 KB |
Output is correct |
10 |
Correct |
49 ms |
11212 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
22 ms |
6488 KB |
Output is correct |
3 |
Correct |
16 ms |
5212 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
9 ms |
3932 KB |
Output is correct |
6 |
Correct |
24 ms |
7772 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
39 ms |
7392 KB |
Output is correct |
9 |
Correct |
34 ms |
8916 KB |
Output is correct |
10 |
Correct |
49 ms |
11212 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
61 ms |
11032 KB |
Output is correct |
15 |
Correct |
33 ms |
5836 KB |
Output is correct |
16 |
Correct |
51 ms |
10124 KB |
Output is correct |
17 |
Correct |
1 ms |
344 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
60 ms |
12232 KB |
Output is correct |
21 |
Correct |
1 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |