#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define pf push_front
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),ra.end()
#define sz(a) a.size()
void create_circuit(int M, vector<int> A) {
int N = A.size();
vector<int> C(M + 1,0);
vector<int> adj[M+1];
for(int i=1;i<N;i++){
adj[A[i-1]].pb(A[i]);
}
adj[A[N-1]].pb(0);
for(int i=0;i<=M;i++){
if(adj[i].empty()) adj[i].pb(0);
}
C[0]=A[0];
int k=-1;
vector<int> X, Y;
for (int i = 1; i <= M; i++) {
if(sz(adj[i])==2){
C[i]=k;
k--;
X.pb(adj[i][0]);
Y.pb(adj[i][1]);
}else C[i]=adj[i][0];
}
// for(int i=0;i<=M;i++){
// for(int j=0;j<sz(adj[i]);j++){
// cout<<adj[i][j]<<" ";
// }
// cout<<endl;
// }
// for (int k = 0; k < N; ++k) {
// X[k] = Y[k] = A[k];
// }
answer(C, X, Y);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
24 ms |
7380 KB |
Output is correct |
3 |
Correct |
19 ms |
5588 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
14 ms |
6868 KB |
Output is correct |
6 |
Correct |
29 ms |
8404 KB |
Output is correct |
7 |
Correct |
0 ms |
216 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
24 ms |
7380 KB |
Output is correct |
3 |
Correct |
19 ms |
5588 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
14 ms |
6868 KB |
Output is correct |
6 |
Correct |
29 ms |
8404 KB |
Output is correct |
7 |
Correct |
0 ms |
216 KB |
Output is correct |
8 |
Correct |
45 ms |
8136 KB |
Output is correct |
9 |
Correct |
62 ms |
9944 KB |
Output is correct |
10 |
Correct |
62 ms |
12448 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
24 ms |
7380 KB |
Output is correct |
3 |
Correct |
19 ms |
5588 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
14 ms |
6868 KB |
Output is correct |
6 |
Correct |
29 ms |
8404 KB |
Output is correct |
7 |
Correct |
0 ms |
216 KB |
Output is correct |
8 |
Correct |
45 ms |
8136 KB |
Output is correct |
9 |
Correct |
62 ms |
9944 KB |
Output is correct |
10 |
Correct |
62 ms |
12448 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Incorrect |
46 ms |
7596 KB |
wrong motion |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |