제출 #952943

#제출 시각아이디문제언어결과실행 시간메모리
952943IsamSwimming competition (LMIO18_plaukimo_varzybos)C++17
100 / 100
393 ms13140 KiB
#include<bits/stdc++.h> using namespace std; int n, l, r, t[1000001]; signed main(){ ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); cin >> n >> l >> r; for(register int i = 1; i <= n; ++i){ cin >> t[i]; } sort(t+1,t+n+1); int lo(0), hi(t[n]), mid, ans; function<bool(int)> check = [](int dif){ int i(1); deque<int> gr = {0}; while(i <= n && (int)gr.size()){ if(i - gr.front() >= l){ if(i - gr.front() <= r && t[i] - t[gr.front() + 1] <= dif){ gr.push_back(i), ++i; }else{ gr.pop_front(); } }else{ ++i; } } return ((int)gr.size() && gr.back() == n); }; while(hi >= lo){ mid = lo + ((hi - lo) >> 1); if(check(mid)){ hi = mid - 1, ans = mid; }else{ lo = mid + 1; } } cout << ans << '\n'; return 0; }

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

plaukimo_varzybos.cpp: In function 'int main()':
plaukimo_varzybos.cpp:7:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
    7 |  for(register int i = 1; i <= n; ++i){
      |                   ^
plaukimo_varzybos.cpp:37:17: warning: 'ans' may be used uninitialized in this function [-Wmaybe-uninitialized]
   37 |  cout << ans << '\n';
      |                 ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...