結果

問題 No.1290 Addition and Subtraction Operation
ユーザー tailstails
提出日時 2020-11-13 23:01:18
言語 cLay
(20240104-1)
結果
RE  
実行時間 -
コード長 630 bytes
コンパイル時間 2,338 ms
コンパイル使用メモリ 169,424 KB
実行使用メモリ 7,340 KB
最終ジャッジ日時 2023-09-19 01:51:40
合計ジャッジ時間 10,779 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 RE -
testcase_07 RE -
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 RE -
testcase_12 AC 1 ms
4,376 KB
testcase_13 RE -
testcase_14 AC 1 ms
4,380 KB
testcase_15 RE -
testcase_16 AC 1 ms
4,376 KB
testcase_17 RE -
testcase_18 RE -
testcase_19 WA -
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 1 ms
4,380 KB
testcase_23 RE -
testcase_24 AC 1 ms
4,376 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 1 ms
4,380 KB
testcase_27 AC 1 ms
4,380 KB
testcase_28 AC 1 ms
4,376 KB
testcase_29 AC 1 ms
4,380 KB
testcase_30 AC 2 ms
4,376 KB
testcase_31 RE -
testcase_32 AC 2 ms
4,376 KB
testcase_33 AC 1 ms
4,380 KB
testcase_34 RE -
testcase_35 AC 1 ms
4,376 KB
testcase_36 AC 1 ms
4,376 KB
testcase_37 RE -
testcase_38 AC 2 ms
4,376 KB
testcase_39 AC 1 ms
4,380 KB
testcase_40 RE -
testcase_41 AC 2 ms
4,376 KB
testcase_42 RE -
testcase_43 RE -
testcase_44 RE -
testcase_45 RE -
testcase_46 RE -
testcase_47 RE -
testcase_48 RE -
testcase_49 RE -
testcase_50 RE -
testcase_51 RE -
testcase_52 RE -
testcase_53 RE -
testcase_54 RE -
testcase_55 RE -
testcase_56 RE -
testcase_57 AC 5 ms
4,880 KB
testcase_58 AC 6 ms
5,416 KB
testcase_59 AC 5 ms
4,932 KB
testcase_60 AC 10 ms
6,956 KB
testcase_61 AC 9 ms
6,824 KB
testcase_62 AC 9 ms
6,792 KB
testcase_63 AC 7 ms
5,412 KB
testcase_64 AC 4 ms
4,604 KB
testcase_65 AC 4 ms
4,796 KB
testcase_66 AC 7 ms
5,772 KB
testcase_67 AC 10 ms
6,788 KB
testcase_68 AC 9 ms
6,952 KB
testcase_69 AC 7 ms
5,528 KB
testcase_70 AC 7 ms
5,520 KB
testcase_71 AC 7 ms
5,520 KB
testcase_72 AC 4 ms
4,748 KB
testcase_73 AC 8 ms
5,800 KB
testcase_74 AC 4 ms
4,428 KB
testcase_75 AC 4 ms
4,560 KB
testcase_76 AC 6 ms
5,500 KB
testcase_77 RE -
testcase_78 RE -
testcase_79 RE -
testcase_80 RE -
testcase_81 RE -
testcase_82 RE -
testcase_83 RE -
testcase_84 RE -
testcase_85 RE -
testcase_86 AC 5 ms
5,220 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

priority_queue<pair<ll,ll>> q;

ll bs[1d5];
ll ad,as[1d5+1];

{
	int @n,@m;
	rd(bs(n));
	rep(m){
		ll @l,@r;
		q.push({-(l-1),-(r)});
	}
	rep(i,0,n,2)bs[i]=-bs[i];
	int x=0;
	while(!q.empty()){
		pair<ll,ll> p=q.top();
		q.pop();
		ll l=-p.first;
		ll r=-p.second;
		while(x<l){
			ad+=as[x];
			if(bs[x]!=ad){
				wt("NO");
				exit(0);
			}
			++x;
		}
		while(!q.empty()&&-q.top().first==l){
			pair<ll,ll> p2=q.top();
			q.pop();
			q.push({-r,-p2.second});
		}
		ad+=as[x];
		as[r]-=bs[x]-ad;
		ad=bs[x];
		++x;
	}
	{
		while(x<n){
			ad+=as[x];
			if(bs[x]!=ad){
				wt("NO");
				exit(0);
			}
			++x;
		}
	}
	wt("YES");
}
0