結果
| 問題 |
No.334 門松ゲーム
|
| コンテスト | |
| ユーザー |
eitaho
|
| 提出日時 | 2016-03-22 00:39:22 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 79 ms / 2,000 ms |
| コード長 | 698 bytes |
| コンパイル時間 | 514 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 10,880 KB |
| 最終ジャッジ日時 | 2024-10-01 12:35:25 |
| 合計ジャッジ時間 | 1,805 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 13 |
ソースコード
N = int(input())
A = list(map(int, input().split()))
used = [0] * N
def valid(a, b, c):
return len(set([a, b, c])) == 3 and (min(a, b, c) == b or max(a, b, c) == b)
def win(depth):
for a in range(N):
for b in range(a + 1, N):
for c in range(b + 1, N):
if used[a] or used[b] or used[c] or not valid(A[a], A[b], A[c]):
continue
used[a] = used[b] = used[c] = 1
w = not win(depth + 1)
used[a] = used[b] = used[c] = 0
if w:
if depth == 0:
print(a, b, c)
return 1
return 0
if not win(0):
print(-1)
eitaho