제출 #131775

#제출 시각아이디문제언어결과실행 시간메모리
131775junodeveloperGap (APIO16_gap)C++14
0 / 100
2069 ms2464 KiB
#include "gap.h" #include <vector> #include <algorithm> using namespace std; long long findGap(int T, int N) { long long s, e, mn, mx, res = 0; if(T == 1) { s=0, e=1e18; vector<long long> v; while(s <= e) { MinMax(s, e, &mn, &mx); if(mn == -1) break; v.push_back(mn); v.push_back(mx); s = mn + 1, e = mx - 1; } sort(v.begin(), v.end()); for(int i=0; i+1<v.size(); i++) res = max(res, v[i+1] - v[i]); } else { s=0, e=1e18; MinMax(s, e, &mn, &mx); long long len = (mx - mn + N - 2) / (N - 1); vector<long long> v; while(s <= e) { MinMax(s, s + len, &mn, &mx); if(mn != -1) { v.push_back(mn); if(mn != mx) v.push_back(mx); } s += len + 1; } sort(v.begin(), v.end()); res = len; for(int i=0; i+1<v.size(); i++) res = max(res, v[i+1] - v[i]); } return res; }

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

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:19:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i=0; i+1<v.size(); i++)
                ~~~^~~~~~~~~
gap.cpp:36:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i=0; i+1<v.size(); i++)
                ~~~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...