結果

問題 No.2015 Stair Counter
ユーザー pengin_2000pengin_2000
提出日時 2022-08-21 14:05:37
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 22 ms / 2,000 ms
コード長 478 bytes
コンパイル時間 194 ms
コンパイル使用メモリ 30,080 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-18 12:57:04
合計ジャッジ時間 1,738 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
6,812 KB
testcase_01 AC 12 ms
6,940 KB
testcase_02 AC 11 ms
6,944 KB
testcase_03 AC 13 ms
6,940 KB
testcase_04 AC 12 ms
6,940 KB
testcase_05 AC 12 ms
6,940 KB
testcase_06 AC 16 ms
6,944 KB
testcase_07 AC 13 ms
6,944 KB
testcase_08 AC 13 ms
6,944 KB
testcase_09 AC 11 ms
6,944 KB
testcase_10 AC 11 ms
6,940 KB
testcase_11 AC 12 ms
6,940 KB
testcase_12 AC 10 ms
6,940 KB
testcase_13 AC 10 ms
6,940 KB
testcase_14 AC 11 ms
6,940 KB
testcase_15 AC 14 ms
6,940 KB
testcase_16 AC 19 ms
6,940 KB
testcase_17 AC 13 ms
6,940 KB
testcase_18 AC 17 ms
6,940 KB
testcase_19 AC 22 ms
6,940 KB
testcase_20 AC 16 ms
6,940 KB
testcase_21 AC 11 ms
6,944 KB
testcase_22 AC 12 ms
6,940 KB
testcase_23 AC 13 ms
6,940 KB
testcase_24 AC 12 ms
6,944 KB
testcase_25 AC 11 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>
int a[200005];
int main()
{
	int t;
	scanf("%d", &t);
	int n, m;
	int i;
	int x, y, f;
	for (; t > 0; t--)
	{
		scanf("%d %d", &n, &m);
		a[0] = m;
		for (i = 0; i < n; i++)
			scanf("%d", &a[i + 1]);
		f = 0;
		x = m - a[1];
		y = a[1];
		for (i = 2; i <= n; i++)
		{
			if (x > a[i])
				f++;
			y -= a[i] - x;
			x = a[i];
			y ^= x;
			x ^= y;
			y ^= x;
			if (x < 0)
				f++;
		}
		if (f > 0)
			printf("No\n");
		else
			printf("Yes\n");
	}
	return 0;
}
0