#include "doll.h"
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define ld long double
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define SZ(x) (int)(x).size()
template <typename T> using ord_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int n = 2e5 + 123;
int used[n];
vector <int> pos[n];
void create_circuit(int M, std::vector<int> A) {
int N = A.size(), cnt = 0;
A.pb(0);
for (int i = 0; i < N; i++)
pos[A[i]].pb(i);
std::vector<int> C(M + 1), X(N), Y(N);
C[0] = A[0];
for (int i = 0; i < N; i++) {
if (used[A[i]]) continue;
used[A[i]] = 1;
if (SZ(pos[A[i]]) == 1) {
C[A[i]] = A[i + 1];
} else {
C[A[i]] = -(++cnt);
for (int j = 1; j < SZ(pos[A[i]]); j++) {
int x = pos[A[i]][j];
if (j == SZ(pos[A[i]]) - 1)
X[cnt - 1] = A[i + 1];
else {
X[cnt - 1] = -(cnt + 1);
cnt++;
}
Y[cnt - 1] = A[x + 1];
}
}
}
answer(C, X, Y);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
4940 KB |
Output is correct |
2 |
Correct |
53 ms |
10564 KB |
Output is correct |
3 |
Correct |
40 ms |
10496 KB |
Output is correct |
4 |
Correct |
4 ms |
4940 KB |
Output is correct |
5 |
Correct |
15 ms |
6220 KB |
Output is correct |
6 |
Correct |
70 ms |
13528 KB |
Output is correct |
7 |
Correct |
4 ms |
4940 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
4940 KB |
Output is correct |
2 |
Correct |
53 ms |
10564 KB |
Output is correct |
3 |
Correct |
40 ms |
10496 KB |
Output is correct |
4 |
Correct |
4 ms |
4940 KB |
Output is correct |
5 |
Correct |
15 ms |
6220 KB |
Output is correct |
6 |
Correct |
70 ms |
13528 KB |
Output is correct |
7 |
Correct |
4 ms |
4940 KB |
Output is correct |
8 |
Correct |
80 ms |
13100 KB |
Output is correct |
9 |
Correct |
92 ms |
14336 KB |
Output is correct |
10 |
Correct |
130 ms |
17368 KB |
Output is correct |
11 |
Correct |
5 ms |
4940 KB |
Output is correct |
12 |
Correct |
5 ms |
4940 KB |
Output is correct |
13 |
Correct |
5 ms |
4940 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
4940 KB |
Output is correct |
2 |
Correct |
53 ms |
10564 KB |
Output is correct |
3 |
Correct |
40 ms |
10496 KB |
Output is correct |
4 |
Correct |
4 ms |
4940 KB |
Output is correct |
5 |
Correct |
15 ms |
6220 KB |
Output is correct |
6 |
Correct |
70 ms |
13528 KB |
Output is correct |
7 |
Correct |
4 ms |
4940 KB |
Output is correct |
8 |
Correct |
80 ms |
13100 KB |
Output is correct |
9 |
Correct |
92 ms |
14336 KB |
Output is correct |
10 |
Correct |
130 ms |
17368 KB |
Output is correct |
11 |
Correct |
5 ms |
4940 KB |
Output is correct |
12 |
Correct |
5 ms |
4940 KB |
Output is correct |
13 |
Correct |
5 ms |
4940 KB |
Output is correct |
14 |
Incorrect |
103 ms |
15648 KB |
wrong motion |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
4940 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
4940 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
4940 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |