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;
#define ll int
#define pll pair<ll,ll>
#define ff first
#define ss second
#define pb push_back
//#define endl "\n"
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
const ll maxn=1e5+50;
const ll mod=1e9+7 ;
const ll base=1e18;
/// i believe myself
/// goal 2/7
#include "vision.h"
ll n, m;
ll get(ll x,ll y)
{
return (x*m)+y;
}
void construct_network(int H, int W, int K) {
n=H;
m=W;
ll l=0,h=n-1;
while (l<=h)
{
ll mid=(l+h)/2;
vector<ll> vt;
for (int i=0;i<=mid;i++)
{
for (int j=0;j<m;j++)
{
vt.pb(get(i,j));
}
}
ll valnw=add_or(vt);
if (valnw==1) h=mid-1;
else l=mid+1;
}
ll st=l;
l=0,h=m-1;
while (l<=h)
{
ll mid=(l+h)/2;
vector<ll> vt;
for (int i=0;i<=st;i++)
{
for (int j=0;j<=mid;j++)
{
vt.pb(get(i,j));
}
}
ll valnw=add_or(vt);
if (valnw==1) h=mid-1;
else l=mid+1;
}
ll st1=l;
vector<ll> vt;
for (int i=0;i<n;i++)
{
for (int j=0;j<m;j++)
{
ll h=abs(i-st)+abs(j-st1);
if (h==K) vt.pb(get(i,j));
}
}
add_or(vt);
}
Compilation message (stderr)
vision.cpp:14:15: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
14 | const ll base=1e18;
| ^~~~| # | 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... |