#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
map<pair<int,int> , bool> visited;
void construct_network(int H, int W, int K) {
vector<int> calsXor;
vector<int> rowsXor;
vector<int> test;
if (H == 1 || W == 1){
for (int i = 0 ; i < H * W - 1 ; i++){
test.push_back(add_and({i , i + 1}));
}
add_xor(test);
return;
}
for (int i = 0 ; i < H * W ; i++){
if (i && i % W == 0 && test.size() > 1){calsXor.push_back(add_xor(test)); test.clear();}
test.push_back(i);
}
if (H * W == 2){
add_and({0 , 1});
return;
}
if (test.size())calsXor.push_back(add_xor(test));
test.clear();
for (int i = 0 ; i < W ; i++){
for (int j = i ; j < W * H ; j+= W){
test.push_back(j);
}
if(test.size() > 1)rowsXor.push_back(add_xor(test));
test.clear();
}
vector<int> androws;
vector<int> andcals;
for (int i = 0 ; i < calsXor.size() - 1 ; i++){
andcals.push_back(add_and({calsXor[i], calsXor[i+1]}));
}
for (int i = 0 ; i < rowsXor.size() - 1 ; i++){
androws.push_back(add_and({rowsXor[i], rowsXor[i+1]}));
}
int conrow , concal, samerow, samecal;
conrow = add_xor(androws);
concal = add_xor(andcals);
samecal = add_not(add_or(calsXor));
samerow = add_not(add_or(rowsXor));
int ConRowSameCal, ConCalSameRow;
ConCalSameRow = add_and({concal, samerow});
ConRowSameCal = add_and({conrow , samecal});
add_or({ConCalSameRow , ConRowSameCal});
}
Compilation message
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:46:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 0 ; i < calsXor.size() - 1 ; i++){
~~^~~~~~~~~~~~~~~~~~~~
vision.cpp:50:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 0 ; i < rowsXor.size() - 1 ; i++){
~~^~~~~~~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Incorrect |
4 ms |
256 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Incorrect |
4 ms |
256 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Incorrect |
4 ms |
256 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Incorrect |
4 ms |
256 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Incorrect |
5 ms |
384 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Incorrect |
4 ms |
256 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
14 ms |
1152 KB |
Output is correct |
2 |
Correct |
4 ms |
256 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
6 ms |
512 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
10 ms |
768 KB |
Output is correct |
8 |
Correct |
9 ms |
768 KB |
Output is correct |
9 |
Correct |
13 ms |
1152 KB |
Output is correct |
10 |
Correct |
5 ms |
256 KB |
Output is correct |
11 |
Correct |
5 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Incorrect |
4 ms |
256 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |