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>
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,popcnt,lzcnt")
#define fio ios_base::sync_with_stdio(0);cin.tie(0);
#define ll long long
#define en cin.close();return 0;
#define pb push_back
#define fi first//printf("%lli\n",cur);
#define se second//scanf("%lli",&n);
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int main()
{
fio
// ifstream cin("in.in");
int n, m, d;
cin >> n >> m >> d;
vector<int> a(n);
for(auto &x:a)
cin >> x;
while(m--)
{
int x;
cin >> x;
a.pb(x);
sort(a.begin(),a.end());
n = a.size();
vector<ll> c(n);
for(int i = 0;i<n;i++)
c[i]=1ll*d*i-a[i];
ll mi = 1e18, res = -1e18;
for(int i = 0;i<n;i++)
res=max(res,c[i]-mi),
mi=min(mi,c[i]);
cout << res/2;
if(res%2)
cout << ".5";
cout << " ";
}
return 0;
}
# | 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... |