#include "vision.h"
#ifndef EVAL
#include "grader.cpp"
#endif
#include <bits/stdc++.h>
using namespace std;
void construct_network(int n, int m, int K){
auto valid = [&](int i, int j) -> int {
return 0 <= i && i < n && 0 <= j && j < m;
};
auto idx = [&](int i, int j) -> int {
return i * m + j;
};
int ptr = n * m;
vector<int> res;
for (int i = 0; i < n; i++){
for (int j = 0; j < m; j++){
if (valid(i + K, j)){
add_and({idx(i + K, j)});
res.push_back(ptr++);
}
for (int k = 1; k <= K; k++){
if (valid(i + (K - k), j - k)){
add_and({idx(i, j), idx(i + (K - k), j - k)});
res.push_back(ptr++);
}
if (valid(i + (K - k), j + k)){
add_and({idx(i, j), idx(i + (K - k), j + k)});
res.push_back(ptr++);
}
}
}
}
add_or(res);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
0 ms |
212 KB |
on inputs (0, 0), (2, 0), expected 0, but computed 1 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
0 ms |
212 KB |
on inputs (0, 0), (2, 0), expected 0, but computed 1 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
0 ms |
212 KB |
on inputs (0, 0), (2, 0), expected 0, but computed 1 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
0 ms |
212 KB |
on inputs (0, 0), (2, 0), expected 0, but computed 1 |
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 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Incorrect |
1 ms |
212 KB |
on inputs (1, 0), (2, 0), expected 0, but computed 1 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
on inputs (0, 0), (1, 1), expected 0, but computed 1 |
2 |
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 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
0 ms |
212 KB |
on inputs (0, 0), (2, 0), expected 0, but computed 1 |
4 |
Halted |
0 ms |
0 KB |
- |