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 <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e9+7;
ll MOD = 998244353;
typedef pair<ll,ll> ii;
#define iii pair<ll,ii>
#define f(i,a,b) for(ll i = a;i < b;i++)
#define pb push_back
#define vll vector<ll>
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
///I hope I will get uprating and don't make mistakes
///I will never stop programming
///sqrt(-1) Love C++
///Please don't hack me
///@TheofanisOrfanou Theo830
///Think different approaches (bs,dp,greedy,graphs,shortest paths,mst)
///Stay Calm
///Look for special cases
///Beware of overflow and array bounds
///Think the problem backwards
///Training
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
uniform_int_distribution<ll> distr;
ll rnd(ll a, ll b){return distr(rng)%(b-a+1)+a;}
#include "vision.h"
void construct_network(int H, int W, int K){
ll x[2],y[2];
x[0] = -1;
vector<int>ex[2];
f(i,0,H * W){
if(!add_not(i)){
ex[0].pb(i);
if(x[0] == -1){
x[0] = i / W;
y[0] = i % W;
}
else{
x[1] = i / W;
y[1] = i % W;
}
}
else{
ex[1].pb(i);
}
}
ll dist = abs(x[0] - x[1]) + abs(y[1] - y[0]);
if(dist == K){
add_or(ex[0]);
}
else{
add_or(ex[1]);
}
}
Compilation message (stderr)
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:49:18: warning: 'x[1]' may be used uninitialized in this function [-Wmaybe-uninitialized]
49 | ll dist = abs(x[0] - x[1]) + abs(y[1] - y[0]);
| ~~~^~~~~~~~~~~~~
vision.cpp:49:37: warning: 'y[0]' may be used uninitialized in this function [-Wmaybe-uninitialized]
49 | ll dist = abs(x[0] - x[1]) + abs(y[1] - y[0]);
| ~~~^~~~~~~~~~~~~
vision.cpp:49:37: warning: 'y[1]' may be used uninitialized in this function [-Wmaybe-uninitialized]
# | 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... |