結果

問題 No.116 門松列(1)
ユーザー _Clay____
提出日時 2018-10-13 17:07:48
言語 Rust
(1.83.0 + proconio)
結果
WA  
実行時間 -
コード長 506 bytes
コンパイル時間 10,290 ms
コンパイル使用メモリ 403,504 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-12 18:06:44
合計ジャッジ時間 11,481 ms
ジャッジサーバーID
(参考情報)
judge / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 8 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io;

fn main() {
  let mut buf = String::new();
  io::stdin().read_line(&mut buf).ok();

  let mut buf = String::new();
  io::stdin().read_line(&mut buf).ok();
  let a: Vec<u16> = buf
    .trim()
    .split_whitespace()
    .map(|e| e.parse().ok().unwrap())
    .collect();

  let mut result = 0;

  for v in a.windows(3) {
    let &max = v.iter().max().unwrap();
    let &min = v.iter().min().unwrap();

    if v[1] == max || v[1] == min {
      result += 1;
    }
  }
  println!("{}", result);
}
0