Submission #723393

# Submission time Handle Problem Language Result Execution time Memory
723393 2023-04-13T16:59:20 Z rnl42 Measures (CEOI22_measures) C++14
0 / 100
1500 ms 1372 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long

int N, M, D;
vector<int> A;
int ans = 0;

signed main() {
    ios::sync_with_stdio(false), cout.tie(0), cin.tie(0);
    cin >> N >> M >> D;
    A.resize(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    int in;
    for (int i = 0; i < M; i++) {
        cin >> in;
        int j = 0;
        for (; j < (int)A.size() && A[j] < in; j++);
        A.insert(A.begin()+j, in);
        int truc = 0;
        int cur = 0;
        int mini = 0;
        for (int i = (int)A.size()-2; i >= 0; i--) {
            int deltamin = D+A[i]-A[i+1];
            if (deltamin >= 0) {
                cur = cur - deltamin;
            } else {
                cur = -deltamin+truc;
            }
            mini = min(cur, mini);
        }
        int ans = abs(mini);
        cout << (ans>>1); if (ans & 1) cout << ".5";
        cout << (i == M-1 ? '\n' : ' ');
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1518 ms 1372 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1518 ms 1372 KB Time limit exceeded
2 Halted 0 ms 0 KB -