# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
707620 | Specialistas13 | Swimming competition (LMIO18_plaukimo_varzybos) | C++17 | 1 ms | 212 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define FAST_IO cin.tie(nullptr); ios_base::sync_with_stdio(0)
const int MAXN=1e7;
int dp[MAXN];
int main()
{
FAST_IO;
int n, a, b, ans=1e7;
cin>>n>>a>>b;
vector<int> numbers;
for (int i=0; i<n; i++){
int a;
cin>>a;
numbers.push_back(a);
}
sort(numbers.begin(), numbers.end());
for (int i=1; i<n; i++){
if (i>=a-1 && i<=b-1){
dp[i]=max(dp[i-1], min(numbers[i]-numbers[0], numbers[n-1]-numbers[i]));
}
else {
dp[i]=max(dp[i-1], numbers[i]-numbers[i-1]);
}
}
cout<<dp[n-1];
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |