#include "vision.h"
#include <bits/stdc++.h>
#define X first
#define Y second
#define MP make_pair
#define ll long long
using namespace std;
const int N = 300;
void build(int n, int (&arr)[N], const int (&mem)[N]){
for(int it = 0;(1 << it) < n;it++){
vector< int > fin;
for(int i1 = 0;i1 + 1 < n;i1++){
vector<int> tmp;
for(int i2 = i1 + 1;i2 < n;i2++){
if(((i2 - i1) >> it) & 1){
tmp.push_back(mem[i2]);
}
}
if(tmp.empty()) continue;
int v = add_xor(tmp);
v = add_and({mem[i1], v});
fin.push_back(v);
}
arr[it] = add_or(fin);
}
}
int prep(int len, int n, const int (&arr)[N]){
int v;
if(len == 0){
vector<int> tmp;
for(int i = 0;i < n;i++){
tmp.push_back(arr[i]);
}
v = add_xor(tmp);
}
else{
vector<int> tmp;
for(int i = 0;(1 << i) <= len;i++){
if((len >> i) & 1) tmp.push_back(arr[i]);
}
v = add_and(tmp);
}
return v;
}
int isRow[N], isCol[N];
int bRow[N], bCol[N];
void construct_network(int H, int W, int K) {
for(int i = 0;i < H;i++){
vector<int> tmp;
for(int j = 0;j < W;j++){
tmp.push_back(W * i + j);
}
isRow[i] = add_or(tmp);
}
for(int j = 0;j < W;j++){
vector<int> tmp;
for(int i = 0;i < H;i++){
tmp.push_back(W * i + j);
}
isCol[j] = add_or(tmp);
}
build(H, bRow, isRow);
build(W, bCol, isCol);
vector< int > fin;
for(int i = 0;i < H;i++){
for(int j = 0;j < W;j++){
if(i + j == K){
if(i == 0 && j == 7) assert(0);
int x = prep(i, H, i == 0 ? isRow: bRow);
int y = prep(j, W, j == 0 ? isCol: bCol);
fin.push_back(add_and({x, y}));
}
}
}
add_or(fin);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
224 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
224 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |
11 |
Correct |
1 ms |
204 KB |
Output is correct |
12 |
Correct |
1 ms |
204 KB |
Output is correct |
13 |
Correct |
1 ms |
204 KB |
Output is correct |
14 |
Correct |
1 ms |
204 KB |
Output is correct |
15 |
Correct |
1 ms |
256 KB |
Output is correct |
16 |
Correct |
1 ms |
204 KB |
Output is correct |
17 |
Correct |
1 ms |
236 KB |
Output is correct |
18 |
Correct |
1 ms |
272 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
224 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
224 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |
11 |
Correct |
1 ms |
204 KB |
Output is correct |
12 |
Correct |
1 ms |
204 KB |
Output is correct |
13 |
Correct |
1 ms |
204 KB |
Output is correct |
14 |
Correct |
1 ms |
204 KB |
Output is correct |
15 |
Correct |
1 ms |
256 KB |
Output is correct |
16 |
Correct |
1 ms |
204 KB |
Output is correct |
17 |
Correct |
1 ms |
236 KB |
Output is correct |
18 |
Correct |
1 ms |
272 KB |
Output is correct |
19 |
Incorrect |
1 ms |
204 KB |
on inputs (0, 0), (0, 7), expected 0, but computed 1 |
20 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
224 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
224 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |
11 |
Correct |
1 ms |
204 KB |
Output is correct |
12 |
Correct |
1 ms |
204 KB |
Output is correct |
13 |
Correct |
1 ms |
204 KB |
Output is correct |
14 |
Correct |
1 ms |
204 KB |
Output is correct |
15 |
Correct |
1 ms |
256 KB |
Output is correct |
16 |
Correct |
1 ms |
204 KB |
Output is correct |
17 |
Correct |
1 ms |
236 KB |
Output is correct |
18 |
Correct |
1 ms |
272 KB |
Output is correct |
19 |
Incorrect |
1 ms |
204 KB |
on inputs (0, 0), (0, 7), expected 0, but computed 1 |
20 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
224 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
224 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |
11 |
Correct |
1 ms |
204 KB |
Output is correct |
12 |
Correct |
1 ms |
204 KB |
Output is correct |
13 |
Correct |
1 ms |
204 KB |
Output is correct |
14 |
Correct |
1 ms |
204 KB |
Output is correct |
15 |
Correct |
1 ms |
256 KB |
Output is correct |
16 |
Correct |
1 ms |
204 KB |
Output is correct |
17 |
Correct |
1 ms |
236 KB |
Output is correct |
18 |
Correct |
1 ms |
272 KB |
Output is correct |
19 |
Incorrect |
1 ms |
204 KB |
on inputs (0, 0), (0, 7), expected 0, but computed 1 |
20 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
10 ms |
972 KB |
on inputs (0, 0), (0, 3), expected 0, but computed 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
224 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
4 ms |
588 KB |
Output is correct |
4 |
Incorrect |
6 ms |
588 KB |
on inputs (0, 0), (29, 3), expected 0, but computed 1 |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
31 ms |
2772 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
6 ms |
588 KB |
Output is correct |
4 |
Correct |
7 ms |
844 KB |
Output is correct |
5 |
Incorrect |
12 ms |
912 KB |
on inputs (0, 0), (0, 3), expected 0, but computed 1 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
224 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
224 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |
11 |
Correct |
1 ms |
204 KB |
Output is correct |
12 |
Correct |
1 ms |
204 KB |
Output is correct |
13 |
Correct |
1 ms |
204 KB |
Output is correct |
14 |
Correct |
1 ms |
204 KB |
Output is correct |
15 |
Correct |
1 ms |
256 KB |
Output is correct |
16 |
Correct |
1 ms |
204 KB |
Output is correct |
17 |
Correct |
1 ms |
236 KB |
Output is correct |
18 |
Correct |
1 ms |
272 KB |
Output is correct |
19 |
Incorrect |
1 ms |
204 KB |
on inputs (0, 0), (0, 7), expected 0, but computed 1 |
20 |
Halted |
0 ms |
0 KB |
- |