結果

問題 No.531 エヌスクミ島の平和協定
ユーザー hatoo
提出日時 2017-06-24 13:31:20
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,182 bytes
コンパイル時間 18,381 ms
コンパイル使用メモリ 379,168 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-28 13:30:06
合計ジャッジ時間 17,625 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 37
権限があれば一括ダウンロードができます

ソースコード

diff #

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet};

mod util {
    use std::io::stdin;
    use std::str::FromStr;
    use std::fmt::Debug;

    #[allow(dead_code)]
    pub fn line() -> String {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().to_string()
    }

    #[allow(dead_code)]
    pub fn get<T: FromStr>() -> T
        where <T as FromStr>::Err: Debug
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().parse().unwrap()
    }

    #[allow(dead_code)]
    pub fn gets<T: FromStr>() -> Vec<T>
        where <T as FromStr>::Err: Debug
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|t| t.parse().unwrap())
            .collect()
    }
}

fn main() {
    let nm: Vec<usize> = util::gets();
    let n = nm[0];
    let m = nm[1];

    if m >= n {
        println!("1");
    } else if n % 2 == 0 && m >= n / 2 {
        println!("2");
    } else {
        println!("-1");
    }
}
0