#include<bits/stdc++.h>
#include "doll.h"
using namespace std;
using ll = long long;
void create_circuit(int m, std::vector<int> arr) {
vector<int> c(m+1);
vector<int> x, y;
auto add = [&](int a, int b){
x.push_back(a), y.push_back(b);
return -(int)x.size();
};
int n = arr.size();
vector<vector<int>> nxt(m+1);
arr.push_back(0);
for (int i = 0; i < n; i++) {
nxt[arr[i]].push_back(arr[i+1]);
}
for (int i = 1; i <= m; i++) {
if (nxt[i].empty()) {
c[i] = 0;
} else if (nxt[i].size() == 1) {
c[i] = nxt[i][0];
} else if (nxt[i].size() == 2) {
c[i] = add(nxt[i][0], nxt[i][1]);
} else if (nxt[i].size() == 4) {
c[i] = add(
add(nxt[i][0], nxt[i][1]),
add(nxt[i][2], nxt[i][3]));
} else if (nxt[i].size() == 3) {
int t1 = add(0, nxt[i][1]);
int t2 = add(nxt[i][0], nxt[i][2]);
int t3 = c[i] = add(t1, t2);
end(x)[-3] = t3;
}
}
c[0] = arr[0];
answer(c, x, y);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
31 ms |
6832 KB |
Output is correct |
3 |
Correct |
26 ms |
5628 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
10 ms |
3796 KB |
Output is correct |
6 |
Correct |
38 ms |
8348 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
31 ms |
6832 KB |
Output is correct |
3 |
Correct |
26 ms |
5628 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
10 ms |
3796 KB |
Output is correct |
6 |
Correct |
38 ms |
8348 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
44 ms |
8220 KB |
Output is correct |
9 |
Correct |
52 ms |
9532 KB |
Output is correct |
10 |
Correct |
81 ms |
12720 KB |
Output is correct |
11 |
Correct |
1 ms |
300 KB |
Output is correct |
12 |
Correct |
1 ms |
300 KB |
Output is correct |
13 |
Correct |
1 ms |
296 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
31 ms |
6832 KB |
Output is correct |
3 |
Correct |
26 ms |
5628 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
10 ms |
3796 KB |
Output is correct |
6 |
Correct |
38 ms |
8348 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
44 ms |
8220 KB |
Output is correct |
9 |
Correct |
52 ms |
9532 KB |
Output is correct |
10 |
Correct |
81 ms |
12720 KB |
Output is correct |
11 |
Correct |
1 ms |
300 KB |
Output is correct |
12 |
Correct |
1 ms |
300 KB |
Output is correct |
13 |
Correct |
1 ms |
296 KB |
Output is correct |
14 |
Correct |
81 ms |
12420 KB |
Output is correct |
15 |
Incorrect |
41 ms |
6944 KB |
wrong motion |
16 |
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 |
1 ms |
212 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |