#include "vision.h"
#include "bits/stdc++.h"
#define FOR(i, begin, end) for(int i=(begin); i<(end); i++)
#define pb push_back
#define s second
#define f first
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int MxN=210;
int h, w, k, g[MxN][MxN], l[2*MxN], r[2*MxN], l_sz, r_sz;
void construct_network(int H, int W, int K) {
h=H; w=W; k=K;
int in=0;
FOR(i, 0, h) {
FOR(j, 0, w) {
g[i][j]=in++;
}
}
in=0;
for(int i=h-1; i>=0; i--) {
int j=0;
vi ar;
FOR(k, 0, max(h, w)) {
if(i+k>=h || j+k>=w) break;
ar.pb(g[i][j]);
}
l[in++]=add_or(ar);
}
FOR(j, 1, w) {
int i=0;
vi ar;
FOR(k, 0, max(h, w)) {
if(i+k>=h || j+k>=w) break;
ar.pb(g[i+k][j+k]);
}
l[in++]=add_or(ar);
}
l_sz=in;
in=0;
FOR(j, 0, w) {
int i=0;
vi ar;
FOR(k, 0, max(h,w)) {
if(i+k>=h || j-k<0) break;
ar.pb(g[i+k][j-k]);
}
r[in++]=add_or(ar);
}
FOR(i, 1, h) {
int j=w-1;
vi ar;
FOR(k, 0, max(h, w)) {
if(i+k>=h || j-k<0) break;
ar.pb(g[i+k][j-k]);
}
r[in++]=add_or(ar);
}
r_sz=in;
vi tmp;
FOR(i, 0, l_sz) {
if(i+k>=l_sz) break;
tmp.pb(add_and({l[i], l[i+k]}));
}
int l_ok=add_or(tmp);
tmp.clear();
FOR(i, 0, r_sz) {
if(i+k>=r_sz) break;
tmp.pb(add_and({r[i], r[i+k]}));
}
int r_ok=add_or(tmp);
tmp.clear();
FOR(i, 0, l_sz) {
if(i+k>=l_sz) break;
vi ins;
FOR(j, i, i+k+1) {
ins.pb(l[j]);
}
ins.pb(add_or(ins));
tmp.pb(add_xor(ins));
}
int l_block=add_or(tmp);
tmp.clear();
FOR(i, 0, r_sz) {
if(i+k>=r_sz) break;
vi ins;
FOR(j, i, i+k+1) {
ins.pb(r[j]);
}
ins.pb(add_or(ins));
tmp.pb(add_xor(ins));
}
int r_block=add_or(tmp);
int x=add_and({l_ok, r_block}), y=add_and({r_ok, l_block});
add_or({x, y});
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
352 KB |
Output is correct |
2 |
Correct |
1 ms |
604 KB |
Output is correct |
3 |
Correct |
0 ms |
604 KB |
Output is correct |
4 |
Correct |
1 ms |
504 KB |
Output is correct |
5 |
Incorrect |
0 ms |
348 KB |
on inputs (0, 1), (1, 1), expected 1, but computed 0 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
352 KB |
Output is correct |
2 |
Correct |
1 ms |
604 KB |
Output is correct |
3 |
Correct |
0 ms |
604 KB |
Output is correct |
4 |
Correct |
1 ms |
504 KB |
Output is correct |
5 |
Incorrect |
0 ms |
348 KB |
on inputs (0, 1), (1, 1), expected 1, but computed 0 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
352 KB |
Output is correct |
2 |
Correct |
1 ms |
604 KB |
Output is correct |
3 |
Correct |
0 ms |
604 KB |
Output is correct |
4 |
Correct |
1 ms |
504 KB |
Output is correct |
5 |
Incorrect |
0 ms |
348 KB |
on inputs (0, 1), (1, 1), expected 1, but computed 0 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
352 KB |
Output is correct |
2 |
Correct |
1 ms |
604 KB |
Output is correct |
3 |
Correct |
0 ms |
604 KB |
Output is correct |
4 |
Correct |
1 ms |
504 KB |
Output is correct |
5 |
Incorrect |
0 ms |
348 KB |
on inputs (0, 1), (1, 1), expected 1, but computed 0 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
440 KB |
Output is correct |
2 |
Correct |
4 ms |
604 KB |
Output is correct |
3 |
Correct |
2 ms |
860 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
604 KB |
Output is correct |
6 |
Correct |
2 ms |
860 KB |
Output is correct |
7 |
Correct |
2 ms |
908 KB |
Output is correct |
8 |
Correct |
1 ms |
600 KB |
Output is correct |
9 |
Correct |
2 ms |
344 KB |
Output is correct |
10 |
Correct |
4 ms |
604 KB |
Output is correct |
11 |
Correct |
2 ms |
604 KB |
Output is correct |
12 |
Correct |
2 ms |
600 KB |
Output is correct |
13 |
Correct |
2 ms |
604 KB |
Output is correct |
14 |
Correct |
1 ms |
440 KB |
Output is correct |
15 |
Correct |
1 ms |
600 KB |
Output is correct |
16 |
Correct |
3 ms |
860 KB |
Output is correct |
17 |
Correct |
4 ms |
860 KB |
Output is correct |
18 |
Correct |
2 ms |
860 KB |
Output is correct |
19 |
Correct |
3 ms |
824 KB |
Output is correct |
20 |
Correct |
0 ms |
604 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
604 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
on inputs (0, 0), (1, 1), expected 1, but computed 0 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
10 ms |
1624 KB |
on inputs (196, 156), (197, 156), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
352 KB |
Output is correct |
2 |
Correct |
1 ms |
604 KB |
Output is correct |
3 |
Correct |
0 ms |
604 KB |
Output is correct |
4 |
Correct |
1 ms |
504 KB |
Output is correct |
5 |
Incorrect |
0 ms |
348 KB |
on inputs (0, 1), (1, 1), expected 1, but computed 0 |
6 |
Halted |
0 ms |
0 KB |
- |