提出 #8325321


ソースコード 拡げる

using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using System.Runtime.CompilerServices;
using static MyUtil;

class MyUtil
{
    public static int[] ReadIntArray()
    {
	return ReadLine().Split().Select(x => int.Parse(x)).ToArray();
    }
}

class Program
{
    public static void Main()
    {
	int n = int.Parse(ReadLine());
	int[] hs = ReadIntArray();

	int curr = ((int) 1e+9) + 1;

	for (int i = n - 1; i >= 0; i--)
	{
	    int h = hs[i];
	    if (h > curr + 1)
	    {
		WriteLine("No");
		return;
	    }
	    else if (h == curr + 1)
	    {
		hs[i]--;
	    }
	    curr = hs[i];
	}
	WriteLine("Yes");
    }
}

提出情報

提出日時
問題 C - Build Stairs
ユーザ unnohideyuki
言語 C# (Mono 4.6.2.0)
得点 300
コード長 717 Byte
結果 AC
実行時間 76 ms
メモリ 27996 KiB

ジャッジ結果

セット名 All Sample
得点 / 配点 300 / 300 0 / 0
結果
AC × 17
AC × 4
セット名 テストケース
All sample_01, sample_02, sample_03, sample_04, testcase_01, testcase_02, testcase_03, testcase_04, testcase_05, testcase_06, testcase_07, testcase_08, testcase_09, testcase_10, testcase_11, testcase_12, testcase_13
Sample sample_01, sample_02, sample_03, sample_04
ケース名 結果 実行時間 メモリ
sample_01 AC 24 ms 13268 KiB
sample_02 AC 24 ms 11220 KiB
sample_03 AC 23 ms 11220 KiB
sample_04 AC 24 ms 13268 KiB
testcase_01 AC 51 ms 16992 KiB
testcase_02 AC 69 ms 17632 KiB
testcase_03 AC 66 ms 19424 KiB
testcase_04 AC 75 ms 23772 KiB
testcase_05 AC 36 ms 13024 KiB
testcase_06 AC 43 ms 13920 KiB
testcase_07 AC 76 ms 27996 KiB
testcase_08 AC 58 ms 17888 KiB
testcase_09 AC 57 ms 18016 KiB
testcase_10 AC 69 ms 19680 KiB
testcase_11 AC 68 ms 19680 KiB
testcase_12 AC 24 ms 13268 KiB
testcase_13 AC 76 ms 26204 KiB