Submission #365240

# Submission time Handle Problem Language Result Execution time Memory
365240 2021-02-11T10:10:09 Z CodeKracker Vision Program (IOI19_vision) C++14
Compilation error
0 ms 0 KB
/*input

*/
/**
    Author: Kristopher Paul
    Date Created: 11-02-2021
**/
#include<bits/stdc++.h>
#include<stdio.h>
//#include<unordered_map>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
//#define int ll
#define pb push_back
#define INF 1e18
#define MOD 1000000007
//#define MOD 998244353
#define mp make_pair
const double PI=3.141592653589793238462643383279502884197169399375105820974944;
#define REP(i,n) for (int i = 0; i < n; i++)
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REPD(i,n) for (int i = n-1; i >= 0; i--)
#define FORD(i,a,b) for (int i = a; i >= b; i--)
#define remax(a,b) a = max(a,b)
#define remin(a,b) a = min(a,b)
#define umap map
#define pii pair<int,int>
#define F first
#define S second
#define mii map<int,int>
#define vi vector<int>
#define vvi vector<vi>
#define itr :: iterator it
#define all(v) v.begin(),v.end()
#define WL(t) while(t--)
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define out(x) cout << #x << " is " << x << endl
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;

//using namespace __gnu_pbds;

//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> pbds; // set
//typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update> pbds; // multiset

int ModExp(int x,int y,int m){
    int res = 1;
    x = x % m;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % m;

        y = y>>1;
        x = (x*x) % m;
    }
    return res;
}

int add_and(vi vec);
int add_or(vi vec);

void construct_network(int h,int w,int k){
    if(min(h,w) == 1){
        vi vec;
        FOR(i,0,(h*w)-k){
            int ind = add_and({i,i+k});
            vec.pb(ind);
        }
        add_or(vec);
        return;
    }
    vi vec;
    FOR(i,0,h){
        FOR(j,0,w){
            int rs = i-k;
            int re = i+k;
            FOR(l,max(rs,0LL),min(re+1,h)){
                int v = (k-l);
                if((j-v) >= 0 && (j-v) < w){
                    add_and({i*w+j,l*w+(j-v)});
                }
                if((j+v) >= 0 && (j+v) < w){
                    add_and({i*w+j,l*w+(j+v)});
                }
            }
        }
    }
    add_or(vec);
    return;
}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:80:29: error: no matching function for call to 'max(int&, long long int)'
   80 |             FOR(l,max(rs,0LL),min(re+1,h)){
      |                             ^
vision.cpp:22:33: note: in definition of macro 'FOR'
   22 | #define FOR(i,a,b) for (int i = a; i < b; i++)
      |                                 ^
In file included from /usr/include/c++/9/bits/char_traits.h:39,
                 from /usr/include/c++/9/ios:40,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from vision.cpp:8:
/usr/include/c++/9/bits/stl_algobase.h:222:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  222 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/9/bits/stl_algobase.h:222:5: note:   template argument deduction/substitution failed:
vision.cpp:80:29: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   80 |             FOR(l,max(rs,0LL),min(re+1,h)){
      |                             ^
vision.cpp:22:33: note: in definition of macro 'FOR'
   22 | #define FOR(i,a,b) for (int i = a; i < b; i++)
      |                                 ^
In file included from /usr/include/c++/9/bits/char_traits.h:39,
                 from /usr/include/c++/9/ios:40,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from vision.cpp:8:
/usr/include/c++/9/bits/stl_algobase.h:268:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  268 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/9/bits/stl_algobase.h:268:5: note:   template argument deduction/substitution failed:
vision.cpp:80:29: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   80 |             FOR(l,max(rs,0LL),min(re+1,h)){
      |                             ^
vision.cpp:22:33: note: in definition of macro 'FOR'
   22 | #define FOR(i,a,b) for (int i = a; i < b; i++)
      |                                 ^
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from vision.cpp:8:
/usr/include/c++/9/bits/stl_algo.h:3456:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)'
 3456 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/9/bits/stl_algo.h:3456:5: note:   template argument deduction/substitution failed:
vision.cpp:80:29: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   80 |             FOR(l,max(rs,0LL),min(re+1,h)){
      |                             ^
vision.cpp:22:33: note: in definition of macro 'FOR'
   22 | #define FOR(i,a,b) for (int i = a; i < b; i++)
      |                                 ^
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from vision.cpp:8:
/usr/include/c++/9/bits/stl_algo.h:3462:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)'
 3462 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/9/bits/stl_algo.h:3462:5: note:   template argument deduction/substitution failed:
vision.cpp:80:29: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   80 |             FOR(l,max(rs,0LL),min(re+1,h)){
      |                             ^
vision.cpp:22:33: note: in definition of macro 'FOR'
   22 | #define FOR(i,a,b) for (int i = a; i < b; i++)
      |                                 ^