結果

問題 No.3012 岩井星人グラフ
ユーザー sampleuser
提出日時 2025-01-25 17:07:10
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 313 ms / 2,000 ms
コード長 872 bytes
コンパイル時間 18,040 ms
コンパイル使用メモリ 377,292 KB
実行使用メモリ 5,888 KB
最終ジャッジ日時 2025-01-25 23:57:23
合計ジャッジ時間 26,165 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#[rustfmt::skip]
pub mod lib {
    // pub use ac_library::*;
    // pub use itertools::{Combinations, Itertools, MultiProduct, Permutations};
    pub use proconio::{input,marker::{Chars, Usize1}};
    // pub use std::{cmp::*, collections::*, mem::swap};
    // pub use regex::Regex;
    // pub use superslice::Ext;
}

pub use lib::*;

fn main() {
    input! {
        x: usize,
        y: usize
    }
    let naka = (0..x).collect::<Vec<usize>>();
    let mut ans = vec![];
    for i in 0..naka.len() {
        ans.push((i, (i + 1) % naka.len()));
    }
    let mut nn = naka.len();
    for &num in naka.iter() {
        let mut pre = num;
        for _ in 0..y - 1 {
            ans.push((pre, nn));
            pre = nn;
            nn += 1;
        }
    }
    println!("{} {}", nn, nn);
    for &(x, y) in ans.iter() {
        println!("{} {}", x + 1, y + 1);
    }
}
0