#include <bits/stdc++.h>
#include "doll.h"
using namespace std;
#define fo(a, b, c) for (int a = b; a < c; a++)
#define ll long long
#define print(x) cout << x << "\n";
#define vint vector<int>
#define vll vector<long long>
// // should call
// // c - array of length m + 1, the exit of device i is c[i]
// // x, y - length s is the number of switches. exit 'X' of -i is connected to x[i-1] and same for Y
// // called once
// void answer(vint C, vint X, vint Y)
// {
// fo(i, 0, C.size())
// {
// print(C[i]);
// }
// print("");
// fo(i, 0, X.size())
// {
// print(X[i] << " " << Y[i]);
// }
// }
// m - number of triggers (doesnt include 0)
// a - array of length n, of the serial numbers of the triggers the ball needs to enter, in the correct order
void create_circuit(int m, vint a)
{
int n = a.size();
vint c, x, y;
if (n == 1)
{
c = {1, 0};
answer(c, x, y);
return;
}
int numS = pow(2, ceil(log2(n)))-1;
int lRow = numS - pow(2, ceil(log2(n))-1);
c = {1, -1};
fo(i, 1, numS+1)
{
x.push_back(-(i*2));
y.push_back(-(i*2+1));
}
ll count=1;
fo(i, lRow, numS+1){
if (count < n){
x[i]=1;
count++;
}else{
x[i]=-1;
}
if (count < n){
y[i]=1;
count++;
}else{
y[i]=-1;
}
}
y[y.size() - 1] = 0;
answer(c, x, y);
}
// int main()
// {
// ios::sync_with_stdio(0);
// cin.tie(0);
// vint a = {1,1, 1, 1, 1};
// create_circuit(1, a);
// }
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Wrong Answer: wrong array length |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Wrong Answer: wrong array length |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Wrong Answer: wrong array length |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Wrong Answer: wrong array length |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
1 ms |
204 KB |
Output is partially correct |
2 |
Correct |
42 ms |
4772 KB |
Output is correct |
3 |
Partially correct |
68 ms |
7736 KB |
Output is partially correct |
4 |
Partially correct |
80 ms |
8336 KB |
Output is partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
1 ms |
204 KB |
Output is partially correct |
2 |
Correct |
42 ms |
4772 KB |
Output is correct |
3 |
Partially correct |
68 ms |
7736 KB |
Output is partially correct |
4 |
Partially correct |
80 ms |
8336 KB |
Output is partially correct |
5 |
Incorrect |
29 ms |
6304 KB |
Wrong Answer: wrong array length |
6 |
Halted |
0 ms |
0 KB |
- |