제출 #534477

#제출 시각아이디문제언어결과실행 시간메모리
534477pokmui9909Gap (APIO16_gap)C++17
0 / 100
50 ms2276 KiB
#include "gap.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

#define x first
#define y second

pair<ll, ll> ask(ll s, ll e){
    pair<ll, ll> p;
    MinMax(s, e, &p.x, &p.y);
    return p;
}

long long findGap(int T, int N){
    vector<ll> A;
    ll L = 0, R = 2e18;
    while(N){
        pair<ll, ll> r = ask(L, R);
        A.push_back(r.x);
        A.push_back(r.y);
        L = r.x + 1, R = r.y - 1;
        N -= 2;
    }
    sort(A.begin(), A.end());
    ll ans = 0;
    for(int i = 0; i < A.size() - 1; i++){
        ans = max(ans, A[i + 1] - A[i]);
    }
    return ans;
}

컴파일 시 표준 에러 (stderr) 메시지

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:27:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |     for(int i = 0; i < A.size() - 1; i++){
      |                    ~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...