#include <bits/stdc++.h>
#include "vision.h"
/// #pragma GCC optimize ("Ofast")
/// #pragma GCC target ("avx2")
/// #pragma GCC optimize("unroll-loops")
using namespace std;
using ll = long long;
using ii = pair<ll, ll>;
using vi = vector<int>;
#define ff first
#define ss second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lb lower_bound
/// #define int ll
const int oo = 1e9 + 7;
int n, m; map<ii, int> vis;
int calc(int x, int y) {
return x * m + y;
}
int dist(int x, int y, int xx, int yy) {
return abs(x - xx) + abs(y - yy);
}
void sample(int H, int W, int K) {
n = H, m = W; vector<int> res;
for(int l = 0; l < n; l++) {
for(int i = 0; i < m; i++) {
for(int j = 0; j < n; j++) {
for(int k = 0; k < m; k++) {
int d = dist(l, i, j, k);
int a = calc(l, i), b = calc(j, k);
if(a > b) swap(a, b);
if(d == K && !vis.count({a, b})) {
res.pb(add_and({a, b}));
vis[{a, b}] = 1;
}
}
}
}
}
add_or(res);
}
void construct_network(int H, int W, int K) {
if(H == 2 && W == 3 && K == 3) {
sample(H, W, K); return;
}
n = H, m = W; vector<int> res;
int curr = n * n * m * m;
if(min(n, m) != 1) {
sample(H, W, K); return;
}
for(int l = 0; l < n; l++) {
for(int i = 0; i < m; i++) {
if(l + i == K) {
res.pb(add_and({0, calc(l, i)}));
}
}
}
add_or(res);
}
Compilation message
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:54:17: warning: unused variable 'curr' [-Wunused-variable]
54 | int curr = n * n * m * m;
| ^~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
on inputs (0, 1), (0, 2), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
on inputs (0, 1), (0, 2), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
on inputs (0, 1), (0, 2), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
on inputs (0, 1), (0, 2), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
on inputs (0, 1), (0, 2), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
20 ms |
1164 KB |
Output is correct |
4 |
Incorrect |
6 ms |
1616 KB |
WA in grader: Too many instructions |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
285 ms |
1748 KB |
WA in grader: Too many instructions |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
on inputs (0, 1), (0, 2), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |