結果

問題 No.630 門松グラフ
ユーザー koba-e964koba-e964
提出日時 2021-11-14 19:26:45
言語 Rust
(1.77.0)
結果
WA  
実行時間 -
コード長 1,413 bytes
コンパイル時間 1,091 ms
コンパイル使用メモリ 143,124 KB
実行使用メモリ 4,508 KB
最終ジャッジ日時 2023-08-20 03:20:21
合計ジャッジ時間 8,782 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 1 ms
4,384 KB
testcase_06 AC 1 ms
4,384 KB
testcase_07 WA -
testcase_08 AC 0 ms
4,384 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,384 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 1 ms
4,380 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 1 ms
4,384 KB
testcase_22 AC 138 ms
4,380 KB
testcase_23 AC 1 ms
4,380 KB
testcase_24 WA -
testcase_25 AC 1 ms
4,384 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::Read;

#[allow(dead_code)]
fn getline() -> String {
    let mut ret = String::new();
    std::io::stdin().read_line(&mut ret).ok().unwrap();
    ret
}

fn get_word() -> String {
    let stdin = std::io::stdin();
    let mut stdin=stdin.lock();
    let mut u8b: [u8; 1] = [0];
    loop {
        let mut buf: Vec<u8> = Vec::with_capacity(16);
        loop {
            let res = stdin.read(&mut u8b);
            if res.unwrap_or(0) == 0 || u8b[0] <= b' ' {
                break;
            } else {
                buf.push(u8b[0]);
            }
        }
        if buf.len() >= 1 {
            let ret = String::from_utf8(buf).unwrap();
            return ret;
        }
    }
}

#[allow(dead_code)]
fn get<T: std::str::FromStr>() -> T { get_word().parse().ok().unwrap() }

fn main() {
    let n: usize = get();
    let m: usize = get();
    let nn = n as i64;
    let nn2 = nn / 2;
    if m < n - 1 || m as i64 > nn2 * (nn - nn2) {
        println!("NO");
        return;
    }
    let mut x = 1;
    while x < nn / 2 && x * (nn - x) < m as i64 {
        x += 1;
    }
    println!("YES");
    for i in 0..n {
        print!("{}{}", i + 1, if i + 1 == n { "\n" } else { " " });
    }
    let x = x as usize;
    for i in 0..m {
        println!("{} {}", i / (m - x) + 1, x + 1 + i % (m - x));
    }
}
0