結果

問題 No.511 落ちゲー 〜手作業のぬくもり〜
ユーザー vjudge1
提出日時 2025-02-23 14:29:16
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 919 bytes
コンパイル時間 1,407 ms
コンパイル使用メモリ 165,108 KB
実行使用メモリ 9,712 KB
最終ジャッジ日時 2025-02-23 14:29:21
合計ジャッジ時間 3,356 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 31 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
//#define DEBUG
const int N=1e5+10; int c[N]; std::vector<std::pair<int,int> >v[N];
void add(int x,int y) { for(;x<N;x+=x&-x) c[x]+=y; }
int sum(int x) { int ans=0; for(;x;x-=x&-x) ans+=c[x]; return ans; }
int main() {
    //freopen("game.in","r",stdin);
    //freopen("game.out","w",stdout);
    std::ios::sync_with_stdio(false),std::cin.tie(nullptr);
    int n,w,h,a=0,b=0; std::cin>>n>>w>>h;
    for(int i=1,a,b,x;i<=n;i++) std::cin>>a>>b>>x,v[x].push_back({i,b}),v[x+a].push_back({i,-b});
    for(int i=1;i<=w;i++) {
        for(auto j:v[i]) add(j.first,j.second);
        int l=1,r=n,ans=0;
        while(l<=r) {
            int m=(l+r)>>1;
            if(sum(m)>=h) ans=m,r=m-1;
            else l=m+1;
        }
        if(ans) (ans&1?a++:b++);
    }
    if(a>b) std::cout<<'A';
    if(a<b) std::cout<<'B';
    if(a==b) std::cout<<"DRAW";
    //std::cout<<'\n'<<a<<' '<<b;
    return 0;
}
0