結果

問題 No.1219 Mancala Combo
ユーザー Chihaya_chanChihaya_chan
提出日時 2020-09-04 22:14:24
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 793 bytes
コンパイル時間 2,060 ms
コンパイル使用メモリ 86,728 KB
実行使用メモリ 109,300 KB
最終ジャッジ日時 2023-08-17 15:58:05
合計ジャッジ時間 5,234 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,080 KB
testcase_01 AC 72 ms
71,404 KB
testcase_02 AC 74 ms
71,120 KB
testcase_03 AC 73 ms
71,004 KB
testcase_04 WA -
testcase_05 AC 70 ms
71,244 KB
testcase_06 WA -
testcase_07 AC 73 ms
71,180 KB
testcase_08 WA -
testcase_09 AC 73 ms
71,076 KB
testcase_10 WA -
testcase_11 AC 72 ms
70,992 KB
testcase_12 WA -
testcase_13 AC 71 ms
71,320 KB
testcase_14 AC 72 ms
71,388 KB
testcase_15 AC 76 ms
71,404 KB
testcase_16 WA -
testcase_17 AC 108 ms
98,632 KB
testcase_18 WA -
testcase_19 AC 101 ms
94,904 KB
testcase_20 WA -
testcase_21 AC 97 ms
92,528 KB
testcase_22 WA -
testcase_23 AC 112 ms
105,208 KB
testcase_24 WA -
testcase_25 AC 100 ms
94,720 KB
testcase_26 WA -
testcase_27 AC 116 ms
107,316 KB
testcase_28 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int, input().split()))


def judge(List):
    L = len(List)
    if L == 0:
        return True
    if L % 2 == 0:
        flag = True
        for i in range(L//2, L):
            if List[i] != 2*(i+1-L//2):
                flag = False
                break
        if flag:
            return judge(List[:L//2])
        else:
            return False
    else:
        if List[-1] != L:
            if List[-1]!=0:
                return False
            else:
                return judge(List[:-2])
        else:
            for i in range(L-1):
                List[i] += 1
            List[0] = 0
            return judge(List[:L-1])


R = -1
for i in range(N):
    if A[i] > 0:
        R = i
A = A[:R+1]

if judge(A):
    print("Yes")
else:
    print("No")
0