#include <bits/stdc++.h>
#include "doll.h"
#define ll long long
#define pb push_back
#define ff first
#define ss second
using namespace std;
ll n, m, cur;
vector<int>c, x, y;
vector<int>a;
ll generar(ll desde, ll cada, ll div, bool lastt){
if(div == 0){
return a[desde];
}
if(a[desde] == -1 and ! lastt){
return a[desde];
}else if(m == 1 and a[desde] == 1 and a[((a.size()-desde)/cada)*cada + desde] == 1 and ! lastt){
return 1;
}
ll posi = cur;
ll real = -(cur + 1);
x.pb(0);
y.pb(0);
cur ++ ;
x[posi] = generar(desde, cada*2, div-1, false);
y[posi] = generar(desde + cada, cada*2, div-1, lastt);
return real;
}
void create_circuit(int M, std::vector<int> A) {
cur = 0;
a = A;
n = A.size();
m = M;
c.pb(A[0]);
for(int i = 1 ; i <= M ; i ++)c.pb(-1);
ll k = 1, pot = 0;
while(k <= a.size()-1 ){
k *= 2;
pot ++;
}
while(a.size()-1 < k)a.pb(-1);
a.pop_back();
a.push_back(0);
c[A[0]] = generar(1, 1, pot, true);
answer(c, x, y);
}
Compilation message
doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:41:10: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
41 | while(k <= a.size()-1 ){
| ~~^~~~~~~~~~~~~
doll.cpp:45:19: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
45 | while(a.size()-1 < k)a.pb(-1);
| ~~~~~~~~~~~^~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
2 |
Correct |
10 ms |
2356 KB |
Output is correct |
3 |
Partially correct |
53 ms |
8628 KB |
Output is partially correct |
4 |
Correct |
49 ms |
8496 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
2 |
Correct |
10 ms |
2356 KB |
Output is correct |
3 |
Partially correct |
53 ms |
8628 KB |
Output is partially correct |
4 |
Correct |
49 ms |
8496 KB |
Output is correct |
5 |
Partially correct |
58 ms |
11096 KB |
Output is partially correct |
6 |
Partially correct |
57 ms |
11032 KB |
Output is partially correct |
7 |
Partially correct |
57 ms |
11072 KB |
Output is partially correct |
8 |
Partially correct |
55 ms |
10148 KB |
Output is partially correct |
9 |
Partially correct |
49 ms |
8684 KB |
Output is partially correct |
10 |
Partially correct |
54 ms |
10808 KB |
Output is partially correct |
11 |
Partially correct |
53 ms |
10536 KB |
Output is partially correct |
12 |
Partially correct |
56 ms |
8944 KB |
Output is partially correct |
13 |
Correct |
31 ms |
6256 KB |
Output is correct |
14 |
Partially correct |
51 ms |
9344 KB |
Output is partially correct |
15 |
Partially correct |
52 ms |
9360 KB |
Output is partially correct |
16 |
Partially correct |
2 ms |
596 KB |
Output is partially correct |
17 |
Correct |
29 ms |
6176 KB |
Output is correct |
18 |
Correct |
29 ms |
6104 KB |
Output is correct |
19 |
Partially correct |
49 ms |
8900 KB |
Output is partially correct |
20 |
Partially correct |
56 ms |
10056 KB |
Output is partially correct |
21 |
Partially correct |
54 ms |
10488 KB |
Output is partially correct |
22 |
Partially correct |
53 ms |
10516 KB |
Output is partially correct |