#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 |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
2 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
2 ms |
340 KB |
Output is correct |
7 |
Correct |
2 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
2 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
2 ms |
340 KB |
Output is correct |
7 |
Correct |
2 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
114 ms |
4560 KB |
Output is correct |
10 |
Correct |
159 ms |
4544 KB |
Output is correct |
11 |
Correct |
63 ms |
4540 KB |
Output is correct |
12 |
Correct |
170 ms |
4576 KB |
Output is correct |
13 |
Correct |
58 ms |
4140 KB |
Output is correct |
14 |
Correct |
111 ms |
4540 KB |
Output is correct |
15 |
Correct |
91 ms |
3900 KB |
Output is correct |
16 |
Correct |
64 ms |
4540 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1552 ms |
1072 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1552 ms |
1072 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |