#include "vision.h"
#include <bits/stdc++.h>
#include <unordered_map>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,fma")
using namespace std;
typedef int ll;
ll H_, W_;
unordered_map<ll, vector<ll>> sum, sub;
unordered_map<ll, ll> sum_, sub_;
ll getloc(ll x, ll y) {
return x * W_ + y;
}
void construct_network(int H, int W, int K) {
H_ = H;
W_ = W;
ll i, j;
ll s = 100000000, e = 0;
for (i = 0; i < H; i++) {
for (j = 0; j < W; j++) {
sum[i + j].push_back(getloc(i, j));
sub[i - j].push_back(getloc(i, j));
e = max(e, i - j);
s = min(s, i - j);
}
}
unordered_map<ll, vector<ll>>::iterator it;
for (it = sum.begin(); it != sum.end(); it++) sum_[it->first] = add_or(it->second);
for (it = sub.begin(); it != sub.end(); it++) sub_[it->first] = add_or(it->second);
vector<ll> res;
for (i = 0; i + K <= W + H - 2; i++) {
vector<ll> v;
v.push_back(sum_[i]);
v.push_back(sum_[i + K]);
res.push_back(add_and(v));
}
for (i = s; i + K <= e; i++) {
vector<ll> v;
v.push_back(sub_[i]);
v.push_back(sub_[i + K]);
res.push_back(add_and(v));
}
vector<ll> nres;
for (i = 0; i <= W + H - 2; i++) {
vector<ll> v;
for (j = i + K + 1; j <= W + H - 2; j++) v.push_back(sum_[j]);
if (v.empty()) break;
vector<ll> vv;
vv.push_back(add_or(v));
vv.push_back(sum_[i]);
nres.push_back(add_and(vv));
}
for (i = s; i <= e; i++) {
vector<ll> v;
for (j = i + K + 1; j <= e; j++) v.push_back(sub_[j]);
if (v.empty()) break;
vector<ll> vv;
vv.push_back(add_or(v));
vv.push_back(sub_[i]);
nres.push_back(add_and(vv));
}
vector<ll> vvv;
vvv.push_back(add_not(add_or(nres)));
vvv.push_back(add_or(res));
add_and(vvv);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Incorrect |
1 ms |
204 KB |
WA in grader: Instruction with no inputs |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Incorrect |
1 ms |
204 KB |
WA in grader: Instruction with no inputs |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Incorrect |
1 ms |
204 KB |
WA in grader: Instruction with no inputs |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Incorrect |
1 ms |
204 KB |
WA in grader: Instruction with no inputs |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
716 KB |
Output is correct |
2 |
Correct |
3 ms |
460 KB |
Output is correct |
3 |
Correct |
4 ms |
460 KB |
Output is correct |
4 |
Incorrect |
1 ms |
332 KB |
WA in grader: Instruction with no inputs |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Incorrect |
1 ms |
204 KB |
WA in grader: Instruction with no inputs |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
34 ms |
3376 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
4 ms |
556 KB |
Output is correct |
4 |
Correct |
9 ms |
844 KB |
Output is correct |
5 |
Correct |
9 ms |
768 KB |
Output is correct |
6 |
Correct |
10 ms |
716 KB |
Output is correct |
7 |
Correct |
19 ms |
1996 KB |
Output is correct |
8 |
Correct |
26 ms |
1976 KB |
Output is correct |
9 |
Correct |
34 ms |
3340 KB |
Output is correct |
10 |
Incorrect |
1 ms |
204 KB |
WA in grader: Instruction with no inputs |
11 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Incorrect |
1 ms |
204 KB |
WA in grader: Instruction with no inputs |
3 |
Halted |
0 ms |
0 KB |
- |