結果

問題 No.635 自然門松列
ユーザー aimyaimy
提出日時 2018-01-19 22:52:36
言語 Rust
(1.77.0 + proconio)
結果
WA  
実行時間 -
コード長 3,811 bytes
コンパイル時間 11,991 ms
コンパイル使用メモリ 390,120 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-06 19:21:42
合計ジャッジ時間 14,429 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,816 KB
testcase_02 AC 12 ms
6,944 KB
testcase_03 AC 5 ms
6,944 KB
testcase_04 AC 9 ms
6,940 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 75 ms
6,944 KB
testcase_11 AC 77 ms
6,944 KB
testcase_12 AC 83 ms
6,944 KB
testcase_13 AC 81 ms
6,944 KB
testcase_14 AC 84 ms
6,944 KB
testcase_15 AC 3 ms
6,940 KB
testcase_16 AC 2 ms
6,944 KB
testcase_17 WA -
testcase_18 AC 76 ms
6,940 KB
testcase_19 AC 77 ms
6,944 KB
testcase_20 AC 76 ms
6,940 KB
testcase_21 AC 81 ms
6,940 KB
testcase_22 WA -
testcase_23 AC 79 ms
6,940 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: use of deprecated method `core::str::<impl str>::trim_right`: superseded by `trim_end`
  --> src/main.rs:56:9
   |
56 |     buf.trim_right().parse::<T>().ok().unwrap()
   |         ^^^^^^^^^^
   |
   = note: `#[warn(deprecated)]` on by default
help: replace the use of the deprecated method
   |
56 |     buf.trim_end().parse::<T>().ok().unwrap()
   |         ~~~~~~~~

warning: use of deprecated method `core::str::<impl str>::trim_right`: superseded by `trim_end`
  --> src/main.rs:72:22
   |
72 |     let mut it = buf.trim_right().split_whitespace();
   |                      ^^^^^^^^^^
   |
help: replace the use of the deprecated method
   |
72 |     let mut it = buf.trim_end().split_whitespace();
   |                      ~~~~~~~~

warning: use of deprecated method `core::str::<impl str>::trim_right`: superseded by `trim_end`
  --> src/main.rs:91:22
   |
91 |     let mut it = buf.trim_right().split_whitespace();
   |                      ^^^^^^^^^^
   |
help: replace the use of the deprecated method
   |
91 |     let mut it = buf.trim_end().split_whitespace();
   |                      ~~~~~~~~

warning: use of deprecated method `core::str::<impl str>::trim_right`: superseded by `trim_end`
   --> src/main.rs:111:9
    |
111 |     buf.trim_right().split_whitespace().map(|t| t.parse::<T>().ok().unwrap()).collect()
    |         ^^^^^^^^^^
    |
help: replace the use of the deprecated method
    |
111 |     buf.trim_end().split_whitespace().map(|t| t.parse::<T>().ok().unwrap()).collect()
    |         ~~~~~~~~

warning: use of deprecated method `core::str::<impl str>::trim_right`: superseded by `trim_end`
   --> src/main.rs:127:9
    |
127 |     buf.trim_right().chars().collect()
    |         ^^^^^^^^^^
    |
help: replace the use of the deprecated method
    |
127 |     buf.trim_end().chars().collect()
    |         ~~~~~~~~

ソースコード

diff #

#![allow(unused_imports, unused_macros, unknown_lints)]

use std::collections::*;
use std::cmp::Ordering::*;

macro_rules! dump {($($e:expr), +) => {print!(concat!($(stringify!($e), " = {:?}\n"), +), $($e), +)}}
macro_rules! max {($e0:expr, $($e:expr), +) => {{let mut r = $e0; $(r = std::cmp::max(r, $e);)+ r}}}
macro_rules! min {($e0:expr, $($e:expr), +) => {{let mut r = $e0; $(r = std::cmp::min(r, $e);)+ r}}}

