# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
739896 | danikoynov | Measures (CEOI22_measures) | C++14 | 1545 ms | 3028 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/**
____ ____ ____ ____ ____ ____
||l |||e |||i |||n |||a |||d ||
||__|||__|||__|||__|||__|||__||
|/__\|/__\|/__\|/__\|/__\|/__\|
**/
#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
typedef long long ll;
void speed()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
}
const int maxn = 2e5 + 10;
int n, m, d;
int a[maxn], b[maxn];
bool check(double x)
{
double last = -1e9;
for (int i = 1; i <= n; i ++)
{
if (last + d > a[i] + x)
return false;
last = max(last + d, a[i] - x);
}
return true;
}
void solve_query()
{
sort(a + 1, a + n + 1);
int lf = 0, rf = 1e9;
while(lf <= rf)
{
int mf = (lf + rf) / 2;
if (check(mf))
rf = mf - 1;
else
lf = mf + 1;
}
double ans = lf;
if (ans > 0 && check(ans - 0.5))
ans = ans - 0.5;
cout << ans << " ";
}
void solve()
{
cin >> n >> m >> d;
for (int i = 1; i <= n; i ++)
cin >> a[i];
for (int i = 1; i <= m; i ++)
cin >> b[i];
for (int i = 1; i <= m; i ++)
{
n ++;
a[n] = b[i];
solve_query();
}
}
int main()
{
solve();
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... |