Submission #416972

# Submission time Handle Problem Language Result Execution time Memory
416972 2021-06-03T09:01:43 Z Theo830 Vision Program (IOI19_vision) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
typedef short 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

vision.cpp:4:19: warning: overflow in conversion from 'double' to 'll' {aka 'short int'} changes value from '1.000000007e+9' to '32767' [-Woverflow]
    4 | const ll INF = 1e9+7;
      |                ~~~^~
vision.cpp:5:10: warning: overflow in conversion from 'int' to 'll' {aka 'short int'} changes value from '998244353' to '1' [-Woverflow]
    5 | ll MOD = 998244353;
      |          ^~~~~~~~~
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:50:16: error: 'k' was not declared in this scope
   50 |     if(dist == k){
      |                ^