#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
int posl[405][405], posr[405][405];
int h, w;
int pos(int i, int j){
return i*w+j;
}
void construct_network(int n, int m, int k) {
h = n, w = m;
int timer = n*m;
for(int p=0;p<n;p++){
int i=p,j=0;
posl[i][j] = add_or({pos(i,j)});
i--,j++;
timer++;
while(i >= 0 && j < m){
posl[i][j] = add_or({timer-1, pos(i, j)});timer++;
i--, j++;
}
}for(int p=1;p<m;p++){
int i=n-1,j=p;
posl[i][j] = add_or({pos(i,j)});
i--,j++;
timer++;
while(i >= 0 && j < m){
posl[i][j] = add_or({timer-1, pos(i, j)});
timer++;
i--, j++;
}
}
for(int p=0;p<n;p++){
int i=p,j=0;
posl[i][j] = add_or({pos(i,j)});
i++,j++;
timer++;
while(i < n && j < m){
posr[i][j] = add_or({timer-1, pos(i, j)});timer++;
i++, j++;
}
}for(int p=1;p<m;p++){
int i=0,j=p;
posr[i][j] = add_or({pos(i,j)});
i++,j++;
timer++;
while(i < n && j < m){
posr[i][j] = add_or({timer-1, pos(i, j)});timer++;
i++, j++;
}
}
vector<int> v;
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
int x1 = i+k, y1 = j;
while(x1 > i && y1+1 < m)x1--, y1++;
int x2 =x1, y2 = y1;
while(x2+1 < n && y2 > j)x2++, y2--;
if(x1 < n && y1 < m && x1 >= 0 && y1 >= 0){
if(x2+1 < n || y2-1 >= 0){
int t1 = add_not(posl[x2+1][y2-1]);
int t = add_and({t1, posl[x1][y1], pos(i, j)});
v.push_back(t);
}else {
int t = add_and({posl[x1][y1], pos(i, j)});
v.push_back(t);
}
//cout << x1 << ' ' << y1 << "; " << x2 << ' ' << y2 << '\n';
}x1 = i, y1 = j-k;
while(x1+1 < n && y1 < j)x1++, y1++;
x2 = x1, y2=y1;
while(x2 > i && y2-1 >= 0)x2--, y2--;
if(x1 < n && y1 < m && x1 >= 0 && y1 >= 0){
if(x2-1 >= 0 || y2-1 >= 0){
int t1 = add_not(posr[x2-1][y2-1]);
int t = add_and({t1, posr[x1][y1], pos(i, j)});
v.push_back(t);
}else {
int t = add_and({posr[x1][y1], pos(i, j)});
v.push_back(t);
}//cout << x1 << ' ' << y1 << "; " << x2 << ' ' << y2 << "\n\n";
}
}
}add_or(v);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Incorrect |
1 ms |
384 KB |
on inputs (0, 0), (1, 0), expected 1, but computed 0 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Incorrect |
1 ms |
384 KB |
on inputs (0, 0), (1, 0), expected 1, but computed 0 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Incorrect |
1 ms |
384 KB |
on inputs (0, 0), (1, 0), expected 1, but computed 0 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Incorrect |
1 ms |
384 KB |
on inputs (0, 0), (1, 0), expected 1, but computed 0 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
WA in grader: Invalid index |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Incorrect |
1 ms |
256 KB |
on inputs (0, 0), (1, 1), expected 1, but computed 0 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
1276 KB |
WA in grader: Too many instructions |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Incorrect |
1 ms |
384 KB |
on inputs (0, 0), (1, 0), expected 1, but computed 0 |
4 |
Halted |
0 ms |
0 KB |
- |