結果

問題 No.334 門松ゲーム
ユーザー titiatitia
提出日時 2022-11-12 01:15:54
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 30 ms / 2,000 ms
コード長 784 bytes
コンパイル時間 214 ms
コンパイル使用メモリ 10,940 KB
実行使用メモリ 7,984 KB
最終ジャッジ日時 2023-10-11 19:06:47
合計ジャッジ時間 1,266 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,808 KB
testcase_01 AC 16 ms
7,884 KB
testcase_02 AC 23 ms
7,808 KB
testcase_03 AC 16 ms
7,964 KB
testcase_04 AC 16 ms
7,924 KB
testcase_05 AC 15 ms
7,868 KB
testcase_06 AC 19 ms
7,764 KB
testcase_07 AC 21 ms
7,764 KB
testcase_08 AC 18 ms
7,984 KB
testcase_09 AC 18 ms
7,808 KB
testcase_10 AC 30 ms
7,848 KB
testcase_11 AC 20 ms
7,804 KB
testcase_12 AC 16 ms
7,828 KB
testcase_13 AC 16 ms
7,816 KB
testcase_14 AC 19 ms
7,816 KB
testcase_15 AC 18 ms
7,828 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
A=list(map(int,input().split()))

def win(A):
    if len(A)<3:
        return 0

    else:
        for i in range(len(A)):
            for j in range(i+1,len(A)):
                for k in range(j+1,len(A)):


                    X=[A[i],A[j],A[k]]

                    if len(set(X))!=3:
                        continue

                    if max(X)==X[1] or min(X)==X[1]:
                        B=[]

                        for l in range(len(A)):
                            if l==i or l==j or l==k:
                                continue
                            B.append(A[l])

                        if win(B)==0:
                            return (i,j,k)

        return 0

k=win(A)

if k==0:
    print(-1)
else:
    print(*k)
                        
0