結果

問題 No.334 門松ゲーム
ユーザー FromBooskaFromBooska
提出日時 2023-03-10 22:31:30
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 804 bytes
コンパイル時間 272 ms
コンパイル使用メモリ 81,788 KB
実行使用メモリ 75,676 KB
最終ジャッジ日時 2023-10-18 08:13:55
合計ジャッジ時間 1,906 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,400 KB
testcase_01 AC 38 ms
53,400 KB
testcase_02 AC 39 ms
53,400 KB
testcase_03 AC 38 ms
53,400 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 102 ms
75,676 KB
testcase_07 AC 38 ms
53,400 KB
testcase_08 WA -
testcase_09 AC 38 ms
53,400 KB
testcase_10 AC 38 ms
53,400 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 39 ms
53,400 KB
testcase_15 AC 58 ms
68,412 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

def dfs(LIST):
    # LISTの盤面で手番の人が勝つなら勝つ手、負けるなら0
    L = len(LIST)
    for i in range(L):
        for j in range(i+1, L):
            for k in range(j+1, L):
                if len(set(LIST)) != L:
                    continue
                hand = [LIST[i], LIST[j], LIST[k]]
                if max(hand) == LIST[j] or min(hand) == LIST[j]:
                    new_LIST = []
                    for l in range(L):
                        if l != i and l != j and l != k:
                            new_LIST.append(LIST[l])
                    if dfs(new_LIST) == 0:
                        return [i, j, k]
    return 0
            
result = dfs(K)
if result == 0:
    print(-1)
else:
    print(*result)
0