답안 #47937

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
47937 2018-05-09T08:18:18 Z 3zp Gap (APIO16_gap) C++14
컴파일 오류
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;
         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) 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:21:26: error: 'min' was not declared in this scope
             MinMax(x + 1,min( x + w * d, (ll)1e18),&p , &q);
                          ^~~
gap.cpp:21: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:23:19: error: 'max' was not declared in this scope
             ans = max(ans, p - x);
                   ^~~
gap.cpp:23: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)
     ^~~