#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
typedef pair<ll,ll>pii;
const ll MAXN = 9500;
const ll INF = 1e9+7;
void construct_network(int H, int W, int K){
vector<int>Ns,fina;
int d,a,i,j,f1,f2;
if(H==1){
for(i=0;i+K<W;i++){
Ns = {i,i+K};
d = add_and(Ns);
fina.pb(d);
}
add_or(fina);
return;
}else if(W==1){
for(i=0;i+K<H;i++){
Ns = {i,i+K};
d = add_and(Ns);
fina.pb(d);
}
add_or(fina);
return;
}
int linha[H],coluna[W];
for(i=0;i<H;i++){
vector<int>bruh;
for(j=0;j<W;j++){
bruh.pb(W*i+j);
}
linha[i] = add_or(bruh);
}
for(j=0;j<W;j++){
vector<int>bruh;
for(i=0;i<H;i++){
bruh.pb(W*i+j);
}
coluna[j] = add_or(bruh);
}
//linha[0] e o index da memoria na qual esta o resultado
vector<int>bruh;
if(W>1){
for(j=0;j<W-1;j++){
Ns={coluna[j],coluna[j+1]};
bruh.pb(add_and(Ns));
}
d = add_or(bruh);//tem de haver algumas duas colunas
bruh.clear();
for(i=0;i<H;i++){
bruh.pb(linha[i]);
}
a = add_xor(bruh);//#linhas com algo tem de ser impar
Ns={d,a};
f1=add_and(Ns);
}
if(H>1){
bruh.clear();
for(i=0;i<H-1;i++){
Ns={linha[i],linha[i+1]};
bruh.pb(add_and(Ns));
}
d = add_or(bruh);//tem de haver algumas duas linhas
bruh.clear();
for(j=0;j<W;j++){
bruh.pb(coluna[j]);
}
a = add_xor(bruh);//#colunas com algo tem de ser impar
Ns={d,a};
f2=add_and(Ns);
}
Ns={f1,f2};
add_or(Ns);
}
Compilation message
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:96:4: warning: 'f1' may be used uninitialized in this function [-Wmaybe-uninitialized]
96 | Ns={f1,f2};
| ~~^~~~~~~~
vision.cpp:96:4: warning: 'f2' may be used uninitialized in this function [-Wmaybe-uninitialized]
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Incorrect |
1 ms |
288 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Incorrect |
1 ms |
288 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Incorrect |
1 ms |
288 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Incorrect |
1 ms |
288 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
224 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |
11 |
Correct |
1 ms |
204 KB |
Output is correct |
12 |
Correct |
1 ms |
204 KB |
Output is correct |
13 |
Correct |
1 ms |
204 KB |
Output is correct |
14 |
Correct |
1 ms |
204 KB |
Output is correct |
15 |
Correct |
1 ms |
204 KB |
Output is correct |
16 |
Correct |
1 ms |
204 KB |
Output is correct |
17 |
Correct |
1 ms |
204 KB |
Output is correct |
18 |
Correct |
1 ms |
204 KB |
Output is correct |
19 |
Correct |
1 ms |
204 KB |
Output is correct |
20 |
Correct |
1 ms |
204 KB |
Output is correct |
21 |
Correct |
1 ms |
204 KB |
Output is correct |
22 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Incorrect |
0 ms |
204 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
1100 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
2 ms |
332 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
6 ms |
716 KB |
Output is correct |
8 |
Correct |
6 ms |
704 KB |
Output is correct |
9 |
Correct |
10 ms |
1132 KB |
Output is correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |
11 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Incorrect |
1 ms |
288 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
7 |
Halted |
0 ms |
0 KB |
- |