#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
using namespace std;
using ll = long long int;
template<typename T>
ostream& operator+(ostream& out, const vector<T> &vec){
for(const auto &x : vec){
out<<x<<" ";
}
out<<"\n";
return out;
}
template<typename T>
ostream& operator*(ostream& out, const vector<T> &vec){
for(const auto &x : vec){
out+x;
}
return out;
}
template<typename T>
istream& operator>>(istream& in, vector<T> &vec){
for(auto &x : vec){
in>>x;
}
return in;
}
void solve(){
int n,m;
ll d;
cin>>n>>m>>d;
vector<int> a(n);
cin>>a;
auto solve_array = [&](vector<int> &a){
sort(a.begin(), a.end());
ll mn_prev = -a[0];
ll ans = 0;
for(int i=1;i<n;i++){
ans = max(ans, i * d - a[i] - mn_prev);
mn_prev = min(mn_prev, i * d - a[i]);
}
if(ans % 2) cout<<ans / 2<<".5\n";
else cout<<ans / 2<<".0\n";
};
for(int i=0;i<m;i++){
int v;
cin>>v;
a.push_back(v);
++n;
solve_array(a);
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
solve();
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1547 ms |
868 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1547 ms |
868 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |