結果
問題 |
No.511 落ちゲー 〜手作業のぬくもり〜
|
ユーザー |
![]() |
提出日時 | 2025-02-24 17:16:14 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 92 ms / 4,000 ms |
コード長 | 1,040 bytes |
コンパイル時間 | 3,290 ms |
コンパイル使用メモリ | 273,792 KB |
実行使用メモリ | 8,840 KB |
最終ジャッジ日時 | 2025-02-24 17:16:25 |
合計ジャッジ時間 | 5,566 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 |
other | AC * 32 |
ソースコード
#include<bits/stdc++.h> #define int long long using namespace std; const int N=100005; int n,w,h,s[2],mx[N<<2],lz[N<<2]; void pushdown(int u) { mx[u<<1]+=lz[u];mx[u<<1|1]+=lz[u]; lz[u<<1]+=lz[u];lz[u<<1|1]+=lz[u]; lz[u]=0; } void modify(int u,int l,int r,int id) { if(l==r) { if(mx[u]>=h) { mx[u]=-1e18; s[id&1]++; } return; } pushdown(u); int mid=l+r>>1; if(mx[u<<1]>=h)modify(u<<1,l,mid,id); if(mx[u<<1|1]>=h)modify(u<<1|1,mid+1,r,id); mx[u]=max(mx[u<<1],mx[u<<1|1]); } void update(int u,int l,int r,int L,int R,int w,int id) { if(r<L||l>R)return; if(L<=l&&r<=R) { mx[u]+=w;lz[u]+=w; if(mx[u]>=h)modify(u,l,r,id); return; } pushdown(u); int mid=l+r>>1; update(u<<1,l,mid,L,R,w,id); update(u<<1|1,mid+1,r,L,R,w,id); mx[u]=max(mx[u<<1],mx[u<<1|1]); } signed main() { ios::sync_with_stdio(0); cin.tie(0);cout.tie(0); cin>>n>>w>>h; for(int i=1,a,b,x;i<=n;i++) { cin>>a>>b>>x; update(1,1,w,x,x+a-1,b,i); } if(s[1]>s[0])cout<<"A\n"; if(s[0]>s[1])cout<<"B\n"; if(s[0]==s[1])cout<<"DRAW\n"; }