結果
問題 | No.334 門松ゲーム |
ユーザー |
|
提出日時 | 2018-07-27 12:17:11 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 45 ms / 2,000 ms |
コード長 | 478 bytes |
コンパイル時間 | 97 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-07-01 03:31:10 |
合計ジャッジ時間 | 1,446 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 |
ソースコード
#yuki334 import itertools def iskd(t,l): a,b,c = [l[i] for i in t] if a==b or b==c or a==c: return False return max(a,b,c)==b or min(a,b,c) == b def solve(n,l): if n<3: return (-1, ) for t in itertools.combinations(range(n),3): if not iskd(t,l): continue ks=[k for i,k in enumerate(l) if i not in t] res=solve(n-3,ks) if res==(-1, ): return t return (-1, ) n=int(input()) l=list(map(int,input().split())) print(*solve(n,l))