結果
問題 |
No.1095 Smallest Kadomatsu Subsequence
|
ユーザー |
![]() |
提出日時 | 2020-06-27 02:02:18 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 356 bytes |
コンパイル時間 | 64 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 38,040 KB |
最終ジャッジ日時 | 2024-07-05 05:38:52 |
合計ジャッジ時間 | 6,009 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 TLE * 1 -- * 4 |
ソースコード
N = int(input()) A = list(map(int, input().split())) ans = float('inf') first = A[0] second = min(A[1:]) for i, a in enumerate(A[1:-1]): if second == a: second = min(A[2+i:]) if (first - a) * (second - a) > 0: ans = min(ans, first + second + a) if first > a: first = a if ans == float('inf'): ans = -1 print(ans)