#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
int solve1D(int N, int start, int K){
vector<int> v;
for(int i = 0; i < N-K; i++){
v.push_back(add_and({start+i, start+i+K}));
}
return add_or(v);
}
void construct_network(int H, int W, int K) {
int row_start = -1, col_start = -1;
for(int i = 0; i < H; i++){
vector<int> v;
for(int j = 0; j < W; j++) v.push_back(i*W+j);
int x = add_or(v);
if(i == 0) row_start = x;
}
for(int j = 0; j < W; j++){
vector<int> v;
for(int i = 0; i < H; i++) v.emplace_back(i*W+j);
int x = add_or(v);
if(j == 0) col_start = x;
}
vector<int> row(H), col(W);
{ // k = 0
vector<int> v;
for(int i = 0; i < H; i++) v.push_back(row_start+i);
row[0] = add_xor(v);
v.clear();
for(int i = 0; i < W; i++) v.push_back(col_start+1);
col[0] = add_xor(v);
}
for(int k = 1; k < H; k++){
row[k] = solve1D(H, row_start, k);
}
for(int k = 1; k < W; k++){
col[k] = solve1D(W, col_start, k);
}
vector<int> todo;
for(int kr = 0; kr < H; kr++){
int kc = K-kr;
if(kc >= 0 && kc < W){
todo.push_back(add_and({row[kr], col[kc]}));
}
}
add_or(todo);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Incorrect |
1 ms |
304 KB |
on inputs (0, 0), (1, 0), expected 1, but computed 0 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Incorrect |
1 ms |
304 KB |
on inputs (0, 0), (1, 0), expected 1, but computed 0 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Incorrect |
1 ms |
304 KB |
on inputs (0, 0), (1, 0), expected 1, but computed 0 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Incorrect |
1 ms |
304 KB |
on inputs (0, 0), (1, 0), expected 1, but computed 0 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
1104 KB |
WA in grader: Too many instructions |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
296 KB |
on inputs (0, 0), (1, 0), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
1360 KB |
WA in grader: Too many instructions |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Incorrect |
1 ms |
304 KB |
on inputs (0, 0), (1, 0), expected 1, but computed 0 |
4 |
Halted |
0 ms |
0 KB |
- |