#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
int or_row[205], or_col[205], can_row[205], can_col[205];
void construct_network(int H, int W, int K) {
int cnt = H * W;
for (int i = 0; i < H; i++) {
vector<int> tmp;
for (int j = 0; j < W; j++)
tmp.pb(i * W + j);
add_or(tmp);
or_row[i] = cnt++;
}
for (int j = 0; j < W; j++) {
vector<int> tmp;
for (int i = 0; i < H; i++)
tmp.pb(i * W + j);
add_or(tmp);
or_col[j] = cnt++;
}
for (int ver = 0; ver <= K; ver++) {
if (ver >= H || K - ver >= W) continue;
int ocnt = cnt, tmpp = 0;
for (int i = 0; i + ver < H; i++) {
vector<int> tmp = {or_row[i], or_row[i + ver]};
tmpp++;
add_and(tmp);
cnt++;
}
vector<int> tmp;
for (int i = 0; i < tmpp; i++)
tmp.pb(ocnt + i);
add_or(tmp);
can_row[ver] = cnt++;
}
for (int hor = 0; hor <= K; hor++) {
if (hor >= W || K - hor >= H) continue;
int ocnt = cnt, tmpp = 0;
for (int i = 0; i + hor < W; i++) {
vector<int> tmp = {or_col[i], or_col[i + hor]};
tmpp++;
add_and(tmp);
cnt++;
}
vector<int> tmp;
for (int i = 0; i < tmpp; i++)
tmp.pb(ocnt + i);
add_or(tmp);
can_col[hor] = cnt++;
}
vector<int> tot;
for (int ver = 0; ver <= K; ver++) {
int hor = K - ver;
if (ver < H && hor < W) {
vector<int> tmp = {can_row[ver], can_col[hor]};
add_and(tmp);
tot.pb(cnt++);
}
}
add_or(tot);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
296 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
300 KB |
Output is correct |
5 |
Incorrect |
1 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 |
296 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
300 KB |
Output is correct |
5 |
Incorrect |
1 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 |
296 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
300 KB |
Output is correct |
5 |
Incorrect |
1 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 |
296 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
300 KB |
Output is correct |
5 |
Incorrect |
1 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 |
340 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 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
212 KB |
Output is correct |
20 |
Correct |
1 ms |
212 KB |
Output is correct |
21 |
Correct |
1 ms |
212 KB |
Output is correct |
22 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 0), (1, 1), expected 0, but computed 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
1200 KB |
on inputs (57, 107), (59, 108), expected 0, but computed 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
296 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
300 KB |
Output is correct |
5 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 1), (1, 0), expected 0, but computed 1 |
6 |
Halted |
0 ms |
0 KB |
- |