/*
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
*/
// lethal option
#include<bits/stdc++.h>
using namespace std;
#define all(flg) flg.begin(), flg.end()
#define int long long
#define pb push_back
#define fi first
#define se second
#define endl "\n"
#define eb emplace_back
#define ii pair<int, int>
#define vi vector<int>
#define PI 3.141592653589793238462643383279502884
#define ll long long
#define ld long double
#define for1(i, ff, gg) for(int i = ff; i <= gg; ++i)
#define for2(i, ff, gg) for(int i = ff; i >= gg; --i)
const ll mod = 1e9 + 7;
const int maxN = 2e5 + 5;
const ll oo = 1e18 + 7;
int n, a[maxN];
int x, y, z, k, m;
int ans[maxN];
int D;
void conv(int num){
cout << num / 2;
if(num & 1) cout << ".5";
cout << " ";
}
signed main(){
// freopen(".inp", "r", stdin);
ios_base::sync_with_stdio(0);
cin.tie(NULL);
cout.tie(NULL);
cin >> n >> m >> D;
for1(i, 1, n){
cin >> a[i];
}
for1(i, 1, m){
++n; cin >> a[n];
sort(a + 1, a + n + 1);
int ans = 0;
for1(i, 1, n) for1(j, i + 1, n){
ans = max(ans, -(a[j] - a[i] - (j - i) * D));
}
conv(ans);
}
cout << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
22 ms |
340 KB |
Output is correct |
2 |
Correct |
21 ms |
348 KB |
Output is correct |
3 |
Correct |
21 ms |
352 KB |
Output is correct |
4 |
Correct |
22 ms |
364 KB |
Output is correct |
5 |
Correct |
22 ms |
352 KB |
Output is correct |
6 |
Correct |
23 ms |
340 KB |
Output is correct |
7 |
Correct |
23 ms |
340 KB |
Output is correct |
8 |
Correct |
27 ms |
340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
22 ms |
340 KB |
Output is correct |
2 |
Correct |
21 ms |
348 KB |
Output is correct |
3 |
Correct |
21 ms |
352 KB |
Output is correct |
4 |
Correct |
22 ms |
364 KB |
Output is correct |
5 |
Correct |
22 ms |
352 KB |
Output is correct |
6 |
Correct |
23 ms |
340 KB |
Output is correct |
7 |
Correct |
23 ms |
340 KB |
Output is correct |
8 |
Correct |
27 ms |
340 KB |
Output is correct |
9 |
Execution timed out |
1563 ms |
3788 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1528 ms |
340 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1528 ms |
340 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |