#include "vision.h"
#include <iostream>
using namespace std;
const int nmax=1005;
vector<int> d1[nmax],d2[nmax];
int wh1[nmax],wh2[nmax],ps1[nmax],ps2[nmax];
int nr,n,m,i,j;
int enc(int i,int j)
{
return n*i+j;
}
int solve(int k)
{
vector<int> arg;
for(i=k;i<=n+m-2;i++)
arg.push_back(add_and({wh1[i],ps1[i-k]}));
for(i=k;i<=n+m-2;i++)
arg.push_back(add_and({wh2[i],ps2[i-k]}));
return add_or(arg);
}
void construct_network(int H, int W, int K) {
vector<int> Ns;
nr=H*W-1;
n=H,m=W;
for(i=0;i<H;i++)
for(j=0;j<W;j++)
{
d1[i+j].push_back(enc(i,j));
d2[j-i+H-1].push_back(enc(i,j));
}
for(i=0;i<=H+W-2;i++)
{
wh1[i]=add_or(d1[i]);
if(i==0) ps1[i]=wh1[i];
else ps1[i]=add_or({ps1[i-1],wh1[i]});
}
for(i=0;i<=H+W-2;i++)
{
wh2[i]=add_or(d2[i]);
if(i==0) ps2[i]=wh2[i];
else ps2[i]=add_or({ps2[i-1],wh2[i]});
}
Ns.push_back(solve(K));
if(K+1<=H+W-2)Ns.push_back(solve(K+1));
add_xor(Ns);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Incorrect |
2 ms |
248 KB |
WA in grader: Invalid index |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Incorrect |
2 ms |
248 KB |
WA in grader: Invalid index |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Incorrect |
2 ms |
248 KB |
WA in grader: Invalid index |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Incorrect |
2 ms |
248 KB |
WA in grader: Invalid index |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
500 KB |
Output is correct |
2 |
Correct |
3 ms |
504 KB |
Output is correct |
3 |
Correct |
3 ms |
504 KB |
Output is correct |
4 |
Correct |
3 ms |
504 KB |
Output is correct |
5 |
Incorrect |
2 ms |
376 KB |
WA in grader: Invalid index |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Incorrect |
2 ms |
376 KB |
WA in grader: Invalid index |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
15 ms |
1832 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Incorrect |
2 ms |
376 KB |
WA in grader: Invalid index |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Incorrect |
2 ms |
248 KB |
WA in grader: Invalid index |
4 |
Halted |
0 ms |
0 KB |
- |