제출 #112063

#제출 시각아이디문제언어결과실행 시간메모리
112063Eug1enaGap (APIO16_gap)C++14
0 / 100
82 ms5052 KiB
#include "gap.h"
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint INF = 1e18;

lint findGap(int T, int N){
    if(T == 1){
        vector<lint> left{-INF}, right{INF + 100};
        while(left.back() + 2 <= right.back()){
            lint l, r;
            MinMax(left.back() + 1, right.back() - 1, &l, &r);
            if(l == -1){
                break;
            }
            left.push_back(l);
            right.push_back(r);
        }
        vector<lint> a;
        for(int i = 1; i < left.size(); i++){
            a.push_back(left[i]);
        }
        for(int i = int(right.size()) - 1; i >= 1; i--){
            a.push_back(right[i]);
        }
        lint ans = 0;
        for(int i = 1; i < a.size(); i++){
            ans = max(ans, a[i] - a[i - 1]);
        }
        return ans;
    }else{
        return -1;
    }
}

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

gap.cpp: In function 'lint findGap(int, int)':
gap.cpp:20:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int i = 1; i < left.size(); i++){
                        ~~^~~~~~~~~~~~~
gap.cpp:27:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int i = 1; i < a.size(); i++){
                        ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...