Submission #1125622

#TimeUsernameProblemLanguageResultExecution timeMemory
1125622ardadutSwimming competition (LMIO18_plaukimo_varzybos)C++20
10 / 100
159 ms8332 KiB
#include <bits/stdc++.h> #define ll long long #define pb push_back #define endl "\n" #define vec vector<ll> #define vecvec vector<vector<ll>> using namespace std; /*#define FileName "" string Ghhhh = ".in"; string Ghhhhh = ".out"; ifstream Girdi(FileName + Ghhhh); ofstream Cikti(FileName + Ghhhhh); #define cin Girdi #define cout Cikti*/ const ll INF = 1e15; ll n,a,b; vector<ll> times; inline bool control(ll max_dif){ ll start = 0; for(ll i = 0 ; i < n ; i++){ if(times[i] - times[start] > max_dif or i - start + 1 > b){ if(i - start < a) return 0; start = i; } } if(n - start < a) return 0; return 1; } inline void solve(){ cin >> n >> a >> b; times.resize(n); for(ll i = 0 ; i < n ; i++) cin >> times[i]; sort(times.begin(), times.end()); ll l = 0, r = times[n-1] - times[0]; ll ans = r; while(l <= r){ ll mid = (l + r) / 2; if(control(mid)){ ans = mid; r = mid-1; }else l = mid+1; } cout << ans << endl; } signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); ll t = 1; //cin >> t; while(t--){ solve(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...