結果
| 問題 |
No.334 門松ゲーム
|
| コンテスト | |
| ユーザー |
maspy
|
| 提出日時 | 2020-02-02 14:25:17 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 42 ms / 2,000 ms |
| コード長 | 670 bytes |
| コンパイル時間 | 81 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2024-09-18 20:44:36 |
| 合計ジャッジ時間 | 1,416 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 13 |
ソースコード
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import itertools
N,*K = map(int,read().split())
def F(K):
"""勝てるなら、Trueとその初手
負けるなら、Falseを返す"""
for i,j,k in itertools.combinations(range(len(K)),3):
is_kadomatsu = (K[i] > K[j] < K[k]) or (K[i] < K[j] > K[k])
if not is_kadomatsu:
continue
newK = [x for ind,x in enumerate(K) if ind not in [i,j,k]]
result = F(newK)
if not result:
return True, (i,j,k)
return False
result = F(K)
if result:
print(*result[1])
else:
print(-1)
maspy