#include <bits/stdc++.h>
#include "vision.h"
#pragma GCC optimize("O2,unroll-loops")
#define fio ios_base::sync_with_stdio(0);cin.tie(0);
#define ll long long
#define en cin.close();return 0;
#define pb push_back
#define fi first//printf("%lli\n",cur);
#define se second//scanf("%lli",&n);
#define r0 return 0;
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int check_if_less_than_k(int h, int w, int diagc, int k, vector<int> &vd1, vector<int> &vd2)
{
vector<int> xve1(diagc), xve2(diagc), ve;
for(int i = 0;i<diagc;i++)
{
vector<int> tmp = {vd1[i]};
if(i>0)
tmp.pb(xve1[i-1]);
xve1[i]=add_xor(tmp);
}
for(int i = k;i<diagc;i++)
ve.pb(add_and({xve1[i-k],xve1[i]}));
int p1 = add_not(add_or(ve));
ve.clear();
for(int i = 0;i<diagc;i++)
{
vector<int> tmp = {vd2[i]};
if(i>0)
tmp.pb(xve2[i-1]);
xve2[i]=add_xor(tmp);
}
for(int i = k;i<diagc;i++)
ve.pb(add_and({xve2[i-k],xve2[i]}));
int p2 = add_not(add_or(ve));
return add_and({p1,p2});
}
void construct_network(int h, int w, int k)
{
int diagc = h+w-1;
vector<int> d1[diagc], d2[diagc];
for(int i = 0;i<h;i++)
for(int j = 0;j<w;j++)
d1[i+j].pb(i*w+j),
d2[i-j+(w-1)].pb(i*w+j);
vector<int> vd1(diagc), vd2(diagc);
for(int i = 0;i<diagc;i++)
vd1[i]=add_or(d1[i]);
for(int i = 0;i<diagc;i++)
vd2[i]=add_or(d2[i]);
int p1 = check_if_less_than_k(h,w,diagc,k,vd1,vd2);
if(k==1)
return;
int p2 = check_if_less_than_k(h,w,diagc,k-1,vd1,vd2);
p2=add_not(p2);
add_and({p1,p2});
return;
}
# |
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 |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Incorrect |
0 ms |
300 KB |
on inputs (0, 1), (1, 0), expected 1, but computed 0 |
9 |
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 |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Incorrect |
0 ms |
300 KB |
on inputs (0, 1), (1, 0), expected 1, but computed 0 |
9 |
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 |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Incorrect |
0 ms |
300 KB |
on inputs (0, 1), (1, 0), expected 1, but computed 0 |
9 |
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 |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Incorrect |
0 ms |
300 KB |
on inputs (0, 1), (1, 0), expected 1, but computed 0 |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
436 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
2 ms |
340 KB |
Output is correct |
4 |
Correct |
2 ms |
340 KB |
Output is correct |
5 |
Correct |
2 ms |
432 KB |
Output is correct |
6 |
Correct |
2 ms |
468 KB |
Output is correct |
7 |
Correct |
2 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
468 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
1 ms |
468 KB |
Output is correct |
17 |
Correct |
1 ms |
468 KB |
Output is correct |
18 |
Correct |
1 ms |
340 KB |
Output is correct |
19 |
Correct |
1 ms |
440 KB |
Output is correct |
20 |
Correct |
2 ms |
340 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 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
2 ms |
468 KB |
Output is correct |
5 |
Correct |
1 ms |
468 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
432 KB |
Output is correct |
8 |
Correct |
2 ms |
596 KB |
Output is correct |
9 |
Correct |
4 ms |
620 KB |
Output is correct |
10 |
Correct |
2 ms |
596 KB |
Output is correct |
11 |
Correct |
2 ms |
596 KB |
Output is correct |
12 |
Correct |
2 ms |
468 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
1 ms |
468 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 |
428 KB |
Output is correct |
18 |
Correct |
1 ms |
432 KB |
Output is correct |
19 |
Correct |
1 ms |
340 KB |
Output is correct |
20 |
Correct |
5 ms |
980 KB |
Output is correct |
21 |
Correct |
6 ms |
1108 KB |
Output is correct |
22 |
Correct |
5 ms |
1108 KB |
Output is correct |
23 |
Correct |
5 ms |
980 KB |
Output is correct |
24 |
Correct |
11 ms |
980 KB |
Output is correct |
25 |
Correct |
6 ms |
1076 KB |
Output is correct |
26 |
Correct |
5 ms |
980 KB |
Output is correct |
27 |
Correct |
12 ms |
1748 KB |
Output is correct |
28 |
Incorrect |
9 ms |
1892 KB |
on inputs (0, 0), (50, 50), expected 1, but computed 0 |
29 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
1876 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
432 KB |
Output is correct |
4 |
Correct |
4 ms |
564 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
6 ms |
1056 KB |
Output is correct |
8 |
Correct |
5 ms |
980 KB |
Output is correct |
9 |
Correct |
9 ms |
1872 KB |
Output is correct |
10 |
Correct |
1 ms |
300 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
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 |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Incorrect |
0 ms |
300 KB |
on inputs (0, 1), (1, 0), expected 1, but computed 0 |
9 |
Halted |
0 ms |
0 KB |
- |