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"
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3")
#define endl '\n'
#define db double
#define ll __int128
#define pb push_back
#define fs first
#define sd second
#define Mod long(1e9 + 7)
#define all(x) x.begin(), x.end()
#define unvisited long(-1)
#define Eps double(1e-9)
#define _for(i, n) for(int i = 0; i < (n); i++)
#define dbg(x) cout << #x ": " << x << endl;
const int Max = 1e6 + 7, Inf = 1e9 + 7;
int pos(int i, int j, int w){
return i * w + j;
}
void construct_network(int h, int w, int k)
{
int ini = h*w, last = h*w-1; //cerr << h << " " << w << " " << k << endl;
map <int, map <int, int>> mp;
for(int i = 0; i < h; i++)
{
for(int j = 0; j < w; j++)
{
for(int l = 0; l <= i; l++)
{
for(int m = 0; m < w; m++)
{
if(abs(l - i) + abs(m - j) == k){
int a = pos(i, j, w), b = pos(l, m, w);
if(a > b) swap(a, b);
if(mp[a][b] != 0) continue;
mp[a][b] = 1;
add_and({ pos(l, m, w), pos(i, j, w) });
//cerr << pos(l, m, w) << " " << pos(i, j, w) << endl;
last++;
}
}
}
}
}
if(ini > last) return;
vector <int> s;
for(int i = ini; i <= last; i++){
s.push_back(i);
}
add_or(s);
}
# | 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... |