結果

問題 No.1290 Addition and Subtraction Operation
ユーザー tailstails
提出日時 2020-11-13 23:16:38
言語 cLay
(20240104-1)
結果
AC  
実行時間 603 ms / 2,000 ms
コード長 448 bytes
コンパイル時間 3,532 ms
コンパイル使用メモリ 164,428 KB
実行使用メモリ 442,288 KB
最終ジャッジ日時 2023-09-19 01:52:07
合計ジャッジ時間 9,272 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
5,896 KB
testcase_01 AC 3 ms
5,944 KB
testcase_02 AC 3 ms
5,904 KB
testcase_03 AC 3 ms
5,784 KB
testcase_04 AC 3 ms
5,772 KB
testcase_05 AC 3 ms
5,984 KB
testcase_06 AC 3 ms
5,772 KB
testcase_07 AC 3 ms
5,824 KB
testcase_08 AC 3 ms
5,776 KB
testcase_09 AC 3 ms
5,828 KB
testcase_10 AC 3 ms
5,944 KB
testcase_11 AC 3 ms
5,992 KB
testcase_12 AC 3 ms
5,772 KB
testcase_13 AC 3 ms
5,940 KB
testcase_14 AC 3 ms
5,892 KB
testcase_15 AC 3 ms
5,828 KB
testcase_16 AC 3 ms
5,900 KB
testcase_17 AC 3 ms
6,020 KB
testcase_18 AC 3 ms
5,872 KB
testcase_19 AC 3 ms
5,896 KB
testcase_20 AC 3 ms
5,896 KB
testcase_21 AC 3 ms
5,948 KB
testcase_22 AC 3 ms
5,828 KB
testcase_23 AC 3 ms
5,936 KB
testcase_24 AC 3 ms
5,936 KB
testcase_25 AC 3 ms
5,876 KB
testcase_26 AC 3 ms
5,828 KB
testcase_27 AC 3 ms
5,952 KB
testcase_28 AC 3 ms
5,936 KB
testcase_29 AC 3 ms
5,824 KB
testcase_30 AC 3 ms
5,876 KB
testcase_31 AC 3 ms
5,980 KB
testcase_32 AC 3 ms
5,824 KB
testcase_33 AC 3 ms
5,892 KB
testcase_34 AC 3 ms
5,776 KB
testcase_35 AC 3 ms
6,020 KB
testcase_36 AC 3 ms
5,820 KB
testcase_37 AC 3 ms
5,992 KB
testcase_38 AC 3 ms
5,940 KB
testcase_39 AC 3 ms
5,828 KB
testcase_40 AC 3 ms
5,936 KB
testcase_41 AC 3 ms
5,832 KB
testcase_42 AC 148 ms
123,796 KB
testcase_43 AC 146 ms
123,892 KB
testcase_44 AC 146 ms
123,784 KB
testcase_45 AC 146 ms
123,904 KB
testcase_46 AC 147 ms
123,848 KB
testcase_47 AC 147 ms
123,708 KB
testcase_48 AC 147 ms
123,736 KB
testcase_49 AC 145 ms
123,716 KB
testcase_50 AC 147 ms
123,716 KB
testcase_51 AC 146 ms
123,860 KB
testcase_52 AC 146 ms
123,900 KB
testcase_53 AC 146 ms
123,932 KB
testcase_54 AC 146 ms
123,736 KB
testcase_55 AC 145 ms
123,788 KB
testcase_56 AC 145 ms
123,784 KB
testcase_57 AC 9 ms
7,852 KB
testcase_58 AC 12 ms
8,360 KB
testcase_59 AC 9 ms
7,716 KB
testcase_60 AC 20 ms
9,756 KB
testcase_61 AC 16 ms
9,168 KB
testcase_62 AC 18 ms
9,248 KB
testcase_63 AC 12 ms
8,356 KB
testcase_64 AC 5 ms
6,912 KB
testcase_65 AC 7 ms
7,356 KB
testcase_66 AC 14 ms
8,936 KB
testcase_67 AC 21 ms
9,616 KB
testcase_68 AC 18 ms
9,236 KB
testcase_69 AC 12 ms
8,264 KB
testcase_70 AC 11 ms
8,076 KB
testcase_71 AC 14 ms
8,660 KB
testcase_72 AC 7 ms
7,712 KB
testcase_73 AC 15 ms
8,860 KB
testcase_74 AC 5 ms
6,916 KB
testcase_75 AC 6 ms
7,256 KB
testcase_76 AC 11 ms
8,128 KB
testcase_77 AC 120 ms
85,628 KB
testcase_78 AC 41 ms
22,240 KB
testcase_79 AC 14 ms
9,472 KB
testcase_80 AC 603 ms
442,288 KB
testcase_81 AC 541 ms
402,164 KB
testcase_82 AC 16 ms
9,580 KB
testcase_83 AC 22 ms
10,136 KB
testcase_84 AC 21 ms
10,120 KB
testcase_85 AC 10 ms
8,880 KB
testcase_86 AC 6 ms
7,840 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

vector<ll> v[1d5+1];

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

{
	int @n,@m;
	rd(bs(n));
	rep(m){
		ll @l,@r;
		v[l-1].push_back(r);
	}
	rep(i,0,n,2)bs[i]=-bs[i];
	rep(x,n){
		ad+=as[x];
		if(v[x].empty()){
			if(bs[x]!=ad){
				wt("NO");
				exit(0);
			}
			continue;
		}
		int r=v[x][0];
		rep(y,1,v[x].size()){
			int r2=v[x][y];
			if(r>r2) swap(r,r2);
			if(r!=r2) v[r].push_back(r2);
		}
		v[x].clear();
		as[r]-=bs[x]-ad;
		ad=bs[x];
	}
	wt("YES");
}
0