# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
763799 | MilosMilutinovic | Measures (CEOI22_measures) | C++14 | 1563 ms | 1124 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 10;
int n, m, d, a[N], b[N];
bool check(long double x) {
long double prv = a[1] - x;
for (int i = 2; i <= n; i++) {
long double L = a[i] - x;
long double R = a[i] + x;
long double pos = max(L, prv + d);
if (pos > R) {
return false;
}
prv = pos;
}
return true;
}
int main() {
scanf("%d%d%d", &n, &m, &d);
for (int i = 1; i <= n; i++) {
scanf("%d", &a[i]);
}
for (int i = 1; i <= m; i++) {
scanf("%d", &b[i]);
}
for (int i = 1; i <= m; i++) {
a[++n] = b[i];
sort(a + 1, a + n + 1);
//long long low = 0, high = 1e17, ans = 1e17;
/* while (low <= high) {
long long mid = low + (high - low) / 2;
if (check(mid)) {
ans = mid;
high = mid - 1;
} else {
low = mid + 1;
}
} */
long long ans = 0;
for (int l = 1; l <= n; l++)
for (int r = l + 1; r <= n; r++)
ans = max(ans, ((r - l) * 1ll * d - (a[r] - a[l])));
if (ans & 1)
printf("%lld.5 ", ans / 2);
else
printf("%lld ", ans / 2);
/*if (ans > 0 && check(ans - 0.5))
printf("%lld.5 ", ans - 1);
else
printf("%lld ", ans);*/
}
return 0;
}
컴파일 시 표준 에러 (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... |