結果
| 問題 |
No.116 門松列(1)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-04-13 13:55:06 |
| 言語 | Ruby (3.4.1) |
| 結果 |
AC
|
| 実行時間 | 91 ms / 5,000 ms |
| コード長 | 252 bytes |
| コンパイル時間 | 156 ms |
| コンパイル使用メモリ | 7,424 KB |
| 実行使用メモリ | 12,288 KB |
| 最終ジャッジ日時 | 2024-06-25 01:16:29 |
| 合計ジャッジ時間 | 3,078 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
コンパイルメッセージ
Syntax OK
ソースコード
n = gets.to_i
a = gets.split.map(&:to_i)
c = 0
0.upto(n-3) do |i|
x = a[i..(i+2)]
next if x[0] == x[1] || x[1] == x[2] || x[2] == x[0]
y = x.map.with_index{|xi, i| [xi, i] }.sort_by{|e| e[0] }
c += 1 if 0 == y[1][1] || 2 == y[1][1]
end
puts c