#ifdef NYAOWO
#include "grader.cpp"
#define OUT_VEC(x) { cout << #x << ":"; { for(auto &IT:x) cout << " " << IT; } cout << "\n"; }
#else
#define OUT_VEC(x)
#endif
#include "doll.h"
#include <bits/stdc++.h>
#define For(i, a, b) for(int i = a; i <= b; i++)
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define sz(x) ((int)x.size())
#define eb emplace_back
using namespace std;
using LL = long long;
using pii = pair<int, int>;
const int MAXM = 100010;
void create_circuit(int M, std::vector<int> A) {
vector<vector<int>> adj(M + 1, vector<int>());
vector<int> x, y;
int n = sz(A);
For(i, 0, n - 2) {
adj[A[i]].eb(A[i + 1]);
}
adj[A.back()].eb(0);
vector<int> ans(M + 1);
ans[0] = A[0];
For(i, 1, M) {
if(sz(adj[i]) == 0) {
ans[i] = 0;
} else if(sz(adj[i]) == 1) {
ans[i] = adj[i][0];
} else if(sz(adj[i]) == 2) {
int tot = sz(adj[i]);
int now = sz(x) + 1;
ans[i] = -now;
For(j, 0, tot - 3) {
x.eb(adj[i][j]);
y.eb(-(now + 1));
now++;
}
x.eb(adj[i][tot - 2]);
y.eb(adj[i][tot - 1]);
} else {
auto &v = adj[i];
int id = sz(x) + 1;
ans[i] = -id;
if(sz(adj[i]) == 4) {
x.eb(-(id + 1));
y.eb(-(id + 2));
x.eb(v[0]);
y.eb(v[2]);
x.eb(v[1]);
y.eb(v[3]);
} else {
x.eb(-(id + 1));
y.eb(-(id + 2));
x.eb(-(id));
y.eb(v[1]);
x.eb(v[0]);
y.eb(v[2]);
}
}
}
OUT_VEC(ans);
OUT_VEC(x);
OUT_VEC(y);
answer(ans, x, y);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
24 ms |
6416 KB |
Output is correct |
3 |
Correct |
19 ms |
5272 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
11 ms |
3796 KB |
Output is correct |
6 |
Correct |
49 ms |
7756 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
24 ms |
6416 KB |
Output is correct |
3 |
Correct |
19 ms |
5272 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
11 ms |
3796 KB |
Output is correct |
6 |
Correct |
49 ms |
7756 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
39 ms |
7376 KB |
Output is correct |
9 |
Correct |
52 ms |
8784 KB |
Output is correct |
10 |
Correct |
88 ms |
11264 KB |
Output is correct |
11 |
Correct |
1 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 |
6416 KB |
Output is correct |
3 |
Correct |
19 ms |
5272 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
11 ms |
3796 KB |
Output is correct |
6 |
Correct |
49 ms |
7756 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
39 ms |
7376 KB |
Output is correct |
9 |
Correct |
52 ms |
8784 KB |
Output is correct |
10 |
Correct |
88 ms |
11264 KB |
Output is correct |
11 |
Correct |
1 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 |
Correct |
78 ms |
11192 KB |
Output is correct |
15 |
Correct |
54 ms |
6240 KB |
Output is correct |
16 |
Correct |
64 ms |
9128 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
296 KB |
Output is correct |
19 |
Correct |
1 ms |
212 KB |
Output is correct |
20 |
Correct |
76 ms |
11188 KB |
Output is correct |
21 |
Correct |
1 ms |
212 KB |
Output is correct |
22 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
300 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 |
- |