#include <bits/stdc++.h>
//#include "grader.cpp"
#include "vision.h"
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#define in(x) freopen(x, "r", stdin)
#define out(x) freopen(x, "w", stdout)
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("fast-math")
#pragma GCC optimize("no-stack-protector")
#define F first
#define S second
#define pb push_back
#define N +205
#define M ll(1e9 + 7)
#define sz(x) (int)x.size()
#define re return
#define oo ll(1e9)
#define el '\n'
#define Max_A int(1e9)
//#define el endl
#define pii pair <int, int>
#define piii pair <int, pair <int, int> >
#define psi pair <string, int>
#define err ld(1e-9)
#define Max_S int(3e6)
#define last(x) (x).back()
#define all(x) (x).begin(), (x).end()
#define allr(x) (x).rbegin(), (x).rend()
#define arr_all(x, n) (x + 1), (x + 1 + n)
#define vi vector<int>
using namespace std;
//using namespace __gnu_pbds;
//typedef tree <int, null_type, less_equal <int> , rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef long long ll;
typedef long double ld;
int i, j;
int diag_r[2][N][N];
int diag_l[2][N][N];
int diag_R[N][2];
int diag_L[N][2];
void construct_network(int n, int m, int k)
{
vi vc;
int num = n * m;
for (i = 0; i < n; i++)
{
int x = i;
if (i == m)
break;
vc.pb(x * m + x);
}
add_or(vc);
diag_r[0][0][0] = num++;
diag_R[n - 1][0] = num - 1;
for (i = 1; i < n; i++)
{
int x = i;
int y = 0;
vi vc;
vc.clear();
for (; x < n && y < m; x++, y++)
vc.pb(x * m + y);
add_or(vc);
diag_r[0][i][0] = num++;
diag_R[n - i - 1][0] = num - 1;
}
for (j = 1; j < m; j++)
{
int x = 0;
int y = j;
vi vc;
vc.clear();
for (; x < n && y < m; x++, y++)
vc.pb(x * m + y);
add_or(vc);
diag_r[0][0][j] = num++;
diag_R[n + j - 1][0] = num - 1;
}
//------------------
int y = m - 1;
vc.clear();
for (i = 0; i < n && y >= 0; i++)
{
int x = i;
vc.pb(x * m + y);
y--;
}
add_or(vc);
diag_l[0][0][m - 1] = num++;
diag_L[n - 1][0] = num - 1;
for (i = 1; i < n; i++)
{
int x = i;
int y = m - 1;
vi vc;
vc.clear();
for (; x < n && y >= 0; x++, y--)
vc.pb(x * m + y);
add_or(vc);
diag_l[0][i][m - 1] = num++;
diag_L[n - i - 1][0] = num - 1;
}
for (j = 0; j < m - 1; j++)
{
int x = 0;
int y = j;
vi vc;
vc.clear();
for (; x < n && y >= 0; x++, y--)
vc.pb(x * m + y);
add_or(vc);
diag_l[0][0][j] = num++;
diag_L[n + m - j - 2][0] = num - 1;
}
//-----------------------------------
vc.clear();
for (i = 0; i < n; i++)
{
int x = i;
if (i == m)
break;
vc.pb(x * m + x);
}
vc.pb(diag_r[0][0][0]);
add_xor(vc);
diag_r[1][0][0] = num++;
diag_R[n - 1][1] = num - 1;
for (i = 1; i < n; i++)
{
int x = i;
int y = 0;
vi vc;
vc.clear();
for (; x < n && y < m; x++, y++)
vc.pb(x * m + y);
vc.pb(diag_r[0][i][0]);
add_xor(vc);
diag_r[1][i][0] = num++;
diag_R[n - i - 1][1] = num - 1;
}
for (j = 1; j < m; j++)
{
int x = 0;
int y = j;
vi vc;
vc.clear();
for (; x < n && y < m; x++, y++)
vc.pb(x * m + y);
vc.pb(diag_r[0][0][j]);
add_xor(vc);
diag_r[1][0][j] = num++;
diag_R[n + j - 1][1] = num - 1;
}
//--------------------------------
vc.clear();
y = m - 1;
for (i = 0; i < n && y >= 0; i++)
{
int x = i;
vc.pb(x * m + y);
y--;
}
vc.pb(diag_l[0][0][m - 1]);
add_xor(vc);
diag_l[1][0][m - 1] = num++;
diag_L[n - 1][1] = num - 1;
for (i = 1; i < n; i++)
{
int x = i;
int y = m - 1;
vi vc;
vc.clear();
for (; x < n && y >= 0; x++, y--)
vc.pb(x * m + y);
vc.pb(diag_l[0][i][m - 1]);
add_xor(vc);
diag_l[1][i][m - 1] = num++;
diag_L[n - i - 1][1] = num - 1;
}
for (j = 0; j < m - 1; j++)
{
int x = 0;
int y = j;
vi vc;
vc.clear();
for (; x < n && y >= 0; x++, y--)
vc.pb(x * m + y);
vc.pb(diag_l[0][0][j]);
add_xor(vc);
diag_l[1][0][j] = num++;
diag_L[n + m - j - 2][1] = num - 1;
}
vi vec;
for (i = 0; i < n + m - 1 - k; i++)
{
vi vc;
for (j = i; j <= i + k; j++)
{
vc.pb(diag_L[j][0]);
vc.pb(diag_L[j][1]);
}
add_xor(vc);
add_not(num++);
vec.pb(num++);
}
add_or(vec);
int one = num++;
vec.clear();
for (i = 0; i < n + m - 1 - k; i++)
{
vi vc;
for (j = i; j <= i + k; j++)
{
// cerr << diag_R[j][0] << " " << diag_R[j][1] << el;
vc.pb(diag_R[j][0]);
vc.pb(diag_R[j][1]);
}
add_xor(vc);
add_not(num++);
vec.pb(num++);
}
add_or(vec);
int two = num++;
vec.clear();
vec.pb(two);
vec.pb(one);
add_and(vec);
int fiv = num++;
vec.clear();
for (i = 0; i < n + m - 1 - k + 1; i++)
{
vi vc;
for (j = i; j <= i + k - 1; j++)
{
vc.pb(diag_L[j][0]);
vc.pb(diag_L[j][1]);
}
add_xor(vc);
add_not(num++);
vec.pb(num++);
}
add_or(vec);
one = num++;
vec.clear();
for (i = 0; i < n + m - 1 - k + 1; i++)
{
vi vc;
for (j = i; j <= i + k - 1; j++)
{
vc.pb(diag_R[j][0]);
vc.pb(diag_R[j][1]);
}
add_xor(vc);
add_not(num++);
vec.pb(num++);
}
add_or(vec);
two = num++;
vec.clear();
vec.pb(two);
vec.pb(one);
add_and(vec);
int six = num++;
vec.clear();
vec.pb(fiv);
vec.pb(six);
add_xor(vec);
int fst = num++;
add_not(six);
// cerr << num << " " << fst << el;
vec.clear();
vec.pb(num++);
vec.pb(fst);
add_and(vec);
return;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
on inputs (0, 0), (0, 1), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
on inputs (0, 0), (0, 1), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
on inputs (0, 0), (0, 1), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
on inputs (0, 0), (0, 1), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
640 KB |
on inputs (0, 0), (0, 1), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
on inputs (0, 0), (0, 1), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
29 ms |
2844 KB |
on inputs (80, 199), (81, 199), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
on inputs (0, 0), (0, 1), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |