제출 #37722

#제출 시각아이디문제언어결과실행 시간메모리
37722szawinisGap (APIO16_gap)C++14
100 / 100
106 ms5800 KiB
#include "gap.h" #include <bits/stdc++.h> using namespace std; using ll = long long; ll findGap(int t, int n) { ll ans = 0; if(t == 1) { ll l = 0, r = 1e18; ll a[n+1]; for(int i = 1; i <= n+1 >> 1; i++) { MinMax(l, r, &l, &r); a[i] = l; a[n-i+1] = r; ++l, --r; } for(int i = 1; i < n; i++) ans = max(a[i+1] - a[i], ans); } else { ll l = 0, r = 1e18; MinMax(l, r, &l, &r); ll blk = (r-l+n-2) / (n-1); assert(blk >= 1); ll x = l, pre = 0; while(x < r) { ll tmpl, tmpr; MinMax(x, x+blk-1, &tmpl, &tmpr); if(tmpl == -1 && tmpr == -1) { x += blk; continue; } if(x != l) ans = max(tmpl - pre, ans); pre = tmpr; x += blk; } if(x == r) ans = max(x - pre, ans); } return ans; }

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

gap.cpp: In function 'll findGap(int, int)':
gap.cpp:11:24: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   for(int i = 1; i <= n+1 >> 1; i++) {
                        ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...