結果

問題 No.1290 Addition and Subtraction Operation
ユーザー tailstails
提出日時 2020-11-13 22:59:55
言語 cLay
(20240104-1)
結果
WA  
実行時間 -
コード長 649 bytes
コンパイル時間 2,367 ms
コンパイル使用メモリ 169,436 KB
実行使用メモリ 9,180 KB
最終ジャッジ日時 2023-09-19 01:50:01
合計ジャッジ時間 10,578 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,336 KB
testcase_01 AC 3 ms
5,460 KB
testcase_02 AC 2 ms
5,324 KB
testcase_03 AC 2 ms
5,432 KB
testcase_04 WA -
testcase_05 AC 2 ms
5,408 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,320 KB
testcase_08 AC 2 ms
5,416 KB
testcase_09 AC 2 ms
5,540 KB
testcase_10 AC 2 ms
5,656 KB
testcase_11 AC 2 ms
5,408 KB
testcase_12 AC 2 ms
5,436 KB
testcase_13 AC 2 ms
5,536 KB
testcase_14 AC 3 ms
5,480 KB
testcase_15 AC 2 ms
5,676 KB
testcase_16 AC 2 ms
5,412 KB
testcase_17 AC 2 ms
5,432 KB
testcase_18 AC 2 ms
5,420 KB
testcase_19 WA -
testcase_20 AC 2 ms
5,416 KB
testcase_21 AC 2 ms
5,484 KB
testcase_22 AC 2 ms
5,332 KB
testcase_23 AC 2 ms
5,484 KB
testcase_24 AC 2 ms
5,380 KB
testcase_25 AC 3 ms
5,480 KB
testcase_26 AC 2 ms
5,500 KB
testcase_27 AC 2 ms
5,484 KB
testcase_28 AC 2 ms
5,596 KB
testcase_29 AC 2 ms
5,416 KB
testcase_30 AC 2 ms
5,548 KB
testcase_31 AC 2 ms
5,380 KB
testcase_32 AC 2 ms
5,492 KB
testcase_33 WA -
testcase_34 AC 2 ms
5,408 KB
testcase_35 AC 2 ms
5,436 KB
testcase_36 AC 2 ms
5,436 KB
testcase_37 AC 2 ms
5,464 KB
testcase_38 AC 2 ms
5,336 KB
testcase_39 AC 2 ms
5,428 KB
testcase_40 WA -
testcase_41 AC 2 ms
5,508 KB
testcase_42 AC 26 ms
7,180 KB
testcase_43 AC 26 ms
7,064 KB
testcase_44 AC 26 ms
7,056 KB
testcase_45 AC 26 ms
7,048 KB
testcase_46 AC 26 ms
7,132 KB
testcase_47 AC 26 ms
7,140 KB
testcase_48 AC 27 ms
7,076 KB
testcase_49 AC 27 ms
7,064 KB
testcase_50 AC 27 ms
7,276 KB
testcase_51 AC 26 ms
7,076 KB
testcase_52 AC 26 ms
7,132 KB
testcase_53 AC 26 ms
7,076 KB
testcase_54 AC 26 ms
7,208 KB
testcase_55 AC 27 ms
7,268 KB
testcase_56 AC 26 ms
7,072 KB
testcase_57 AC 5 ms
6,068 KB
testcase_58 AC 6 ms
6,656 KB
testcase_59 AC 5 ms
6,056 KB
testcase_60 AC 34 ms
8,956 KB
testcase_61 AC 9 ms
8,016 KB
testcase_62 AC 9 ms
7,972 KB
testcase_63 AC 6 ms
6,668 KB
testcase_64 AC 3 ms
6,044 KB
testcase_65 AC 4 ms
5,968 KB
testcase_66 AC 7 ms
6,604 KB
testcase_67 AC 35 ms
8,840 KB
testcase_68 AC 9 ms
8,128 KB
testcase_69 AC 7 ms
6,464 KB
testcase_70 AC 6 ms
6,800 KB
testcase_71 AC 7 ms
6,664 KB
testcase_72 AC 4 ms
6,240 KB
testcase_73 AC 7 ms
6,884 KB
testcase_74 AC 4 ms
5,964 KB
testcase_75 AC 4 ms
5,924 KB
testcase_76 AC 6 ms
6,448 KB
testcase_77 WA -
testcase_78 WA -
testcase_79 WA -
testcase_80 WA -
testcase_81 WA -
testcase_82 AC 11 ms
8,064 KB
testcase_83 AC 34 ms
8,924 KB
testcase_84 AC 30 ms
8,576 KB
testcase_85 AC 6 ms
7,268 KB
testcase_86 AC 5 ms
6,204 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

priority_queue<pair<ll,ll>> q;

ll bs[1d5];
ll ad,as[1d5+1];
int lc[1d5],rc[1d5];
{
	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