#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int h, w, k;
void construct_network(int H, int W, int K) {
h = H;
w = W;
k = K;
int level = h * w;
int hnorm = level;
for (int i = 0; i < h; i++)
{
vector<int> cur;
for (int j = 0; j < w; j++)
{
cur.push_back(i * w + j);
}
add_or(cur);
level++;
}
int wnorm = level;
for (int j = 0; j < w; j++)
{
vector<int> cur;
for (int i = 0; i < h; i++)
{
cur.push_back(i * w + j);
}
add_or(cur);
level++;
}
int xorh = level;
vector<int> cur;
for (int i = 0; i <h; i++)
{
cur.push_back(hnorm + i);
add_xor(cur);
level++;
}
cur.clear();
int xorw = level;
for (int j = 0; j < w; j++)
{
cur.push_back(wnorm + j);
add_xor(cur);
level++;
}
cur.clear();
vector<int> toCheck;
if (k <= h)
{
for (int i = 0; i + k <= h; i++)
{
toCheck.push_back(level);
for (int j = i; j < i + k; j++)
{
cur.push_back(xorh + j);
}
cur.push_back(xorw + w - 1);
add_and(cur);
level++;
cur.clear();
}
}
if (k <= w)
{
for (int j = 0; j + k <= w; j++)
{
toCheck.push_back(level);
for (int i = j; i < j + k; i++)
{
cur.push_back(xorw + i);
}
cur.push_back(xorh + h - 1);
add_and(cur);
level++;
cur.clear();
}
}
vector<int> possH(h);
vector<int> possW(w);
for (int i = 1; i < h; i++)
{
int start = level;
for (int j = 0; j + i <= h; j++)
{
for (int l = j; l < j +i; l++)
{
cur.push_back(xorh + l);
}
add_and(cur);
level++;
cur.clear();
}
for (int j = start; j < level; j++)
{
cur.push_back(j);
}
possH[i] = level;
add_or(cur);
level++;
cur.clear();
}
for (int i = 1; i < w; i++)
{
int start = level;
for (int j = 0; j + i <= w; j++)
{
for (int l = j; l < j +i; l++)
{
cur.push_back(xorw + l);
}
add_and(cur);
level++;
cur.clear();
}
for (int j = start; j < level; j++)
{
cur.push_back(j);
}
possW[i] = level;
add_or(cur);
level++;
cur.clear();
}
int check1 = level;
add_not(xorh + h - 1);
level++;
int check2 = level;
add_not(xorw + w - 1);
level++;
for (int i = 1, j = k - 1; i < k && j >= 1; i++, j--)
{
if (i >= h || j >= w) continue;
toCheck.push_back(level);
cur.push_back(possH[i]);
cur.push_back(possW[j]);
cur.push_back(check1);
cur.push_back(check2);
add_and(cur);
level++;
cur.clear();
}
add_or(toCheck);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
on inputs (0, 0), (0, 2), expected 0, but computed 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
on inputs (0, 0), (0, 2), expected 0, but computed 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
on inputs (0, 0), (0, 2), expected 0, but computed 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
on inputs (0, 0), (0, 2), expected 0, but computed 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
1860 KB |
WA in grader: Too many instructions |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Incorrect |
25 ms |
2400 KB |
on inputs (0, 0), (0, 2), expected 0, but computed 1 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
2116 KB |
WA in grader: Too many instructions |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
on inputs (0, 0), (0, 2), expected 0, but computed 1 |
2 |
Halted |
0 ms |
0 KB |
- |