#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100100;
const int INF = 123456;
int app[MAXN];
bool secondTime[MAXN];
void printAns(vector<int> C, vector<int> X, vector<int> Y) {
cout << "C: ";
for (int x : C)
cout << x << " ";
cout << endl;
cout << "(X, Y): ";
for (int i = 0; i < (int)X.size(); i++) {
cout << "(" << X[i] << ", "
<< Y[i] << ") ";
}
cout << endl;
}
void create_circuit(int M, std::vector<int> A) {
A.push_back(0);
int reqTrig = A.size();
memset(app, 0, sizeof(app));
memset(secondTime, false, sizeof(secondTime));
vector<int> C(M + 1, INF);
vector<int> X, Y;
for (int x : A)
app[x]++;
int sCount = -1;
C[0] = A[0];
for (int i = 0; i < reqTrig-1; i++) {
int now = A[i];
int nex = A[i+1];
if (secondTime[now]) {
Y[-C[now]-1] = nex;
} else if (app[A[i]] == 2) {
C[now] = sCount;
sCount -= 1;
X.push_back(nex);
Y.push_back(-1);
} else {
C[now] = nex;
}
secondTime[now] = true;
}
for (int i = 1; i <= M; i++) {
if (C[i] == INF)
C[i] = 0;
}
answer(C, X, Y);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
716 KB |
Output is correct |
2 |
Correct |
30 ms |
2480 KB |
Output is correct |
3 |
Correct |
19 ms |
2100 KB |
Output is correct |
4 |
Correct |
1 ms |
716 KB |
Output is correct |
5 |
Correct |
15 ms |
1868 KB |
Output is correct |
6 |
Correct |
31 ms |
2852 KB |
Output is correct |
7 |
Correct |
2 ms |
716 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
716 KB |
Output is correct |
2 |
Correct |
30 ms |
2480 KB |
Output is correct |
3 |
Correct |
19 ms |
2100 KB |
Output is correct |
4 |
Correct |
1 ms |
716 KB |
Output is correct |
5 |
Correct |
15 ms |
1868 KB |
Output is correct |
6 |
Correct |
31 ms |
2852 KB |
Output is correct |
7 |
Correct |
2 ms |
716 KB |
Output is correct |
8 |
Correct |
40 ms |
4860 KB |
Output is correct |
9 |
Correct |
42 ms |
4548 KB |
Output is correct |
10 |
Correct |
67 ms |
7316 KB |
Output is correct |
11 |
Correct |
2 ms |
716 KB |
Output is correct |
12 |
Correct |
2 ms |
716 KB |
Output is correct |
13 |
Correct |
1 ms |
716 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
716 KB |
Output is correct |
2 |
Correct |
30 ms |
2480 KB |
Output is correct |
3 |
Correct |
19 ms |
2100 KB |
Output is correct |
4 |
Correct |
1 ms |
716 KB |
Output is correct |
5 |
Correct |
15 ms |
1868 KB |
Output is correct |
6 |
Correct |
31 ms |
2852 KB |
Output is correct |
7 |
Correct |
2 ms |
716 KB |
Output is correct |
8 |
Correct |
40 ms |
4860 KB |
Output is correct |
9 |
Correct |
42 ms |
4548 KB |
Output is correct |
10 |
Correct |
67 ms |
7316 KB |
Output is correct |
11 |
Correct |
2 ms |
716 KB |
Output is correct |
12 |
Correct |
2 ms |
716 KB |
Output is correct |
13 |
Correct |
1 ms |
716 KB |
Output is correct |
14 |
Runtime error |
36 ms |
5020 KB |
Execution killed with signal 11 |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
3 ms |
1356 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
1356 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
1356 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |