제출 #539179

#제출 시각아이디문제언어결과실행 시간메모리
539179timreizinGap (APIO16_gap)C++17
70 / 100
59 ms3160 KiB
#include "gap.h" #include <vector> using namespace std; using ll = long long; long long findGap(int t, int n) { vector<ll> arr; if (t == 1) { ll a = 0, b = 1e18; for (int i = 0; i < (n + 1) / 2; ++i) { MinMax(a + 1, b - 1, &a, &b); arr.push_back(a); arr.push_back(b); } } else { ll a, b; MinMax(0, 1e18, &a, &b); arr.push_back(a); ll x = (b - a + n - 2) / (n - 1); for (ll i = a + 1; i < b; i += x) { ll l, r; MinMax(i, i + x - 1, &l, &r); if (l != -1) { 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:40:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |     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...