# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1215865 | CELD_07 | Vision Program (IOI19_vision) | C++20 | 0 ms | 0 KiB |
#include "vision.h"
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
typedef long long ll;
typedef long double ld;
#define endl "\n"
#define vll vector<ll>
#define sd second
#define ft first
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define pll pair<ll, ll>
#define mod 1000000007
#define _set tree<pll, null_type, less<pll>, rb_tree_tag, tree_order_statistics_node_update>
#define inf (ll)1e15
#define db(x) cout<<#x<<" : "<<x<<endl;
#define PRESICION(x) cout.setf(ios::fixed,ios::floatfield); cout.precision(x);
using namespace std;
using namespace __gnu_pbds;
ll dx[]={1, -1, 0, 0};
ll dy[]={0, 0, 1, -1};
inline ll sm(ll a, ll b){
return ((a%mod)+(b%mod))%mod;
}
inline ll ml(ll a, ll b){
return ((a%mod)*(b%mod))%mod;
}
inline ll rs(ll a, ll b){
return ((a%mod)-(b%mod)+mod)%mod;
}
ll bpow(ll a , ll b) {
if (b==0)return 1;
if (b%2!=0)return ((bpow(a, b-1)%mod)*(a%mod))%mod;
ll r=bpow (a ,b/ 2) ;
return ((r%mod)*(r%mod))%mod;
}
void construct_network(int H, int W, int K){
ll x, y, x1, y1;
vector<vector<ll>> ind(H+10, vector<ll>(W+10));
ll cnt=0;
vector<pair<ll, ll>> res;
for(int i=0; i<H; i++)for(int j=0; j<W; j++){ind[i][j]=cnt;cnt++;}
for(int i=0; i<H; i++){
for(int j=0; j<W; j++)
if(add_or({ind[i][j]})==1){
res.push_back({i, j});
}
}
if(abs(res[0].ft-res[1].ft)+abs(res[0].sd-res[1].sd)==K)add_or({ind[res[0].ft, res[0].sd]});
else add_not(ind[res[0].ft, res[0].sd]);
}