#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;
int l;
l = 3;
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 < l - 1; j++) add_or(p);
i1 += l;
}
else
{
p.ad(tox[i]);
add_or(p);
p.clear();
i1++;
for(int j = 0; j < l - 1; j++)
{
p.clear();
p.ad(i1 - 1);
p.ad(i1 - l - 1);
add_and(p);
i1++;
}
for(int j = 0; j < l; j++)
{
p.clear();
p.ad(i1 - l);
p.ad(i1 - l * 2);
add_xor(p);
i1++;
}
p.clear();
p.ad(col[m - 1]);
if(i == (1 << l) - 3) add_or(p), l++;
}
if(i == n - 1)
{
l1 = i1 - l;
r1 = i1 - 1;
}
}
l = 3;
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[m - 1]);
for(int j = 0; j < l - 1; j++) add_or(p);
i1 += l;
}
else
{
//cout << i1 << endl;
p.clear();
p.ad(col[i]);
add_or(p);
i1++;
for(int j = 0; j < l - 1; j++)
{
p.clear();
p.ad(i1 - 1);
p.ad(i1 - l - 1);
add_and(p);
i1++;
}
for(int j = 0; j < l; j++)
{
p.clear();
p.ad(i1 - l);
p.ad(i1 - l * 2);
add_xor(p);
i1++;
}
p.clear();
p.ad(col[m - 1]);
if(i == (1 << l) - 3) add_or(p), l++;
}
if(i == m - 1)
{
l2 = i1 - l;
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;
l = 3;
for (int i = 0; i < n; i++)
{
if(i == (1 << l) - 3) l++;
for(int j = 0; j < l; 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 < l; j++)
p.ad(i1 - j - 1);
add_or(p);
i1++;
ka[i] = add_not(i1 - 1);
i1++;
}
l = 3;
for (int i = 0; i < m; i++)
{
if(i == (1 << l) - 3) l++;
for(int j = 0; j < l; 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 < l; 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++;
}
p.clear();
for (int i = ii; i < i1; i++)
p.ad(i);
add_or(p);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
1 ms |
256 KB |
Output is correct |
6 |
Correct |
1 ms |
256 KB |
Output is correct |
7 |
Correct |
1 ms |
384 KB |
Output is correct |
8 |
Correct |
1 ms |
384 KB |
Output is correct |
9 |
Correct |
1 ms |
256 KB |
Output is correct |
10 |
Correct |
1 ms |
256 KB |
Output is correct |
11 |
Correct |
1 ms |
256 KB |
Output is correct |
12 |
Correct |
1 ms |
256 KB |
Output is correct |
13 |
Correct |
1 ms |
384 KB |
Output is correct |
14 |
Correct |
1 ms |
384 KB |
Output is correct |
15 |
Correct |
1 ms |
384 KB |
Output is correct |
16 |
Correct |
1 ms |
384 KB |
Output is correct |
17 |
Correct |
1 ms |
256 KB |
Output is correct |
18 |
Correct |
1 ms |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
1 ms |
256 KB |
Output is correct |
6 |
Correct |
1 ms |
256 KB |
Output is correct |
7 |
Correct |
1 ms |
384 KB |
Output is correct |
8 |
Correct |
1 ms |
384 KB |
Output is correct |
9 |
Correct |
1 ms |
256 KB |
Output is correct |
10 |
Correct |
1 ms |
256 KB |
Output is correct |
11 |
Correct |
1 ms |
256 KB |
Output is correct |
12 |
Correct |
1 ms |
256 KB |
Output is correct |
13 |
Correct |
1 ms |
384 KB |
Output is correct |
14 |
Correct |
1 ms |
384 KB |
Output is correct |
15 |
Correct |
1 ms |
384 KB |
Output is correct |
16 |
Correct |
1 ms |
384 KB |
Output is correct |
17 |
Correct |
1 ms |
256 KB |
Output is correct |
18 |
Correct |
1 ms |
256 KB |
Output is correct |
19 |
Incorrect |
1 ms |
256 KB |
on inputs (0, 0), (0, 3), expected 1, but computed 0 |
20 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
1 ms |
256 KB |
Output is correct |
6 |
Correct |
1 ms |
256 KB |
Output is correct |
7 |
Correct |
1 ms |
384 KB |
Output is correct |
8 |
Correct |
1 ms |
384 KB |
Output is correct |
9 |
Correct |
1 ms |
256 KB |
Output is correct |
10 |
Correct |
1 ms |
256 KB |
Output is correct |
11 |
Correct |
1 ms |
256 KB |
Output is correct |
12 |
Correct |
1 ms |
256 KB |
Output is correct |
13 |
Correct |
1 ms |
384 KB |
Output is correct |
14 |
Correct |
1 ms |
384 KB |
Output is correct |
15 |
Correct |
1 ms |
384 KB |
Output is correct |
16 |
Correct |
1 ms |
384 KB |
Output is correct |
17 |
Correct |
1 ms |
256 KB |
Output is correct |
18 |
Correct |
1 ms |
256 KB |
Output is correct |
19 |
Incorrect |
1 ms |
256 KB |
on inputs (0, 0), (0, 3), expected 1, but computed 0 |
20 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
1 ms |
256 KB |
Output is correct |
6 |
Correct |
1 ms |
256 KB |
Output is correct |
7 |
Correct |
1 ms |
384 KB |
Output is correct |
8 |
Correct |
1 ms |
384 KB |
Output is correct |
9 |
Correct |
1 ms |
256 KB |
Output is correct |
10 |
Correct |
1 ms |
256 KB |
Output is correct |
11 |
Correct |
1 ms |
256 KB |
Output is correct |
12 |
Correct |
1 ms |
256 KB |
Output is correct |
13 |
Correct |
1 ms |
384 KB |
Output is correct |
14 |
Correct |
1 ms |
384 KB |
Output is correct |
15 |
Correct |
1 ms |
384 KB |
Output is correct |
16 |
Correct |
1 ms |
384 KB |
Output is correct |
17 |
Correct |
1 ms |
256 KB |
Output is correct |
18 |
Correct |
1 ms |
256 KB |
Output is correct |
19 |
Incorrect |
1 ms |
256 KB |
on inputs (0, 0), (0, 3), expected 1, but computed 0 |
20 |
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 |
256 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 |
Incorrect |
16 ms |
1912 KB |
on inputs (96, 130), (143, 84), expected 0, but computed 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
1 ms |
256 KB |
Output is correct |
6 |
Correct |
1 ms |
256 KB |
Output is correct |
7 |
Correct |
1 ms |
384 KB |
Output is correct |
8 |
Correct |
1 ms |
384 KB |
Output is correct |
9 |
Correct |
1 ms |
256 KB |
Output is correct |
10 |
Correct |
1 ms |
256 KB |
Output is correct |
11 |
Correct |
1 ms |
256 KB |
Output is correct |
12 |
Correct |
1 ms |
256 KB |
Output is correct |
13 |
Correct |
1 ms |
384 KB |
Output is correct |
14 |
Correct |
1 ms |
384 KB |
Output is correct |
15 |
Correct |
1 ms |
384 KB |
Output is correct |
16 |
Correct |
1 ms |
384 KB |
Output is correct |
17 |
Correct |
1 ms |
256 KB |
Output is correct |
18 |
Correct |
1 ms |
256 KB |
Output is correct |
19 |
Incorrect |
1 ms |
256 KB |
on inputs (0, 0), (0, 3), expected 1, but computed 0 |
20 |
Halted |
0 ms |
0 KB |
- |