#include "vision.h"
#include <iostream>
#include <vector>
#define andd add_and
#define orr add_or
#define xorr add_xor
using namespace std;
int vert[210], hor[210], u[210], d[210], l[210], r[210], pos, xx[410], yy[410], x, y;
vector<int> tmp, ns;
void construct_network(int n, int m, int k) {
for (int i = 0; i < n; i++) {
tmp.clear();
for (int j = 0; j < m; j++) tmp.push_back(i*m+j);
hor[i] = orr(tmp);
}
u[0] = hor[0];
d[n-1] = hor[n-1];
for (int i = 1; i < n; i++) u[i] = orr({u[i-1],hor[i]});
for (int i = n-2; i >= 0; i--) d[i] = orr({d[i+1],hor[i]});
for (int i = k+1; i < n; i++) ns.push_back(andd({hor[i],u[i-k-1]}));
for (int i = n-k-2; i >= 0; i--) ns.push_back(andd({hor[i],d[i+k+1]}));
for (int i = 0; i < m; i++) {
tmp.clear();
for (int j = 0; j < n; j++) tmp.push_back(j*m+i);
vert[i] = orr(tmp);
}
l[0] = vert[0];
r[m-1] = vert[m-1];
for (int i = 1; i < m; i++) l[i] = orr({l[i-1],vert[i]});
for (int i = m-2; i >= 0; i--) r[i] = orr({r[i+1],vert[i]});
for (int i = k+1; i < m; i++) ns.push_back(andd({vert[i],l[i-k-1]}));
for (int i = m-k-2; i >= 0; i--) ns.push_back(andd({vert[i],r[i+k+1]}));
if (ns.size()) pos = add_not(orr(ns));
ns.clear();
for (int i = 0; i <= 400; i++) {
tmp.clear();
x = n; y = i;
while ((x >= 0) && (y >= 0)) {
if ((x < n) && (y < m)) tmp.push_back(x*m+y);
x--; y--;
}
if (tmp.size()) xx[i] = orr(tmp);
}
for (int i = 0; xx[i+k]; i++) ns.push_back(andd({xx[i],xx[i+k]}));
for (int i = 0; i <= 400; i++) {
tmp.clear();
x = 0; y = i;
while ((x < n) && (y >= 0)) {
if ((0 <= x) && (y < m)) tmp.push_back(x*m+y);
x++; y--;
}
if (tmp.size()) yy[i] = orr(tmp);
}
for (int i = 0; yy[i+k]; i++) ns.push_back(andd({yy[i],yy[i+k]}));
if (pos) andd({pos,orr(ns)});
else orr(ns);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Incorrect |
1 ms |
348 KB |
on inputs (0, 0), (0, 98), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
600 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
15 ms |
2140 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
2 ms |
604 KB |
Output is correct |
4 |
Correct |
3 ms |
604 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
8 ms |
1372 KB |
Output is correct |
8 |
Correct |
8 ms |
1208 KB |
Output is correct |
9 |
Correct |
15 ms |
2140 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |