답안 #862064

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
862064 2023-10-17T13:15:59 Z vgtcross Measures (CEOI22_measures) C++17
24 / 100
1500 ms 6992 KB
#include <bits/stdc++.h>

using namespace std;

using ll = long long;

void print_ans(ll ans) {
    cout << ans/2;
    if (ans & 1) cout << ".5";
    cout << ' ';
}

void solve() {
    ll n, m, d;
    cin >> n >> m >> d;
    d *= 2;
    
    vector<ll> v(n);
    for (ll &i : v) {
        cin >> i;
        i *= 2;
    }
    
    for (int i = 0; i < m; ++i) {
        ll u;
        cin >> u;
        v.push_back(2*u);
        sort(v.begin(), v.end());
        ll l = -1, r = 1e15;
        while (r-l > 1) {
            ll md = (l + r) / 2;
            ll pp = -1e18;
            bool g = 1;
            for (int j : v) {
                ll pos = max(j - md, pp + d);
                g &= pos <= j + md;
                pp = pos;
            }
            if (g) r = md;
            else l = md;
        }
        print_ans(r);
    }
    cout << '\n';
}

int main() {
    cin.tie(0) -> sync_with_stdio(0);
    
    solve();
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 344 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 3 ms 348 KB Output is correct
5 Correct 2 ms 344 KB Output is correct
6 Correct 2 ms 492 KB Output is correct
7 Correct 2 ms 468 KB Output is correct
8 Correct 2 ms 464 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 344 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 3 ms 348 KB Output is correct
5 Correct 2 ms 344 KB Output is correct
6 Correct 2 ms 492 KB Output is correct
7 Correct 2 ms 468 KB Output is correct
8 Correct 2 ms 464 KB Output is correct
9 Correct 224 ms 6492 KB Output is correct
10 Correct 276 ms 6492 KB Output is correct
11 Correct 179 ms 5468 KB Output is correct
12 Correct 282 ms 6992 KB Output is correct
13 Correct 167 ms 5976 KB Output is correct
14 Correct 225 ms 6108 KB Output is correct
15 Correct 229 ms 6232 KB Output is correct
16 Correct 177 ms 5344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1560 ms 1028 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1560 ms 1028 KB Time limit exceeded
2 Halted 0 ms 0 KB -