結果

問題 No.511 落ちゲー 〜手作業のぬくもり〜
コンテスト
ユーザー t98slider
提出日時 2026-11-23 02:21:20
言語 C++23
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -fplugin=/usr/lib/yukicoder/noavx512-gcc15.so -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 1,071 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 5,286 ms
コンパイル使用メモリ 382,668 KB
実行使用メモリ 15,692 KB
最終ジャッジ日時 2026-11-23 02:21:29
合計ジャッジ時間 8,764 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4 WA * 1
other AC * 30 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using ll = long long;

ll h;
using S = array<ll, 4>;
using F = ll;
constexpr S e(){return S({0, 1ll << 60, 0, 0});}
constexpr S op(S l, S r){
    l[0] = max(l[0], r[0]);
    l[1] = min(l[1], r[1]);
    l[2] += r[2], l[3] += r[3];
    return l;
}
S mapping(F f, S x){
    x[0] += f;
    x[1] += f;
    if(x[1] < h) return x;
    x[3] = x[2];
    return x;
}
constexpr F composition(F f, F g){return f + g;}
constexpr F id(){return 0;}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, w, v, a, b, x;
    cin >> n >> w >> h;
    
    atcoder::lazy_segtree<S, op, e, F, mapping, composition, id> seg(vector<S>(w, S({0, 0, 1, 0})));
    ll ans = 0, pre = 0;
    for(int i = 0; i < n; i++){
        cin >> a >> b >> x;
        x--;
        seg.apply(x, x + a, b);
        auto tmp = seg.all_prod();
        ll d = tmp[3] - pre;
        pre = tmp[3];
        ans += (i & 1 ? -d : d);
        if(tmp[3] >= w) break;
    }
    cout << (ans == 0 ? "DRAW" : ans > 0 ? "A" : "B") << '\n';
}
0