제출 #539167

#제출 시각아이디문제언어결과실행 시간메모리
539167timreizinGap (APIO16_gap)C++17
0 / 100
65 ms3312 KiB
#include "gap.h" #include <vector> using namespace std; using ll = long long; long long findGap(int t, int n) { //[a, b] - n + 1 //x >= (b - a + 1) / (n - 1) ll a, b; MinMax(0, 1e18, &a, &b); ll x = (b - a + 1) / (n - 1); vector<ll> arr{a}; for (ll i = a + 1; i < b; i += x) { ll l, r; MinMax(i, i + x - 1, &l, &r); arr.push_back(l); arr.push_back(r); } arr.push_back(b); ll res = 0; for (int i = 0; i + 1 < arr.size(); ++i) res = max(res, arr[i + 1] - arr[i]); return res; }

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

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