#include <iostream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include "vision.h"
#include <chrono>
#include <vector>
#include <map>
#include <random>
#include <set>
#include <algorithm>
#include <math.h>
#include <cstdio>
#include <stdio.h>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <deque>
#include <cassert>
#include <stack>
using namespace std;
#define mp make_pair
#define f first
#define se second
#define pb push_back
#define ppb pop_back
#define emb emplace_back
#define ll long long
#define ull unsigned long long
#define cntbit(x) __builtin_popcount(x)
#define endl '\n'
#define uset unordered_set
#define umap unordered_map
#define pii pair<int, int>
#define ld long double
#define pll pair<long long, long long>
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T> inline T range(T l, T r) {
return uniform_int_distribution<T>(l, r)(rng);
}
inline void setin(string s) {
freopen(s.c_str(), "r", stdin);
}
inline void setout(string s) {
freopen(s.c_str(), "w", stdout);
}
template <typename T> void Min(T &a, T b) {
a = min(a, b);
}
template <typename T> void Max(T &a, T b) {
a = max(a, b);
}
const int inf = 2e9;
const int mod = 998244353;
const int N = 3e5 + 15;
int n, m, k;
inline int ind(int i, int j, int W) {
return i * W + j;
}
inline bool lie(int l, int x, int r) {
return l <= x && x <= r;
}
int check(vector <int> a, int k) {
vector <int> tmp = {};
for(int i = 0; i + k - 1 < a.size(); ++i) {
vector <int> now = {};
for(int j = i; j < i + k; ++j)
now.pb(a[j]);
tmp.pb(add_xor({add_or(now), add_xor(now)}));
}
return add_or(tmp);
}
int consider(vector <int> a, vector <int> b, int k) {
assert(k + 1 <= a.size());
int res = add_xor({check(a, k + 1), check(a, k)});
return add_and({res, check(b, k + 1)});
}
void construct_network(int H, int W, int K) {
vector <int> a, b;
n = H, m = W, k = K;
for(int d = 0; d <= n + m - 2; ++d) {
vector <int> now = {};
for(int i = 0; i < n; ++i) {
int j = d - i;
if(lie(0, j, m - 1))
now.pb(ind(i, j, m));
}
a.pb(add_or(now));
}
for(int d = -m + 1; d <= n - 1; ++d) {
vector <int> now = {};
for(int i = 0; i < n; ++i) {
int j = i - d;
if(lie(0, j, m - 1))
now.pb(ind(i, j, m));
}
b.pb(add_or(now));
}
add_or({consider(a, b, k), consider(b, a, k)});
}
Compilation message
vision.cpp: In function 'int check(std::vector<int>, int)':
vision.cpp:78:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 0; i + k - 1 < a.size(); ++i) {
~~~~~~~~~~^~~~~~~~~~
In file included from /usr/include/c++/7/cassert:44:0,
from vision.cpp:20:
vision.cpp: In function 'int consider(std::vector<int>, std::vector<int>, int)':
vision.cpp:88:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
assert(k + 1 <= a.size());
~~~~~~^~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
256 KB |
Output is correct |
5 |
Correct |
5 ms |
256 KB |
Output is correct |
6 |
Incorrect |
5 ms |
384 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 |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
256 KB |
Output is correct |
5 |
Correct |
5 ms |
256 KB |
Output is correct |
6 |
Incorrect |
5 ms |
384 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 |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
256 KB |
Output is correct |
5 |
Correct |
5 ms |
256 KB |
Output is correct |
6 |
Incorrect |
5 ms |
384 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 |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
256 KB |
Output is correct |
5 |
Correct |
5 ms |
256 KB |
Output is correct |
6 |
Incorrect |
5 ms |
384 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 |
7 ms |
640 KB |
Output is correct |
2 |
Correct |
17 ms |
1408 KB |
Output is correct |
3 |
Correct |
18 ms |
1408 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
7 ms |
640 KB |
Output is correct |
6 |
Correct |
16 ms |
1408 KB |
Output is correct |
7 |
Correct |
16 ms |
1280 KB |
Output is correct |
8 |
Correct |
6 ms |
384 KB |
Output is correct |
9 |
Correct |
7 ms |
640 KB |
Output is correct |
10 |
Correct |
16 ms |
1280 KB |
Output is correct |
11 |
Correct |
18 ms |
1536 KB |
Output is correct |
12 |
Correct |
17 ms |
1408 KB |
Output is correct |
13 |
Correct |
14 ms |
1152 KB |
Output is correct |
14 |
Correct |
5 ms |
384 KB |
Output is correct |
15 |
Correct |
7 ms |
640 KB |
Output is correct |
16 |
Correct |
15 ms |
1280 KB |
Output is correct |
17 |
Correct |
25 ms |
1536 KB |
Output is correct |
18 |
Correct |
17 ms |
1536 KB |
Output is correct |
19 |
Correct |
14 ms |
1152 KB |
Output is correct |
20 |
Correct |
6 ms |
384 KB |
Output is correct |
21 |
Correct |
5 ms |
256 KB |
Output is correct |
22 |
Correct |
4 ms |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
256 KB |
Output is correct |
2 |
Incorrect |
5 ms |
256 KB |
on inputs (0, 0), (1, 1), expected 1, but computed 0 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
17 ms |
1788 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
6 ms |
640 KB |
Output is correct |
4 |
Correct |
8 ms |
768 KB |
Output is correct |
5 |
Correct |
7 ms |
640 KB |
Output is correct |
6 |
Correct |
7 ms |
640 KB |
Output is correct |
7 |
Correct |
12 ms |
1148 KB |
Output is correct |
8 |
Correct |
13 ms |
1276 KB |
Output is correct |
9 |
Correct |
17 ms |
1788 KB |
Output is correct |
10 |
Correct |
4 ms |
256 KB |
Output is correct |
11 |
Correct |
5 ms |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
256 KB |
Output is correct |
5 |
Correct |
5 ms |
256 KB |
Output is correct |
6 |
Incorrect |
5 ms |
384 KB |
on inputs (0, 1), (1, 0), expected 1, but computed 0 |
7 |
Halted |
0 ms |
0 KB |
- |