답안 #927611

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
927611 2024-02-15T07:11:44 Z math_rabbit_1028 Measures (CEOI22_measures) C++14
35 / 100
308 ms 29640 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int N, M;
ll D;
vector<ll> arr;

int cnt = 0;
struct segtree {
    ll lt[808080], rt[808080], mx[808080], sum[808080];
    void update(int v, int st, int ed, int idx, ll val) {
        if (st > idx || ed < idx) return;
        if (st == ed) {
            lt[v] = rt[v] = mx[v] = sum[v] = val;
            return;
        }
        int mid = (st+ed)/2;
        update(2*v, st, mid, idx, val);
        update(2*v+1, mid+1, ed, idx, val);

        lt[v] = max(lt[2*v], lt[2*v+1] + sum[2*v]);
        rt[v] = max(rt[2*v+1], rt[2*v] + sum[2*v+1]);
        mx[v] = max(mx[2*v], mx[2*v+1]);
        mx[v] = max(mx[v], rt[2*v]+lt[2*v+1]);
        sum[v] = sum[2*v] + sum[2*v+1];
    }
} seg;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie();

    cin >> N >> M >> D;
    
    for (int i = 1; i <= M; i++) {
        ll a;
        cin >> a;

        if (i > 1) seg.update(1, 1, M, i, D - (a-arr.back()));
        ll ans = seg.mx[1];
        if (ans%2) cout << ans/2 << ".5 ";
        else cout << ans/2 << " ";

        arr.push_back(a);
    }

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 4444 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 4444 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 306 ms 25548 KB Output is correct
2 Correct 292 ms 29640 KB Output is correct
3 Correct 284 ms 29380 KB Output is correct
4 Correct 275 ms 27332 KB Output is correct
5 Correct 287 ms 28752 KB Output is correct
6 Correct 278 ms 27688 KB Output is correct
7 Correct 291 ms 28960 KB Output is correct
8 Correct 275 ms 27328 KB Output is correct
9 Correct 276 ms 27448 KB Output is correct
10 Correct 280 ms 29636 KB Output is correct
11 Correct 286 ms 28472 KB Output is correct
12 Correct 281 ms 29232 KB Output is correct
13 Correct 272 ms 27300 KB Output is correct
14 Correct 288 ms 29424 KB Output is correct
15 Correct 299 ms 29092 KB Output is correct
16 Correct 274 ms 26820 KB Output is correct
17 Correct 280 ms 28616 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 306 ms 25548 KB Output is correct
2 Correct 292 ms 29640 KB Output is correct
3 Correct 284 ms 29380 KB Output is correct
4 Correct 275 ms 27332 KB Output is correct
5 Correct 287 ms 28752 KB Output is correct
6 Correct 278 ms 27688 KB Output is correct
7 Correct 291 ms 28960 KB Output is correct
8 Correct 275 ms 27328 KB Output is correct
9 Correct 276 ms 27448 KB Output is correct
10 Correct 280 ms 29636 KB Output is correct
11 Correct 286 ms 28472 KB Output is correct
12 Correct 281 ms 29232 KB Output is correct
13 Correct 272 ms 27300 KB Output is correct
14 Correct 288 ms 29424 KB Output is correct
15 Correct 299 ms 29092 KB Output is correct
16 Correct 274 ms 26820 KB Output is correct
17 Correct 280 ms 28616 KB Output is correct
18 Incorrect 308 ms 28740 KB Output isn't correct
19 Halted 0 ms 0 KB -