#include <bits/stdc++.h>
#include "doll.h"
#define ll long long
#define pb push_back
#define ff first
#define ss second
using namespace std;
int n, m, cur;
vector<int>c, x, y;
vector<int>a;
int generar(int desde, int cada, int div){
if(div == 0){
return a[desde];
}
if(a[desde] == -1){
return a[desde];
}
int posi = cur;
int real = -(cur + 1);
x.pb(0);
y.pb(0);
cur ++ ;
x[posi] = generar(desde, cada*2, div-1);
y[posi] = generar(desde + cada, cada*2, div-1);
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);
int 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);
answer(c, x, y);
}
Compilation message
doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:39:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
39 | while(k <= a.size()-1 ){
| ~~^~~~~~~~~~~~~
doll.cpp:43:19: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
43 | while(a.size()-1 < k)a.pb(-1);
| ~~~~~~~~~~~^~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
1 ms |
212 KB |
Output is partially correct |
2 |
Correct |
30 ms |
5936 KB |
Output is correct |
3 |
Partially correct |
49 ms |
8704 KB |
Output is partially correct |
4 |
Partially correct |
58 ms |
10132 KB |
Output is partially correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
1 ms |
212 KB |
Output is partially correct |
2 |
Correct |
30 ms |
5936 KB |
Output is correct |
3 |
Partially correct |
49 ms |
8704 KB |
Output is partially correct |
4 |
Partially correct |
58 ms |
10132 KB |
Output is partially correct |
5 |
Partially correct |
71 ms |
11144 KB |
Output is partially correct |
6 |
Partially correct |
69 ms |
10992 KB |
Output is partially correct |
7 |
Partially correct |
58 ms |
11052 KB |
Output is partially correct |
8 |
Partially correct |
55 ms |
10184 KB |
Output is partially correct |
9 |
Partially correct |
50 ms |
8676 KB |
Output is partially correct |
10 |
Partially correct |
56 ms |
10748 KB |
Output is partially correct |
11 |
Partially correct |
59 ms |
10512 KB |
Output is partially correct |
12 |
Partially correct |
49 ms |
8936 KB |
Output is partially correct |
13 |
Correct |
33 ms |
6276 KB |
Output is correct |
14 |
Partially correct |
52 ms |
9312 KB |
Output is partially correct |
15 |
Partially correct |
53 ms |
9444 KB |
Output is partially correct |
16 |
Partially correct |
2 ms |
596 KB |
Output is partially correct |
17 |
Correct |
30 ms |
6156 KB |
Output is correct |
18 |
Correct |
30 ms |
6148 KB |
Output is correct |
19 |
Partially correct |
50 ms |
8932 KB |
Output is partially correct |
20 |
Partially correct |
56 ms |
10036 KB |
Output is partially correct |
21 |
Partially correct |
56 ms |
10452 KB |
Output is partially correct |
22 |
Partially correct |
54 ms |
10536 KB |
Output is partially correct |