#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
void construct_network(int n, int m, int k) {
function<int(int, int)> hash = [&](int x, int y) {
return x * m + y;
};
function<bool(int, int)> valid = [&](int x, int y) {
return ((0 <= x && x < n) && (0 <= y && y < m));
};
vector<int> res;
vector<int> fin;
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
res.clear();
if (valid(i + k, j)) res.pb(hash(i + k, j));
if (valid(i - k, j)) res.pb(hash(i + k, j));
if (valid(i, j + k)) res.pb(hash(i, j + k));
if (valid(i, j - k)) res.pb(hash(i, j - k));
for (int l = 1; l < k; l++) {
if (valid(i + l, j + (k - l))) res.pb(hash(i + l, j + (k - l)));
if (valid(i + l, j - (k - l))) res.pb(hash(i + l, j - (k - l)));
if (valid(i - l, j + (k - l))) res.pb(hash(i - l, j + (k - l)));
if (valid(i - l, j - (k - l))) res.pb(hash(i - l, j - (k - l)));
}
if (!res.empty()) fin.pb(add_and({hash(i, j), add_or(res)}));
}
}
add_or(fin);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Incorrect |
0 ms |
212 KB |
on inputs (0, 1), (1, 0), expected 0, but computed 1 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Incorrect |
0 ms |
212 KB |
on inputs (0, 1), (1, 0), expected 0, but computed 1 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Incorrect |
0 ms |
212 KB |
on inputs (0, 1), (1, 0), expected 0, but computed 1 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Incorrect |
0 ms |
212 KB |
on inputs (0, 1), (1, 0), expected 0, but computed 1 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
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 |
1 ms |
212 KB |
Output is correct |
5 |
Incorrect |
1 ms |
212 KB |
on inputs (2, 0), (197, 0), expected 0, but computed 1 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
4 ms |
720 KB |
Output is correct |
4 |
Correct |
14 ms |
1872 KB |
Output is correct |
5 |
Correct |
10 ms |
1360 KB |
Output is correct |
6 |
Correct |
7 ms |
692 KB |
Output is correct |
7 |
Correct |
4 ms |
296 KB |
Output is correct |
8 |
Incorrect |
2 ms |
976 KB |
WA in grader: Too many instructions |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
976 KB |
WA in grader: Too many instructions |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Incorrect |
0 ms |
212 KB |
on inputs (0, 1), (1, 0), expected 0, but computed 1 |
6 |
Halted |
0 ms |
0 KB |
- |