結果

問題 No.1109 調の判定
コンテスト
ユーザー tobusakana
提出日時 2020-08-23 12:34:46
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 97 ms / 2,000 ms
コード長 556 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 730 ms
コンパイル使用メモリ 20,604 KB
実行使用メモリ 15,484 KB
最終ジャッジ日時 2026-05-05 09:35:27
合計ジャッジ時間 7,509 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

# coding: utf-8
# Your code here!

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

R = (0,2,4,5,7,9,11)

def check(t,d):
    candi = set()
    for r in R:
        candi.add((d + r) % 12)
        
    for t in T:
        if t not in candi:
            return False
    return True
    
ans = None
for D in range(12):
    # その調ですべてのTが当てはまるかチェック
    if check(T,D):
        if ans is None:
            ans = D
        else:
            print(-1)
            exit(0)
if ans is None:
    print(-1)
else:
    print(ans)
0