#include "doll.h"
#include "bits/stdc++.h"
using namespace std;
void create_circuit(int M, vector<int> A){
int n = A.size();
map<int, int> Mapa;
bool _1 = 1, _2 = 1;
for(int i = 0; i < n; i++){
Mapa[A[i]]++;
if(Mapa[A[i]] > 1) _1 = 0;
if(Mapa[A[i]] > 2) _2 = 0;
}
vector<int> c(M + 1, 0), x, y;
if(_1){
for(int i = 0; i < n; i++){
if(i == 0){
c[0] = A[i];
} else {
c[A[i - 1]] = A[i];
}
}
} else if(_2){
vector<bool> Usados(M + 1, 0);
int j = -1;
A.push_back(0);
for(int i = 0; i <= n; i++){
if(i == 0){
c[0] = A[i];
} else {
if(Usados[A[i - 1]]){
x.push_back(c[A[i - 1]]);
c[A[i - 1]] = j;
j--;
y.push_back(A[i]);
} else {
c[A[i - 1]] = A[i];
Usados[A[i - 1]] = 1;
}
}
}
}
answer(c, x, y);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
37 ms |
5096 KB |
Output is correct |
3 |
Correct |
37 ms |
4692 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
6 ms |
1372 KB |
Output is correct |
6 |
Correct |
66 ms |
6896 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
37 ms |
5096 KB |
Output is correct |
3 |
Correct |
37 ms |
4692 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
6 ms |
1372 KB |
Output is correct |
6 |
Correct |
66 ms |
6896 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
71 ms |
7296 KB |
Output is correct |
9 |
Correct |
91 ms |
8724 KB |
Output is correct |
10 |
Correct |
115 ms |
12664 KB |
Output is correct |
11 |
Correct |
0 ms |
344 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
37 ms |
5096 KB |
Output is correct |
3 |
Correct |
37 ms |
4692 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
6 ms |
1372 KB |
Output is correct |
6 |
Correct |
66 ms |
6896 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
71 ms |
7296 KB |
Output is correct |
9 |
Correct |
91 ms |
8724 KB |
Output is correct |
10 |
Correct |
115 ms |
12664 KB |
Output is correct |
11 |
Correct |
0 ms |
344 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Incorrect |
98 ms |
7152 KB |
wrong motion |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 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 |
- |