結果
| 問題 | No.686 Uncertain LIS | 
| コンテスト | |
| ユーザー |  vjudge1 | 
| 提出日時 | 2025-02-23 18:22:41 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 1,129 bytes | 
| コンパイル時間 | 1,552 ms | 
| コンパイル使用メモリ | 161,524 KB | 
| 実行使用メモリ | 6,824 KB | 
| 最終ジャッジ日時 | 2025-02-23 18:22:52 | 
| 合計ジャッジ時間 | 6,661 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | WA * 14 RE * 22 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:42:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   42 |         scanf("%d%d%lld",&T,&n,&h);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~
main.cpp:47:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   47 |                 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(){
	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;
}
            
            
            
        