結果

問題 No.116 門松列(1)
コンテスト
ユーザー yamagh
提出日時 2015-08-23 20:25:00
言語 Ruby
(4.0.2)
コンパイル:
ruby -w -c _filename_
実行:
ruby _filename_
結果
WA  
実行時間 -
コード長 240 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 55 ms
コンパイル使用メモリ 9,216 KB
実行使用メモリ 29,696 KB
最終ジャッジ日時 2026-04-02 06:05:31
合計ジャッジ時間 2,211 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 8 WA * 13
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:6: warning: assigned but unused variable - y
Main.rb:5: warning: possibly useless use of - in void context
Syntax OK

ソースコード

diff #
raw source code

N=gets.to_i
A=gets.split.map(&:to_i)

cnt=0
N-3.times do |t|
  x,y,z=s=A.slice(t,3)
  next if s.uniq.size != 3 
  #puts "x:#{x} y:#{y} z:#{z} max:#{s.max} min:#{s.min}"
  cnt+=1 if (x!=s.max && x!=s.min) || (z!=s.max && z!=s.min)
end
p cnt
0