結果

問題 No.3260 岩井スターグラフ
ユーザー sampleuser
提出日時 2025-09-06 20:43:15
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 371 ms / 2,000 ms
コード長 1,234 bytes
コンパイル時間 23,353 ms
コンパイル使用メモリ 388,052 KB
実行使用メモリ 10,008 KB
最終ジャッジ日時 2025-09-06 20:43:50
合計ジャッジ時間 25,165 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 36
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: unused imports: `HashMap` and `HashSet`
 --> src/main.rs:6:24
  |
6 | use std::collections::{HashMap, HashSet};
  |                        ^^^^^^^  ^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: unused import: `marker::Usize1`
 --> src/main.rs:8:23
  |
8 | use proconio::{input, marker::Usize1};
  |                       ^^^^^^^^^^^^^^

warning: unused variable: `x`
  --> src/main.rs:14:9
   |
14 |         x: usize,
   |         ^ help: if this is intentional, prefix it with an underscore: `_x`
   |
   = note: `#[warn(unused_variables)]` on by default

ソースコード

diff #

// #[rustfmt::skip]
// pub mod lib {pub use ac_library::*;pub use itertools::{join, 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 num_traits::{One, ToPrimitive, FromPrimitive, PrimInt};#[macro_export]macro_rules! degg {($($val:expr),+ $(,)?) => {println!("[{}:{}] {}",file!(),line!(),{let mut parts = Vec::new();$(parts.push(format!("{} = {:?}", stringify!($val), &$val));)+parts.join(", ")})}}}

// use lib::*;

use std::collections::{HashMap, HashSet};

use proconio::{input, marker::Usize1};



fn main() {
    input! {
        x: usize,
        y: usize,
        n: usize,
        uv: [(usize, usize); n]
    }
    
    for &(u, v) in uv.iter() {
        if u == 0 {
            let v = (v - 1) % y + 1;
            println!("{}", v);
            continue;
        }
        let uu = (u - 1) / y;
        let vv = (v - 1) / y;
        
        if uu == vv {
            let ans = u.abs_diff(v);
            println!("{}", ans);
            continue;
        }

        let uu = (u - 1)  % y + 1;
        let vv = (v - 1) % y + 1;
        println!("{}", uu + vv);
    }
}
0