Submission #560874

#TimeUsernameProblemLanguageResultExecution timeMemory
560874HuyGap (APIO16_gap)C++17
Compilation error
0 ms0 KiB
#include"gap.h"

#include<bits/stdc++.h>
//#define int long long
#define pii pair<int,int>
#define fi first
#define se second
/*#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")*/
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ldb = long double;
const int N = (int)1e8;
const int maxN = (int)1e5 + 1;
const ll mod = 1e9 + 7;
//const int mod = 998244353;
const ll infty = 1e18;
const ll logn = 18;
const int base = 311;
const int Block_size = 500;
const int ep = 'a';

int cu[] = {0,0,1,-1};
int cv[] = {-1,1,0,0};

int du[] = {-1,-1,+1,1};
int dv[] = {-1,+1,-1,1};

int cled[] = {6,2,5,5,4,5,6,3,7,6};

void InputFile()
{
    freopen(".inp","r",stdin);
    freopen(".out","w",stdout);
    //freopen("test.out","r",stdin);
}

void FastInput()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
}

ll a[maxN];
void FindGap(int T,int N)
{
    ll res = 0;
    MinMax(0,infty,&a[1],&a[n]);
    ll h = (a[n] - a[1] + n - 2) / (n - 1);
    int prev = a[1];
    ll now = a[1] + 1;
    while(true)
    {
        int x,y;
        Minmax(now,now + h - 1,&x,&y);
        res = max(res,x - prev);
        pre = max(pre,y);
        now += h;
        if(y == a[n]) break;
    }
    return res;
}

/*void Read()
{

}

void Solve()
{

}

void Debug()
{
    //Main_sub();
    //Naive();
}


int32_t main()
{
    FastInput();
    //InputFile();
    //int sub_type;
    //cin >> sub_type;
    //Sieve();
    int test;
    //cin >> test;
    test = 1;
    while(test--)
        //for(int prc = 1; prc <= test; prc++)
    {
        Read();
        Solve();
        //Debug();
    }
}*/








Compilation message (stderr)

gap.cpp: In function 'void FindGap(int, int)':
gap.cpp:52:29: error: 'n' was not declared in this scope
   52 |     MinMax(0,infty,&a[1],&a[n]);
      |                             ^
gap.cpp:59:9: error: 'Minmax' was not declared in this scope; did you mean 'MinMax'?
   59 |         Minmax(now,now + h - 1,&x,&y);
      |         ^~~~~~
      |         MinMax
gap.cpp:60:31: error: no matching function for call to 'max(ll&, int)'
   60 |         res = max(res,x - prev);
      |                               ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from gap.cpp:3:
/usr/include/c++/10/bits/stl_algobase.h:254:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  254 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:254:5: note:   template argument deduction/substitution failed:
gap.cpp:60:31: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   60 |         res = max(res,x - prev);
      |                               ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from gap.cpp:3:
/usr/include/c++/10/bits/stl_algobase.h:300:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  300 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:300:5: note:   template argument deduction/substitution failed:
gap.cpp:60:31: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   60 |         res = max(res,x - prev);
      |                               ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from gap.cpp:3:
/usr/include/c++/10/bits/stl_algo.h:3480:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)'
 3480 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3480:5: note:   template argument deduction/substitution failed:
gap.cpp:60:31: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   60 |         res = max(res,x - prev);
      |                               ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from gap.cpp:3:
/usr/include/c++/10/bits/stl_algo.h:3486:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)'
 3486 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3486:5: note:   template argument deduction/substitution failed:
gap.cpp:60:31: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   60 |         res = max(res,x - prev);
      |                               ^
gap.cpp:61:9: error: 'pre' was not declared in this scope; did you mean 'prev'?
   61 |         pre = max(pre,y);
      |         ^~~
      |         prev
gap.cpp:65:12: error: return-statement with a value, in function returning 'void' [-fpermissive]
   65 |     return res;
      |            ^~~
gap.cpp: In function 'void InputFile()':
gap.cpp:37:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   37 |     freopen(".inp","r",stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~
gap.cpp:38:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   38 |     freopen(".out","w",stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~