fn main() {
  let n = get::val::<usize>();
  let ts = {
    let mut ts = vec![];
    for _ in 0 .. n {
      let v = get::vec::<f64>();
      let t = (v[0],v[1],v[2],v[3],v[4],v[5]);
      ts.push(t)
    }
    ts
  };

  let is_kadomatsu = |a,b,c| {
    a!=b&&b!=c&&c!=a && 
    (b==f64::max(f64::max(a,b),c) || b==f64::min(f64::min(a,b),c))
  };

  for (mut x1, mut x2, mut x3, y1, y2, y3) in ts {
    let d1 = y1 / 1000.0;
    let d2 = y2 / 1000.0;
    let d3 = y3 / 1000.0;
    let mut ans = false;
    for _ in 0 .. 100000 {
      if is_kadomatsu(x1,x2,x3) {
        ans = true
      }
      x1 += d1;
      x2 += d2;
      x3 += d3
    }
    println!("{}", if ans {"YES"} else {"NO"})
  }

}

#[allow(dead_code)]
mod get {
  use std::io::*;
  use std::str::*;
  use std::process::*;

  pub fn val<T: FromStr>() -> T {
    let mut buf = String::new();
    let s = stdin();
    s.lock().read_line(&mut buf).ok();
    if buf.is_empty() {println!("No input"); exit(0)}
    buf.trim_right().parse::<T>().ok().unwrap()
  }

  pub fn vals<T: FromStr>(n: usize) -> Vec<T> {
    let mut vec: Vec<T> = vec![];
    for _ in 0 .. n {
      vec.push(val());
    }
    vec
  }

  pub fn tuple<T1: FromStr, T2: FromStr>() -> (T1, T2) {
    let mut buf = String::new();
    let s = stdin();
    s.lock().read_line(&mut buf).ok();
    if buf.is_empty() {println!("No input"); exit(0)}
    let mut it = buf.trim_right().split_whitespace();
    let x = it.next().unwrap().parse::<T1>().ok().unwrap();
    let y = it.next().unwrap().parse::<T2>().ok().unwrap();
    (x, y)
  }

  pub fn tuples<T1: FromStr, T2: FromStr>(n: usize) -> Vec<(T1, T2)> {
    let mut vec: Vec<(T1, T2)> = vec![];
    for _ in 0 .. n {
      vec.push(tuple());
    }
    vec
  }

  pub fn tuple3<T1: FromStr, T2: FromStr, T3: FromStr>() -> (T1, T2, T3) {
    let mut buf = String::new();
    let s = stdin();
    s.lock().read_line(&mut buf).ok();
    if buf.is_empty() {println!("No input"); exit(0)}
    let mut it = buf.trim_right().split_whitespace();
    let x = it.next().unwrap().parse::<T1>().ok().unwrap();
    let y = it.next().unwrap().parse::<T2>().ok().unwrap();
    let z = it.next().unwrap().parse::<T3>().ok().unwrap();
    (x, y, z)
  }

  pub fn tuple3s<T1: FromStr, T2: FromStr, T3: FromStr>(n: usize) -> Vec<(T1, T2, T3)> {
    let mut vec: Vec<(T1, T2, T3)> = vec![];
    for _ in 0 .. n {
      vec.push(tuple3());
    }
    vec
  }

  pub fn vec<T: FromStr>() -> Vec<T> {
    let mut buf = String::new();
    let s = stdin();
    s.lock().read_line(&mut buf).ok();
    if buf.is_empty() {println!("No input"); exit(0)}
    buf.trim_right().split_whitespace().map(|t| t.parse::<T>().ok().unwrap()).collect()
  }

  pub fn mat<T: FromStr>(h: usize) -> Vec<Vec<T>> {
    let mut mat = vec![];
    for _ in 0 .. h {
      mat.push(vec());
    }
    mat
  }

  pub fn chars() -> Vec<char> {
    let mut buf = String::new();
    let s = stdin();
    s.lock().read_line(&mut buf).ok();
    if buf.is_empty() {println!("No input"); exit(0)}
    buf.trim_right().chars().collect()
  }
}

#[allow(dead_code)]
mod put {
  use std::string::*;

  pub fn vec<T: ToString>(vec: &Vec<T>, sep: &str) {
    let out = vec.iter().map(|e| e.to_string()).collect::<Vec<_>>().as_slice().join(sep);
    println!("{}", out);
  }

  pub fn mat<T: ToString>(mat: &Vec<Vec<T>>, sep: &str) {
    for v in mat {
      vec(v, sep);
    }
  }
}
0