#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
#define SIZE(x) (int)x.size()
void create_circuit(int M, vector<int> A) {
int N = SIZE(A);
vector <int> C(M+1);
vector <int> X, Y;
if (M == 1) {
X.resize(N-1);
Y.resize(N-1);
C[0] = 1;
if (N == 1) {
C[1] = 0;
answer(C,X,Y);
return;
}
if (N == 2) {
C[1] = -1;
X[0] = 1;
Y[0] = 0;
answer(C,X,Y);
return;
}
C[1] = -1;
X[0] = 1;
Y[0] = -2;
for (int i=1; i<N-2; i++) {
X[i] = -i;
Y[i] = -i-2;
//cerr << X[i] << ' ' << Y[i] << endl;
}
X[N-2] = -N+2;
Y[N-2] = 0;
} else {
A.push_back(0);
map <int, vector <int>> next;
for (int i=0; i<N; i++) {
next[A[i]].push_back(A[i+1]);
//Scerr << A[i] << ' ' << A[i+1] << endl;
}
C[0] = A[0];
int j = 0;
for (auto &x:next) {
int a = x.first;
vector <int> n = x.second;
int S = SIZE(n);
if (S == 1) {
C[a] = n[0];
continue;
}
C[a] = --j;
for (int i=0; i<S-2; i++) {
X.push_back(n[i]);
Y.push_back(--j);
}
X.push_back(n[S-2]);
Y.push_back(n[S-1]);
}
}
/*for (int i=0; i<=M; i++) {
cerr << C[i] << " ";
}
cerr << endl;*/
answer(C, X, Y);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
36 ms |
8384 KB |
Output is correct |
3 |
Correct |
33 ms |
8192 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
7 ms |
1364 KB |
Output is correct |
6 |
Correct |
56 ms |
12364 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
36 ms |
8384 KB |
Output is correct |
3 |
Correct |
33 ms |
8192 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
7 ms |
1364 KB |
Output is correct |
6 |
Correct |
56 ms |
12364 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
60 ms |
10024 KB |
Output is correct |
9 |
Correct |
69 ms |
12152 KB |
Output is correct |
10 |
Correct |
118 ms |
15148 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
36 ms |
8384 KB |
Output is correct |
3 |
Correct |
33 ms |
8192 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
7 ms |
1364 KB |
Output is correct |
6 |
Correct |
56 ms |
12364 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
60 ms |
10024 KB |
Output is correct |
9 |
Correct |
69 ms |
12152 KB |
Output is correct |
10 |
Correct |
118 ms |
15148 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
0 ms |
212 KB |
Output is correct |
14 |
Incorrect |
100 ms |
11852 KB |
wrong motion |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
240 KB |
Output is correct |
2 |
Incorrect |
26 ms |
4436 KB |
over 20000000 inversions |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
240 KB |
Output is correct |
2 |
Incorrect |
26 ms |
4436 KB |
over 20000000 inversions |
3 |
Halted |
0 ms |
0 KB |
- |