This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "vision.h"
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair < int, int > pii;
typedef pair < ll, ll > pll;
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define SZ(x) (int)x.size()
#define Mp make_pair
#define endl "\n"
#define fast_io ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const int N = 4e2 + 10;
const int LOG = 8;
const ll mod = 1e9 + 7;
const ll inf = 8e18;
int n, m, k;
inline int id(int i, int j)
{
return i * m + j;
}
vector < int > Ld[N], Rd[N];
int L[N], R[N], psl[N], psr[N];
void construct_network(int _n, int _m, int _k)
{
n = _n; m = _m; k = _k;
for(int i = 0; i < n; i ++)
{
for(int j = 0; j < m; j ++)
{
Ld[i + j].push_back(id(i, j));
Rd[i + m - 1 - j].push_back(id(i, j));
}
}
vector < int > Ans1, Ans2;
for(int i = n + m - 2; ~i; i --)
{
L[i] = add_or(Ld[i]);
R[i] = add_or(Rd[i]);
if(i != n + m - 2)
{
psl[i] = add_or({psl[i + 1], L[i]});
psr[i] = add_or({psr[i + 1], R[i]});
}
else
{
psl[i] = L[i];
psr[i] = R[i];
}
if(i + k <= n + m - 2)
{
Ans1.push_back(add_and({psl[i + k], L[i]}));
Ans1.push_back(add_and({psr[i + k], R[i]}));
}
if(i + k + 1 <= n + m - 2)
{
Ans2.push_back(add_and({psl[i + k + 1], L[i]}));
Ans2.push_back(add_and({psr[i + k + 1], R[i]}));
}
}
int fir = add_or(Ans1);
if(k != n + m - 2)
{
int sec = add_or(Ans2);
add_xor({fir, sec});
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |