#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
int n, m, k;
int toInd(int e, int s) {
return e * m + s;
}
vector<int> getDiagonal1(int ind) {
/// i + j = ind
vector<int> ret;
for(int i = 0; i < n; i++) {
int j = ind - i;
if(j < 0 || j >= m) continue;
ret.push_back(toInd(i, j));
}
return ret;
}
vector<int> getDiagonal2(int ind) {
/// i - j + m = ind
vector<int> ret;
for(int i = 0; i < n; i++) {
int j = i + m - ind;
if(j < 0 || j >= m) continue;
ret.push_back(toInd(i, j));
}
return ret;
}
void construct_network(int H, int W, int K) {
n = H, m = W, k = K;
vector<int> ors1, ors2, xors1, xors2;
for(int i = 0; i < n + m-1; i++) {
ors1.push_back(add_or(getDiagonal1(i)));
ors2.push_back(add_or(getDiagonal2(i)));
xors1.push_back(add_xor(getDiagonal1(i)));
xors2.push_back(add_xor(getDiagonal2(i)));
}
/* vector<int> du1, du2;
for(int i = 0; i < n + m - 1; i++) {
du1.push_back(add_and({ors1[i], xors1[i]}));
du2.push_back(add_and({ors2[i], xors2[i]}));
}
int yraDu1 = add_or(du1);
int yraDu2 = add_or(du2);
*/
vector<int> yraDu1, yraDu2;
for(int i = 0; i < n + m-1; i++) {
vector<int> oras1, xoras1;
for(int j = 0; j+i < k; j++) {
oras1.push_back(ors1[i+j]);
xoras1.push_back(xors1[i+j]);
}
int bendrasOras = add_or(oras1);
int bendrasXoras = add_xor(xoras1);
int notBendrasXoras = add_not(bendrasXoras);
yraDu1.push_back(add_and({bendrasOras, notBendrasXoras}));
}
for(int i = 0; i < n + m-1; i++) {
vector<int> oras2, xoras2;
for(int j = 0; j < k; j++) {
if(j + i >= n + m - 1) continue;
oras2.push_back(ors2[i+j]);
xoras2.push_back(xors2[i+j]);
}
int bendrasOras = add_or(oras2);
int bendrasXoras = add_xor(xoras2);
int notBendrasXoras = add_not(bendrasXoras);
yraDu2.push_back(add_and({bendrasOras, notBendrasXoras}));
}
int artiPagal1 = add_or(yraDu1);
int artiPagal2 = add_or(yraDu2);
vector<int> lygiaiK1, lygiaiK2;
for(int i = 0; i+k < n+m-1; i++) {
lygiaiK1.push_back(add_and({ors1[i], ors1[i+k]}));
lygiaiK2.push_back(add_and({ors2[i], ors2[i+k]}));
}
int yraLygiai1 = add_or(lygiaiK1);
int yraLygiai2 = add_or(lygiaiK2);
int yraLygiai = add_or({yraLygiai1, yraLygiai2});
int yraArti = add_and({artiPagal1, artiPagal2});
int yraLygiaiK = add_and({yraLygiai, yraArti});
}
Compilation message
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:91:9: warning: unused variable 'yraLygiaiK' [-Wunused-variable]
91 | int yraLygiaiK = add_and({yraLygiai, yraArti});
| ^~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |