이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "vision.h"
#ifdef EVAL
#else
#include "grader.cpp"
#endif
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair <int, int> pii;
#define precision(n) fixed << setprecision(n)
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define mp make_pair
#define eps (double)1e-9
#define PI 2*acos(0.0)
#define endl "\n"
#define sz(v) int((v).size())
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define do_not_disturb ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define OK cout << "OK" << endl;
bool isEligible(int x, int y, int n, int m){
return x > -1 && x < n && y > -1 && y < m;
}
void construct_network(int n, int m, int dist) {
if(min(n, m) == 1){
if(m == 1) swap(n, m);
int ind = m;
for(int i = 0; i+dist < m; i++){
vector <int> v;
v.pb(i); v.pb(i+dist);
add_and(v);
ind++;
}
vector <int> v;
for(int i = m; i < ind; i++){
v.pb(i);
}
add_or(v);
return;
}
else if(n < 31 && m < 31){
vector <int> v;
for(int i = 0; i < n; i++){
for(int j = 0; j < m; j++){
vector <int> v1, v2;
for(int x = i; x < n; x++){
for(int y = 0; y < m; y++){
if(abs(i-x)+abs(j-y) == dist){
v2.pb(x*m+y);
}
}
}
v1.pb(i*m+j);
if(!sz(v2)) continue;
v1.pb(add_or(v2));
v.pb(add_and(v1));
}
}
add_or(v);
return;
}
else if(dist == 1){
int col_xor, row_xor;
vector <int> v, v1, rows, cols;
for(int i = 0; i < n; i++){
vector <int> v2;
for(int j = 0; j < m; j++){
v2.pb(i*m+j);
}
auto tmp = add_or(v2);
v1.pb(tmp);
rows.pb(tmp);
}
row_xor = add_xor(v1);
v1.clear();
for(int j = 0; j < m; j++){
vector <int> v2;
for(int i = 0; i < n; i++){
v2.pb(i*m+j);
}
auto tmp = add_or(v2);
v1.pb(tmp);
cols.pb(tmp);
}
col_xor = add_xor(v1);
v1.clear();
for(int i = 0; i < sz(rows)-1; i++){
vector <int> v2, v3;
v2.pb(rows[i]); v2.pb(rows[i+1]);
v3.pb(add_and(v2));
v3.pb(col_xor);
v.pb(add_and(v3));
}
for(int i = 0; i < sz(cols)-1; i++){
vector <int> v2, v3;
v2.pb(cols[i]); v2.pb(cols[i+1]);
v3.pb(add_and(v2));
v3.pb(row_xor);
v.pb(add_and(v3));
}
add_or(v);
return;
}
vector <int> v;
for(int i = 0; i < n; i++){
for(int j = 0; j < m; j++){
if(j+i == dist){
v.pb(i*m+j);
}
}
}
add_or(v);
}
# | 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... |