Submission #237084

#TimeUsernameProblemLanguageResultExecution timeMemory
237084Aldas25Swimming competition (LMIO18_plaukimo_varzybos)C++14
10 / 100
637 ms30832 KiB
#include <bits/stdc++.h> using namespace std; #define FAST_IO ios_base::sync_with_stdio(0); cin.tie(nullptr) #define FOR(i, a, b) for (int i = (a); i <= (b); i++) #define pb push_back typedef long long ll; const int MAXN = 1000100; const ll INF = 1e16; int n, a, b; ll dp[MAXN], t[MAXN]; vector<ll> ts; int main() { FAST_IO; //ifstream cin ("lmio_2018_3e2_plaukimo_varzybos_vyr.in"); //ofstream cout ("lmio_2018_3e2_plaukimo_varzybos_vyr.out"); cin >> n >> a >> b; FOR(i, 1, n) {ll x; cin >> x; ts.pb(x);} sort(ts.begin(), ts.end()); FOR(i, 0, n-1) t[i+1] = ts[i]; FOR(i, 1, n) dp[i] = INF; FOR(i, 1, n) FOR(j, max(0,i-b), max(0,i-a)) dp[i] = min(dp[i], max(dp[j],t[i]-t[j+1])); cout << dp[n] << "\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...