結果
| 問題 | No.334 門松ゲーム |
| コンテスト | |
| ユーザー |
FromBooska
|
| 提出日時 | 2023-03-10 22:34:01 |
| 言語 | PyPy3 (7.3.23 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 101 ms / 2,000 ms |
| + 107µs | |
| コード長 | 809 bytes |
| 記録 | |
| コンパイル時間 | 261 ms |
| コンパイル使用メモリ | 95,848 KB |
| 実行使用メモリ | 84,480 KB |
| 最終ジャッジ日時 | 2026-08-30 00:42:58 |
| 合計ジャッジ時間 | 3,009 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 13 |
ソースコード
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):
hand = [LIST[i], LIST[j], LIST[k]]
if len(set(hand)) != 3:
continue
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)
FromBooska