#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 1;
int ac[N];
int pos;
int cell(int i, int j, int m){
return i * m + j;
}
// int add_xor(vector <int> b){
// ac[pos] = 0;
// for (auto x : b) ac[pos] ^= ac[x];
// return pos++;
// }
// int add_and(vector <int> b){
// ac[pos] = 1;
// for (auto x : b) ac[pos] &= ac[x];
// return pos++;
// }
// int add_or(vector <int> b){
// ac[pos] = 0;
// for (auto x : b) ac[pos] |= ac[x];
// return pos++;
// }
// int add_not(int b){
// ac[pos] = 1 - ac[b];
// return pos++;
// }
void construct_network(int n, int m, int k) {
// std::vector<int> Ns;
// Ns = {0, 1};
// int a = add_and(Ns);
// Ns = {0, a};
// int b = add_or(Ns);
// Ns = {0, 1, b};
// int c = add_xor(Ns);
// add_not(c);
vector <int> r;
vector <int> a;
for (int i = 0; i < n; i++){
a.clear();
for (int j = 0; j < m; j++) a.push_back(cell(i, j, m));
int x = add_xor(a);
r.push_back(x);
/// cout << i << " " << x << " " << ac[x] << "\n";
}
a.clear();
for (auto &x : r){
a.push_back(x);
x = add_xor(a);
/// cout << x << " " << ac[x] << "\n";
}
vector <int> c;
for (int j = 0; j < m; j++){
a.clear();
for (int i = 0; i < n; i++) a.push_back(cell(i, j, m));
int x = add_xor(a);
c.push_back(x);
// cout << j << " " << x << " " << ac[x] << "\n";
}
a.clear();
for (auto &x : c){
a.push_back(x);
x = add_xor(a);
}
int v1 = add_or(r);
v1 = add_not(v1);
// cout << v1 << " " << ac[v1] << "\n";
int v2 = add_or(c);
v2 = add_not(v2);
// cout << v2 << " " << ac[v2] << "\n";
vector <int> r2, c2;
for (int i = 1; i < r.size(); i++){
int x = add_and({r[i], r[i -1]});
r2.push_back(x);
}
int v3;
if (r2.size()){
v3 = add_or(r2);
v3 = add_not(v3);
} else {
v3 = -1;
}
// cout << v3 << " " << ac[v3] << "\n";
for (int i = 1; i < c.size(); i++){
int x = add_and({c[i], c[i - 1]});
c2.push_back(x);
}
int v4;
if (c2.size()){
v4 = add_or(c2);
v4 = add_not(v4);
} else {
v4 = -1;
}
// cout << v4 << " " << ac[v4] << "\n";
int v5, v6;
if (v4 != -1)
v5 = add_and({v1, v4});
if (v3 != -1)
v6 = add_and({v2, v3});
add_or({v5, v6});
}
// int main(){
// int h, w, k;
// cin >> h >> w >> k;
// pos = h * w;
// for (int i = 0; i < h * w; i++) cin >> ac[i];
// construct_network(h, w, k);
// cout << ac[pos - 1] << "\n";
// return 0;
// }
Compilation message
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:92:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
92 | for (int i = 1; i < r.size(); i++){
| ~~^~~~~~~~~~
vision.cpp:105:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
105 | for (int i = 1; i < c.size(); i++){
| ~~^~~~~~~~~~
vision.cpp:124:20: warning: 'v6' may be used uninitialized in this function [-Wmaybe-uninitialized]
124 | add_or({v5, v6});
| ^
vision.cpp:124:20: warning: 'v5' may be used uninitialized in this function [-Wmaybe-uninitialized]
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
WA in grader: Invalid index |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
WA in grader: Invalid index |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
WA in grader: Invalid index |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
WA in grader: Invalid index |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
468 KB |
on inputs (0, 0), (0, 48), expected 0, but computed 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
1492 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
2 ms |
468 KB |
Output is correct |
5 |
Incorrect |
2 ms |
468 KB |
on inputs (0, 0), (0, 48), expected 0, but computed 1 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
WA in grader: Invalid index |
2 |
Halted |
0 ms |
0 KB |
- |