제출 #1015164

#제출 시각아이디문제언어결과실행 시간메모리
1015164vjudge1Gap (APIO16_gap)C++17
30 / 100
47 ms2008 KiB
#include<bits/stdc++.h> #include "gap.h" using namespace std; typedef long long ll; ll subtask1(int N); ll subtask2(ll s = -1, ll e = 1e18 + 1) { s++, e--; if(s >= e) return 0; ll mid = (s + e) / 2; ll mx1, mx2, mn1, mn2; MinMax(s, mid, &mn1, &mx1); MinMax(mid + 1, e, &mn2, &mx2); if(mn2 == -1) return subtask2(mn1, mx1); if(mn1 == -1) return subtask2(mn2, mx2); return max(mn2 - mx1, max(subtask2(mn1, mx1), subtask2(mn2, mx2))); } ll findGap(int T, int N) { if(T == 1) return subtask1(N); return subtask2(); } ll subtask1(int N) { int i = 0, j = N - 1; ll s = 0, e = 1e18; ll *mn = new ll, *mx = new ll; vector<ll> v(N); while(i <= j && s <= e) { MinMax(s, e, mn, mx); v[i] = *mn; v[j] = *mx; i++, j--; s = *mn + 1; e = *mx - 1; } ll ans = 0; for(int i = 1; i < v.size(); i++) ans = max(ans, v[i] - v[i - 1]); return ans; }

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

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