#include <bits/stdc++.h>
#ifndef ARTHUR_LOCAL
#include "doll.h"
#endif
using namespace std;
const int MAXN=100000;
int apps[MAXN];
vector<int> go_to[MAXN];
#ifdef ARTHUR_LOCAL
void answer(vector<int> V, vector<int> X, vector<int> Y)
{
for(auto v:V) cout << v << " ";
cout << endl;
for(int i=0; i<int(X.size()); i++)
{
cout << X[i] << " " << Y[i] << endl;
}
cout << endl;
}
#endif
void create_circuit(int m, vector<int> A)
{
int n = A.size();
for(int i=0; i<n-1; i++)
{
go_to[A[i]].push_back(A[i+1]);
}
go_to[A[n-1]].push_back(0);
vector<int> C={A[0]};
int switch_no=0;
vector<int> X;
vector<int> Y;
for(int i=1; i<=m; i++)
{
if(go_to[i].empty())
{
C.push_back(0);
continue;
}
if(go_to[i].size() == 1)
{
C.push_back(go_to[i][0]);
continue;
}
if(go_to[i].size() == 2)
{
switch_no++;
C.push_back(-switch_no);
X.push_back(go_to[i][0]);
Y.push_back(go_to[i][1]);
continue;
}
if(go_to[i].size() == 3)
{
switch_no++;
C.push_back(-switch_no);
X.push_back(-switch_no-1);
Y.push_back(-switch_no-2);
X.push_back(go_to[i][0]);
Y.push_back(-switch_no);
X.push_back(go_to[i][1]);
Y.push_back(go_to[i][2]);
switch_no++;
switch_no++;
continue;
}
if(go_to[i].size() == 4)
{
switch_no++;
C.push_back(-switch_no);
X.push_back(-switch_no-1);
Y.push_back(-switch_no-2);
X.push_back(go_to[i][0]);
Y.push_back(go_to[i][2]);
X.push_back(go_to[i][1]);
Y.push_back(go_to[i][3]);
switch_no++;
switch_no++;
continue;
}
}
answer(C,X,Y);
}
#ifdef ARTHUR_LOCAL
int main()
{
create_circuit(1,{1});
}
#endif
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
2636 KB |
Output is correct |
2 |
Correct |
33 ms |
6504 KB |
Output is correct |
3 |
Correct |
27 ms |
5992 KB |
Output is correct |
4 |
Correct |
3 ms |
2636 KB |
Output is correct |
5 |
Correct |
19 ms |
3908 KB |
Output is correct |
6 |
Correct |
38 ms |
7776 KB |
Output is correct |
7 |
Correct |
2 ms |
2636 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
2636 KB |
Output is correct |
2 |
Correct |
33 ms |
6504 KB |
Output is correct |
3 |
Correct |
27 ms |
5992 KB |
Output is correct |
4 |
Correct |
3 ms |
2636 KB |
Output is correct |
5 |
Correct |
19 ms |
3908 KB |
Output is correct |
6 |
Correct |
38 ms |
7776 KB |
Output is correct |
7 |
Correct |
2 ms |
2636 KB |
Output is correct |
8 |
Correct |
82 ms |
7924 KB |
Output is correct |
9 |
Correct |
68 ms |
8660 KB |
Output is correct |
10 |
Correct |
99 ms |
11096 KB |
Output is correct |
11 |
Correct |
3 ms |
2636 KB |
Output is correct |
12 |
Correct |
3 ms |
2648 KB |
Output is correct |
13 |
Correct |
3 ms |
2636 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
2636 KB |
Output is correct |
2 |
Correct |
33 ms |
6504 KB |
Output is correct |
3 |
Correct |
27 ms |
5992 KB |
Output is correct |
4 |
Correct |
3 ms |
2636 KB |
Output is correct |
5 |
Correct |
19 ms |
3908 KB |
Output is correct |
6 |
Correct |
38 ms |
7776 KB |
Output is correct |
7 |
Correct |
2 ms |
2636 KB |
Output is correct |
8 |
Correct |
82 ms |
7924 KB |
Output is correct |
9 |
Correct |
68 ms |
8660 KB |
Output is correct |
10 |
Correct |
99 ms |
11096 KB |
Output is correct |
11 |
Correct |
3 ms |
2636 KB |
Output is correct |
12 |
Correct |
3 ms |
2648 KB |
Output is correct |
13 |
Correct |
3 ms |
2636 KB |
Output is correct |
14 |
Correct |
100 ms |
11976 KB |
Output is correct |
15 |
Correct |
56 ms |
7516 KB |
Output is correct |
16 |
Correct |
98 ms |
9904 KB |
Output is correct |
17 |
Correct |
3 ms |
2584 KB |
Output is correct |
18 |
Correct |
2 ms |
2636 KB |
Output is correct |
19 |
Correct |
3 ms |
2636 KB |
Output is correct |
20 |
Correct |
98 ms |
11088 KB |
Output is correct |
21 |
Correct |
2 ms |
2636 KB |
Output is correct |
22 |
Correct |
3 ms |
2636 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
2636 KB |
Wrong Answer: wrong array length |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
2636 KB |
Wrong Answer: wrong array length |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
2636 KB |
Wrong Answer: wrong array length |
2 |
Halted |
0 ms |
0 KB |
- |