結果

問題 No.1990 Candy Boxes
ユーザー 👑 ygussanyygussany
提出日時 2022-06-24 22:16:45
言語 C
(gcc 12.3.0)
結果
TLE  
実行時間 -
コード長 677 bytes
コンパイル時間 160 ms
コンパイル使用メモリ 32,456 KB
実行使用メモリ 14,016 KB
最終ジャッジ日時 2024-04-30 18:06:19
合計ジャッジ時間 5,467 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
9,248 KB
testcase_01 AC 1 ms
6,940 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 1 ms
6,940 KB
testcase_05 AC 1 ms
6,940 KB
testcase_06 AC 1 ms
6,944 KB
testcase_07 AC 1 ms
6,944 KB
testcase_08 AC 1 ms
6,944 KB
testcase_09 AC 1 ms
6,944 KB
testcase_10 AC 1 ms
6,944 KB
testcase_11 AC 1 ms
6,944 KB
testcase_12 AC 16 ms
6,944 KB
testcase_13 AC 16 ms
6,944 KB
testcase_14 AC 13 ms
6,940 KB
testcase_15 AC 15 ms
6,944 KB
testcase_16 AC 16 ms
6,944 KB
testcase_17 AC 17 ms
6,944 KB
testcase_18 AC 17 ms
6,940 KB
testcase_19 AC 19 ms
6,944 KB
testcase_20 AC 21 ms
6,940 KB
testcase_21 AC 20 ms
6,944 KB
testcase_22 AC 16 ms
6,944 KB
testcase_23 AC 20 ms
6,940 KB
testcase_24 AC 20 ms
6,940 KB
testcase_25 AC 27 ms
6,944 KB
testcase_26 AC 18 ms
6,944 KB
testcase_27 AC 17 ms
6,944 KB
testcase_28 AC 18 ms
6,944 KB
testcase_29 AC 19 ms
6,940 KB
testcase_30 AC 15 ms
6,944 KB
testcase_31 AC 19 ms
6,940 KB
testcase_32 AC 11 ms
6,940 KB
testcase_33 AC 15 ms
6,944 KB
testcase_34 AC 580 ms
6,940 KB
testcase_35 TLE -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
testcase_54 -- -
testcase_55 -- -
testcase_56 -- -
testcase_57 -- -
testcase_58 -- -
testcase_59 -- -
testcase_60 -- -
testcase_61 -- -
testcase_62 -- -
testcase_63 -- -
testcase_64 -- -
testcase_65 -- -
testcase_66 -- -
testcase_67 -- -
testcase_68 -- -
testcase_69 -- -
testcase_70 -- -
testcase_71 -- -
testcase_72 -- -
testcase_73 -- -
testcase_74 -- -
testcase_75 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC target("avx2")
#pragma GCC optimize("Ofast,unroll-loops")
#include <stdio.h>

int main()
{
	int i, N, B[200001];
	scanf("%d", &N);
	for (i = 1; i <= N; i++) scanf("%d", &(B[i]));
	
	int j, jj;
	for (i = 1, j = 2; i <= N; i++) {
		if (B[i] == 0) continue;
		if (i == N) break;
		if (j <= i) j = i + 1;
		if (B[i] % 2 != B[i+1] % 2) {
			for (; j < N; j++) if (B[j] % 2 == B[j+1] % 2) break;
			if (j == N) break;
			for (jj = j; jj > i; jj--) {
				if (B[jj] == 0 || B[jj+1] == 0) break;
				B[jj]--;
				B[jj+1]--;
			}
		}
		if (B[i] > B[i+1]) break;
		B[i+1] -= B[i];
		B[i] = 0;
	}
	if (i > N) printf("Yes\n");
	else printf("No\n");
	fflush(stdout);
	return 0;
}
0