#include <iostream>
#include <set>
#include <vector>
#include "vision.h"
std::set<std::pair<std::pair<int,int>, std::pair<int, int>>> alreadyTried;
bool valid(int H, int W, int i, int j, int oI, int oJ){
if(oI < i || (oI == i && oJ < j)){
if(alreadyTried.find({{oI, oJ}, {i, j}}) != alreadyTried.end()){
return false;
} else {
alreadyTried.insert({{oI, oJ}, {i, j}});
}
} else {
if(alreadyTried.find({{i, j}, {oI, oJ}}) != alreadyTried.end()){
return false;
} else {
alreadyTried.insert({{i, j}, {oI, oJ}});
}
}
return i >= 0 && i < H && j >= 0 && j < W;
}
void construct_network(int H, int W, int K){
int ind = H*W, forbidden = -1;
for(int i = 0;i < H;i++){
for(int j = 0;j < W;j++){
for(int x = 0; x <= K;x++){
int y = K - abs(x);
if(valid(H, W, i+y, j+x, i, j)){
add_and({i*W+j, (i+y)*W + j+x});
ind++;
}
}
}
}
std::vector<int> vec;
for(int i = H*W;i < ind;i++){
if(i != forbidden) vec.push_back(i);
}
add_or(vec);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
0 ms |
256 KB |
Output is correct |
6 |
Incorrect |
1 ms |
256 KB |
on inputs (0, 1), (1, 0), expected 1, but computed 0 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
0 ms |
256 KB |
Output is correct |
6 |
Incorrect |
1 ms |
256 KB |
on inputs (0, 1), (1, 0), expected 1, but computed 0 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
0 ms |
256 KB |
Output is correct |
6 |
Incorrect |
1 ms |
256 KB |
on inputs (0, 1), (1, 0), expected 1, but computed 0 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
0 ms |
256 KB |
Output is correct |
6 |
Incorrect |
1 ms |
256 KB |
on inputs (0, 1), (1, 0), expected 1, but computed 0 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
7 ms |
1536 KB |
Output is correct |
3 |
Correct |
7 ms |
1536 KB |
Output is correct |
4 |
Correct |
13 ms |
2816 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
4 ms |
1152 KB |
Output is correct |
7 |
Correct |
9 ms |
2048 KB |
Output is correct |
8 |
Correct |
13 ms |
2816 KB |
Output is correct |
9 |
Correct |
1 ms |
384 KB |
Output is correct |
10 |
Correct |
4 ms |
1024 KB |
Output is correct |
11 |
Correct |
7 ms |
1536 KB |
Output is correct |
12 |
Correct |
7 ms |
1536 KB |
Output is correct |
13 |
Correct |
10 ms |
2176 KB |
Output is correct |
14 |
Correct |
15 ms |
2816 KB |
Output is correct |
15 |
Correct |
1 ms |
384 KB |
Output is correct |
16 |
Correct |
4 ms |
1024 KB |
Output is correct |
17 |
Correct |
7 ms |
1536 KB |
Output is correct |
18 |
Correct |
7 ms |
1536 KB |
Output is correct |
19 |
Correct |
10 ms |
2176 KB |
Output is correct |
20 |
Correct |
17 ms |
2816 KB |
Output is correct |
21 |
Correct |
1 ms |
384 KB |
Output is correct |
22 |
Correct |
1 ms |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
256 KB |
Output is correct |
3 |
Correct |
8 ms |
1276 KB |
Output is correct |
4 |
Incorrect |
9 ms |
2296 KB |
WA in grader: Too many instructions |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
1660 KB |
WA in grader: Too many instructions |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
0 ms |
256 KB |
Output is correct |
6 |
Incorrect |
1 ms |
256 KB |
on inputs (0, 1), (1, 0), expected 1, but computed 0 |
7 |
Halted |
0 ms |
0 KB |
- |