結果
問題 |
No.511 落ちゲー 〜手作業のぬくもり〜
|
ユーザー |
![]() |
提出日時 | 2025-02-23 18:26:44 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 89 ms / 4,000 ms |
コード長 | 960 bytes |
コンパイル時間 | 1,682 ms |
コンパイル使用メモリ | 160,636 KB |
実行使用メモリ | 8,720 KB |
最終ジャッジ日時 | 2025-02-23 18:26:47 |
合計ジャッジ時間 | 3,195 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 |
other | AC * 32 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:41:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 41 | scanf("%d%d%lld",&T,&n,&h); | ~~~~~^~~~~~~~~~~~~~~~~~~~~ main.cpp:45:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 45 | scanf("%d%d%d",&a,&b,&x); | ~~~~~^~~~~~~~~~~~~~~~~~~
ソースコード
#include<bits/stdc++.h> using namespace std; int T,n;long long h; long long mx[400005],lz[400005]; int A=0,B=0,tu=0; void pushdown(int o){ if(lz[o]){ mx[o<<1]+=lz[o],mx[o<<1|1]+=lz[o]; lz[o<<1]+=lz[o],lz[o<<1|1]+=lz[o]; lz[o]=0; } } void get(int l,int r,int o){ if(l==r){ if(mx[o]>=h){ mx[o]=-1e18; if(tu)++A; else ++B; } return; } pushdown(o); int mid=(l+r)>>1; if(mx[o<<1]>=h)get(l,mid,o<<1); if(mx[o<<1|1]>=h)get(mid+1,r,o<<1|1); mx[o]=max(mx[o<<1],mx[o<<1|1]); } void add(int l,int r,int o,int ll,int rr,int z){ if(l>=ll&&r<=rr){ mx[o]+=z;lz[o]+=z; if(mx[o]>=h)get(l,r,o); return; } pushdown(o); int mid=(l+r)>>1; if(mid>=ll)add(l,mid,o<<1,ll,rr,z); if(mid<rr)add(mid+1,r,o<<1|1,ll,rr,z); mx[o]=max(mx[o<<1],mx[o<<1|1]); } int main(){ scanf("%d%d%lld",&T,&n,&h); while(T--){ tu^=1; int a,b,x; scanf("%d%d%d",&a,&b,&x); int L=x,R=a+x-1; add(1,n,1,L,R,b); } puts(A>B?"A":A==B?"DRAW":"B"); return 0; }