Submission #47942

# Submission time Handle Problem Language Result Execution time Memory
47942 2018-05-09T08:22:00 Z 3zp Gap (APIO16_gap) C++14
Compilation error
0 ms 0 KB
#include "gap.h"
#define ll long long
#include<bits/stdc++.h>
long long findGap(int T, int N)
{
    ll s, t;
    MinMax(0, 1e18, &s, &t);
    ll L = t - s;
    ll d = L / (N - 1);
    ll ans = d;
    ll x = s;
    while(x != t){
        ll p, q;
        if(x + d >= t) break;
         MinMax(x + 1, x + d, &p , &q);
        if(q != -1) {
            x = q;
            continue;
        }
        int w = 2;
        while(1){

            MinMax(x + 1,min( x + w * d, (ll)1e18),&p , &q);
            if(q == -1) {w++; continue;}
            ans = max(ans, p - x);
            x = q;
            break;
        }
    }
    return ans;
}

Compilation message

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:23:26: error: 'min' was not declared in this scope
             MinMax(x + 1,min( x + w * d, (ll)1e18),&p , &q);
                          ^~~
gap.cpp:23:26: note: suggested alternative:
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from gap.cpp:3:
/usr/include/c++/7/bits/stl_algo.h:3456:5: note:   'std::min'
     min(initializer_list<_Tp> __l, _Compare __comp)
     ^~~
gap.cpp:25:19: error: 'max' was not declared in this scope
             ans = max(ans, p - x);
                   ^~~
gap.cpp:25:19: note: suggested alternative:
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from gap.cpp:3:
/usr/include/c++/7/bits/stl_algo.h:3468:5: note:   'std::max'
     max(initializer_list<_Tp> __l, _Compare __comp)
     ^~~