#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<pair<int,int>> nxt(m+1, {-1, -1});
arr.push_back(0);
for (int i = 0; i < n; i++) {
if (nxt[arr[i]].first!=-1) {
nxt[arr[i]].second = arr[i+1];
} else nxt[arr[i]].first = arr[i+1];
}
for (int i = 1; i <= m; i++) {
if (nxt[i].first == -1) {
c[i] = 0;
} else if (nxt[i].second == -1) {
c[i] = nxt[i].first;
} else {
c[i] = add(nxt[i].first, nxt[i].second);
}
}
c[0] = arr[0];
answer(c, x, y);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
19 ms |
2896 KB |
Output is correct |
3 |
Correct |
15 ms |
2252 KB |
Output is correct |
4 |
Correct |
1 ms |
300 KB |
Output is correct |
5 |
Correct |
9 ms |
2260 KB |
Output is correct |
6 |
Correct |
21 ms |
3160 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
19 ms |
2896 KB |
Output is correct |
3 |
Correct |
15 ms |
2252 KB |
Output is correct |
4 |
Correct |
1 ms |
300 KB |
Output is correct |
5 |
Correct |
9 ms |
2260 KB |
Output is correct |
6 |
Correct |
21 ms |
3160 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
35 ms |
4432 KB |
Output is correct |
9 |
Correct |
32 ms |
5192 KB |
Output is correct |
10 |
Correct |
56 ms |
8032 KB |
Output is correct |
11 |
Correct |
0 ms |
300 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
19 ms |
2896 KB |
Output is correct |
3 |
Correct |
15 ms |
2252 KB |
Output is correct |
4 |
Correct |
1 ms |
300 KB |
Output is correct |
5 |
Correct |
9 ms |
2260 KB |
Output is correct |
6 |
Correct |
21 ms |
3160 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
35 ms |
4432 KB |
Output is correct |
9 |
Correct |
32 ms |
5192 KB |
Output is correct |
10 |
Correct |
56 ms |
8032 KB |
Output is correct |
11 |
Correct |
0 ms |
300 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Incorrect |
42 ms |
6436 KB |
wrong motion |
15 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |