#include <bits/stdc++.h>
#include "doll.h"
using namespace std;
const int MAX_M = 1e5 + 5;
int N, M, S;
set <int> keepnxt[MAX_M];
vector <int> nxt[MAX_M];
vector<int> C, X, Y;
void create_circuit(int m, vector <int> A) {
N = A.size(), M = m;
C.resize(M + 1);
A.push_back(0);
for(int i = 0; i < N; i++) {
if(keepnxt[A[i]].count(A[i + 1])) {
continue;
}
keepnxt[A[i]].insert(A[i + 1]);
nxt[A[i]].push_back(A[i + 1]);
}
C[0] = A[0];
for(int i = 0; i < N; i++) {
if(nxt[A[i]].empty()) {
continue;
}
else if(nxt[A[i]].size() == 1) {
C[A[i]] = A[i + 1];
}
else {
S++;
C[A[i]] = -S;
if(nxt[A[i]].size() == 2) {
X.push_back(nxt[A[i]][0]);
Y.push_back(nxt[A[i]][1]);
}
else if(nxt[A[i]].size() == 3) {
int now = S;
S += 2;
X.push_back(-now - 1);
Y.push_back(-now - 2);
X.push_back(nxt[A[i]][0]);
Y.push_back(-now);
X.push_back(nxt[A[i]][1]);
Y.push_back(nxt[A[i]][2]);
}
else if(nxt[A[i]].size() == 4) {
int now = S;
S += 2;
X.push_back(-now - 1);
Y.push_back(-now - 2);
X.push_back(nxt[A[i]][0]);
X.push_back(nxt[A[i]][1]);
Y.push_back(nxt[A[i]][2]);
Y.push_back(nxt[A[i]][3]);
}
}
}
answer(C, X, Y);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
7252 KB |
Output is correct |
2 |
Correct |
80 ms |
14588 KB |
Output is correct |
3 |
Correct |
52 ms |
14368 KB |
Output is correct |
4 |
Correct |
6 ms |
7352 KB |
Output is correct |
5 |
Correct |
13 ms |
8544 KB |
Output is correct |
6 |
Correct |
56 ms |
17920 KB |
Output is correct |
7 |
Correct |
4 ms |
7252 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
7252 KB |
Output is correct |
2 |
Correct |
80 ms |
14588 KB |
Output is correct |
3 |
Correct |
52 ms |
14368 KB |
Output is correct |
4 |
Correct |
6 ms |
7352 KB |
Output is correct |
5 |
Correct |
13 ms |
8544 KB |
Output is correct |
6 |
Correct |
56 ms |
17920 KB |
Output is correct |
7 |
Correct |
4 ms |
7252 KB |
Output is correct |
8 |
Correct |
106 ms |
22876 KB |
Output is correct |
9 |
Correct |
116 ms |
22596 KB |
Output is correct |
10 |
Correct |
171 ms |
31128 KB |
Output is correct |
11 |
Correct |
4 ms |
7252 KB |
Output is correct |
12 |
Correct |
5 ms |
7252 KB |
Output is correct |
13 |
Correct |
4 ms |
7348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
7252 KB |
Output is correct |
2 |
Correct |
80 ms |
14588 KB |
Output is correct |
3 |
Correct |
52 ms |
14368 KB |
Output is correct |
4 |
Correct |
6 ms |
7352 KB |
Output is correct |
5 |
Correct |
13 ms |
8544 KB |
Output is correct |
6 |
Correct |
56 ms |
17920 KB |
Output is correct |
7 |
Correct |
4 ms |
7252 KB |
Output is correct |
8 |
Correct |
106 ms |
22876 KB |
Output is correct |
9 |
Correct |
116 ms |
22596 KB |
Output is correct |
10 |
Correct |
171 ms |
31128 KB |
Output is correct |
11 |
Correct |
4 ms |
7252 KB |
Output is correct |
12 |
Correct |
5 ms |
7252 KB |
Output is correct |
13 |
Correct |
4 ms |
7348 KB |
Output is correct |
14 |
Incorrect |
282 ms |
40812 KB |
over 400000 switches |
15 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
7296 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
7252 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
7252 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |