#include "vision.h"
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vii;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vii> vvii;
typedef vector<vll> vvll;
typedef vector<vpii> vvpii;
typedef vector<vpll> vvpll;
#define ffor(i, a, b) for (ll i = a; i < b; i++)
#define rep(i, n) ffor(i, 0, n)
#define forin(x, a) for (auto &x: a)
#define all(a) a.begin(), a.end()
void construct_network(int H, int W, int K) {
map<int, vii> diaga, diagb;
rep(i, H) {
rep(j, W) {
int k = W * i + j;
diaga[i + j].emplace_back(k);
diagb[i - j].emplace_back(k);
}
}
vii inda, indb, res;
forin(diag, diaga) {
inda.emplace_back(add_or(diag.second));
}
forin(diag, diagb) {
indb.emplace_back(add_or(diag.second));
}
vii deltaa, deltab;
vii dkaa, dkbb, ckaa, ckbb;
rep(i, inda.size() - K) {
dkaa.emplace_back(add_and({inda[i], inda[i + K]}));
vii curr;
ffor(j, i, i + K + 1) {
forin(pnt, diaga[j]) {
curr.emplace_back(pnt);
}
}
int pres = add_or(curr);
int odd = add_not(add_xor(curr));
ckaa.emplace_back(add_and({pres, odd}));
}
rep(i, indb.size() - K) {
dkbb.emplace_back(add_and({indb[i], indb[i + K]}));
vii curr;
ffor(j, i, i + K + 1) {
forin(pnt, diaga[j + diaga.begin()->first]) {
curr.emplace_back(pnt);
}
}
int pres = add_or(curr);
int odd = add_not(add_xor(curr));
ckbb.emplace_back(add_and({pres, odd}));
}
int dka = add_or(dkaa), dkb = add_or(dkbb), cka = add_or(ckaa), ckb = add_or(ckbb);
add_and({add_or({dka, dkb}), cka, ckb});
}
Compilation message
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:19:40: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
19 | #define ffor(i, a, b) for (ll i = a; i < b; i++)
| ^
vision.cpp:20:19: note: in expansion of macro 'ffor'
20 | #define rep(i, n) ffor(i, 0, n)
| ^~~~
vision.cpp:42:2: note: in expansion of macro 'rep'
42 | rep(i, inda.size() - K) {
| ^~~
vision.cpp:19:40: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
19 | #define ffor(i, a, b) for (ll i = a; i < b; i++)
| ^
vision.cpp:20:19: note: in expansion of macro 'ffor'
20 | #define rep(i, n) ffor(i, 0, n)
| ^~~~
vision.cpp:54:2: note: in expansion of macro 'rep'
54 | rep(i, indb.size() - K) {
| ^~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 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 |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
0 ms |
204 KB |
Output is correct |
7 |
Incorrect |
0 ms |
204 KB |
on inputs (0, 2), (1, 0), expected 0, but computed 1 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 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 |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
0 ms |
204 KB |
Output is correct |
7 |
Incorrect |
0 ms |
204 KB |
on inputs (0, 2), (1, 0), expected 0, but computed 1 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 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 |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
0 ms |
204 KB |
Output is correct |
7 |
Incorrect |
0 ms |
204 KB |
on inputs (0, 2), (1, 0), expected 0, but computed 1 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 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 |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
0 ms |
204 KB |
Output is correct |
7 |
Incorrect |
0 ms |
204 KB |
on inputs (0, 2), (1, 0), expected 0, but computed 1 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
556 KB |
Output is correct |
2 |
Correct |
6 ms |
716 KB |
Output is correct |
3 |
Correct |
6 ms |
716 KB |
Output is correct |
4 |
Correct |
1 ms |
332 KB |
Output is correct |
5 |
Correct |
2 ms |
588 KB |
Output is correct |
6 |
Correct |
6 ms |
716 KB |
Output is correct |
7 |
Correct |
6 ms |
588 KB |
Output is correct |
8 |
Correct |
1 ms |
332 KB |
Output is correct |
9 |
Correct |
2 ms |
460 KB |
Output is correct |
10 |
Correct |
5 ms |
588 KB |
Output is correct |
11 |
Correct |
6 ms |
736 KB |
Output is correct |
12 |
Correct |
8 ms |
716 KB |
Output is correct |
13 |
Correct |
5 ms |
544 KB |
Output is correct |
14 |
Correct |
1 ms |
332 KB |
Output is correct |
15 |
Correct |
2 ms |
460 KB |
Output is correct |
16 |
Correct |
5 ms |
684 KB |
Output is correct |
17 |
Correct |
6 ms |
716 KB |
Output is correct |
18 |
Correct |
8 ms |
716 KB |
Output is correct |
19 |
Correct |
5 ms |
620 KB |
Output is correct |
20 |
Correct |
1 ms |
332 KB |
Output is correct |
21 |
Correct |
0 ms |
204 KB |
Output is correct |
22 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
6 ms |
656 KB |
Output is correct |
4 |
Correct |
38 ms |
3196 KB |
Output is correct |
5 |
Correct |
56 ms |
4372 KB |
Output is correct |
6 |
Correct |
39 ms |
3396 KB |
Output is correct |
7 |
Correct |
3 ms |
460 KB |
Output is correct |
8 |
Correct |
9 ms |
1004 KB |
Output is correct |
9 |
Correct |
107 ms |
8988 KB |
Output is correct |
10 |
Incorrect |
6 ms |
4812 KB |
WA in grader: Too many inputs |
11 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
51 ms |
4964 KB |
on inputs (96, 130), (143, 84), expected 0, but computed 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 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 |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
0 ms |
204 KB |
Output is correct |
7 |
Incorrect |
0 ms |
204 KB |
on inputs (0, 2), (1, 0), expected 0, but computed 1 |
8 |
Halted |
0 ms |
0 KB |
- |