結果
| 問題 |
No.334 門松ゲーム
|
| コンテスト | |
| ユーザー |
FromBooska
|
| 提出日時 | 2023-04-12 18:51:07 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 93 ms / 2,000 ms |
| コード長 | 788 bytes |
| コンパイル時間 | 390 ms |
| コンパイル使用メモリ | 82,048 KB |
| 実行使用メモリ | 76,196 KB |
| 最終ジャッジ日時 | 2024-10-08 18:00:06 |
| 合計ジャッジ時間 | 2,165 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 13 |
ソースコード
# 自力練習
N = int(input())
K = list(map(int, input().split()))
import sys
sys.setrecursionlimit(10**7)
def dfs(LIST):
L = len(LIST)
for a in range(L):
for b in range(a+1, L):
for c in range(b+1, L):
hand = [LIST[a], LIST[b], LIST[c]]
if len(set(hand)) == 3:
if max(hand) == hand[1] or min(hand) == hand[1]:
new_hand = []
for l in range(L):
if l != a and l != b and l != c:
new_hand.append(LIST[l])
if dfs(new_hand) == 0:
return (a, b, c)
return 0
result = dfs(K)
if result == 0:
print(-1)
else:
print(*result)
FromBooska