#include <bits/stdc++.h>
using namespace std;
//#define int long long
//#define pii pair<long long, long long>
void answer(vector<signed> C, vector<signed> X, vector<signed> Y);
void create_circuit(int k, vector<int> a) {
int n = a.size();
a.push_back(0);
vector<vector<int>> g(k + 1);
g[0].push_back(a[0]);
for (int i = 0; i < n; i++) {
g[a[i]].push_back(a[i + 1]);
}
vector<int> C(k + 1), X, Y;
int nots = 0;
C[0] = g[0][0];
for (int i = 1; i < k + 1; i++) {
nots += 3;
C[i] = -nots + 2;
X.push_back(-nots + 1);
Y.push_back(-nots);
vector<int> outs(4, -nots + 2);
for (int j = 4 - g[i].size(); j < 4; j++) {
outs[j] = g[i][j - (4 - g[i].size())];
}
X.push_back(outs[0]);
Y.push_back(outs[2]);
X.push_back(outs[1]);
Y.push_back(outs[3]);
}
X.resize(nots);
Y.resize(nots);
answer(C, X, Y);
}
#ifdef LOCAL
void answer(vector<signed> C, vector<signed> X, vector<signed> Y) {
for (int x : C) cout << x << " ";
cout << "\n";
for (int x : X) cout << x << " ";
cout << "\n";
for (int x : Y) cout << x << " ";
cout << "\n";
}
int main() {
create_circuit(4, {1, 2, 1, 2, 1, 2, 1, 2, 3});
}
#endif
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
0 ms |
348 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
0 ms |
348 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |