結果
| 問題 |
No.511 落ちゲー 〜手作業のぬくもり〜
|
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2025-02-23 18:23:13 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,193 bytes |
| コンパイル時間 | 1,547 ms |
| コンパイル使用メモリ | 161,972 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2025-02-23 18:23:17 |
| 合計ジャッジ時間 | 3,105 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 5 |
| other | WA * 32 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:42:16: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
42 | freopen("game.in","r",stdin);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~
main.cpp:43:16: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
43 | freopen("game.out","w",stdout);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
main.cpp:44:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
44 | scanf("%d%d%lld",&T,&n,&h);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~
main.cpp:49:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
49 | scanf("%d%d%d",&a,&b,&x);
| ~~~~~^~~~~~~~~~~~~~~~~~~
ソースコード
#include<bits/stdc++.h>
using namespace std;
int T,n;long long h;
long long d[100005];
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(){
freopen("game.in","r",stdin);
freopen("game.out","w",stdout);
scanf("%d%d%lld",&T,&n,&h);
int ls=0;
while(T--){
tu^=1;
int a,b,x;
scanf("%d%d%d",&a,&b,&x);
int L=x,R=a+x-1;
for(int i=L;i<=R;++i)d[i]=d[i]+b;
int he=0;
for(int i=1;i<=n;++i)he+=(d[i]>=h);
if(tu==1)A+=he-ls;
else B+=he-ls;
ls=he;
}
puts(A>B?"A":A==B?"DRAW":"B");
printf("%d %d\n",A,B);
return 0;
}
vjudge1