#include "vision.h"
#include <bits/stdc++.h>
#define ad push_back
using namespace std;
const int N = 250;
int n, m, i1;
int tox[N], col[N];
int l1, r1, l2, r2;
int mk, zro;
int ka[N], ka1[N];
void construct_network(int H, int W, int k)
{
n = H, m = W;
for (int i = 0; i < n; i++)
{
vector <int> p;
for (int j = 0; j < m; j++)
p.ad(i * m + j);
if(i) p.ad(tox[i - 1]);
tox[i] = add_xor(p);
}
for (int i = 0; i < m; i++)
{
vector <int> p;
for(int j = 0; j < n; j++)
p.ad(j * m + i);
if(i) p.ad(col[i - 1]);
col[i] = add_xor(p);
}
i1 = col[m - 1] + 1;
for (int i = 0; i < n; i++)
{
vector <int> p;
if(i == 0)
{
p.ad(tox[i]);
add_or(p);
p.clear(), p.ad(tox[n - 1]);
for(int j = 0; j < 6; j++) add_or(p);
i1 += 7;
}
else
{
p.ad(tox[i]);
add_or(p);
p.clear();
i1++;
for(int j = 0; j < 6; j++)
{
p.clear();
p.ad(i1 - 1);
p.ad(i1 - 8);
add_and(p);
i1++;
}
for(int j = 0; j < 7; j++)
{
p.clear();
p.ad(i1 - 7);
p.ad(i1 - 14);
add_xor(p);
i1++;
}
}
if(i == n - 1)
{
l1 = i1 - 7;
r1 = i1 - 1;
}
}
for (int i = 0; i < m; i++)
{
vector <int> p;
if(i == 0)
{
p.ad(col[i]);
add_or(p);
p.clear(), p.ad(col[n - 1]);
for(int j = 0; j < 6; j++) add_or(p);
i1 += 7;
}
else
{
p.ad(col[i]);
add_or(p);
p.clear();
i1++;
for(int j = 0; j < 6; j++)
{
p.clear();
p.ad(i1 - 1);
p.ad(i1 - 8);
add_and(p);
i1++;
}
for(int j = 0; j < 7; j++)
{
p.clear();
p.ad(i1 - 7);
p.ad(i1 - 14);
add_xor(p);
i1++;
}
}
if(i == m - 1)
{
l2 = i1 - 7;
r2 = i1 - 1;
}
}
vector <int> p;
zro = col[m - 1];
for (int i = 0; i < n; i++) p.ad(tox[i]);
for (int i = 0; i < m; i++) p.ad(col[i]);
mk = add_or(p);
i1 = mk + 1;
for (int i = 0; i < n; i++)
{
for(int j = 0; j < 7; j++)
{
p.clear();
p.ad(l1 + j);
if(i & (1 << j)) p.ad(mk);
else p.ad(zro);
add_xor(p);
i1++;
}
p.clear();
for(int j = 0; j < 7; j++)
p.ad(i1 - j - 1);
add_or(p);
i1++;
ka[i] = add_not(i1 - 1);
i1++;
}
for (int i = 0; i < m; i++)
{
for(int j = 0; j < 7; j++)
{
p.clear();
p.ad(l2 + j);
if(i & (1 << j)) p.ad(mk);
else p.ad(zro);
add_xor(p);
i1++;
}
p.clear();
for(int j = 0; j < 7; j++)
p.ad(i1 - j - 1);
add_or(p);
i1++;
ka1[i] = add_not(i1 - 1);
i1++;
}
int ii = -1;
for (int i = 0; i <= k; i++)
{
if(n <= i || k - i >= m) continue;
if(ii == -1) ii = i1;
p.clear();
p.ad(ka[i]);
p.ad(ka1[k - i]);
add_and(p);
i1++;
}
if(i1 == -1)
{
add_not(mk);
return;
}
p.clear();
for (int i = ii; i < i1; i++)
p.ad(i);
add_or(p);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
on inputs (0, 0), (0, 1), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
on inputs (0, 0), (0, 1), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
on inputs (0, 0), (0, 1), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
on inputs (0, 0), (0, 1), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
768 KB |
on inputs (0, 0), (0, 1), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
256 KB |
Output is correct |
3 |
Incorrect |
3 ms |
640 KB |
on inputs (0, 0), (0, 1), expected 1, but computed 0 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
16 ms |
1912 KB |
Output is correct |
2 |
Correct |
1 ms |
256 KB |
Output is correct |
3 |
Correct |
3 ms |
640 KB |
Output is correct |
4 |
Correct |
5 ms |
768 KB |
Output is correct |
5 |
Incorrect |
4 ms |
768 KB |
on inputs (0, 0), (0, 1), expected 1, but computed 0 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
on inputs (0, 0), (0, 1), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |