結果
| 問題 |
No.334 門松ゲーム
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-02-10 06:48:33 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 45 ms / 2,000 ms |
| コード長 | 723 bytes |
| コンパイル時間 | 267 ms |
| コンパイル使用メモリ | 12,288 KB |
| 実行使用メモリ | 10,624 KB |
| 最終ジャッジ日時 | 2024-12-26 14:22:16 |
| 合計ジャッジ時間 | 1,831 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 13 |
ソースコード
import sys
from itertools import combinations
def debug(x, table):
for name, val in table.items():
if x is val:
print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
return None
def is_kadomatu(a):
return a[0] != a[2] and (a[0] - a[1])*(a[2] - a[1]) > 0
def can_win(N, K):
for i, j, k in combinations(range(N), 3):
if is_kadomatu([K[i], K[j], K[k]]):
K1 = K[:i] + K[i + 1:j] + K[j + 1:k] + K[k + 1:]
if can_win(N - 3, K1) == (-1,):
return i, j, k
return (-1,)
def solve():
N = int(input())
K = [int(i) for i in input().split()]
ans = can_win(N, K)
print(*ans)
if __name__ == '__main__':
solve()