Submission #37963285


Source Code Expand

Copy
use proconio::input;
fn main() {
input! {
n: usize,
m: usize,
ab: [(i64, i64); n],
cd: [(i64, i64); m],
};
let mut ans = vec![m; n];
for (i, (a, b)) in ab.iter().copied().enumerate() {
let mut min = 1_i64 << 60;
for (j, (c, d)) in cd.iter().copied().enumerate() {
let dist = (a - c).abs() + (b - d).abs();
if dist < min {
min = dist;
ans[i] = j;
}
}
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
use proconio::input;

fn main() {
    input! {
        n: usize,
        m: usize,
        ab: [(i64, i64); n],
        cd: [(i64, i64); m],
    };
    let mut ans = vec![m; n];
    for (i, (a, b)) in ab.iter().copied().enumerate() {
        let mut min = 1_i64 << 60;
        for (j, (c, d)) in cd.iter().copied().enumerate() {
            let dist = (a - c).abs() + (b - d).abs();
            if dist < min {
                min = dist;
                ans[i] = j;
            }
        }
    }

    for a in ans {
        println!("{}", a + 1);
    }
}

Submission Info

Submission Time
Task B - Checkpoints
User bouzuya
Language Rust (1.42.0)
Score 200
Code Size 556 Byte
Status AC
Exec Time 7 ms
Memory 2200 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 10
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All sample_01.txt, sample_02.txt, sample_03.txt, subtask_1_1.txt, subtask_1_2.txt, subtask_1_3.txt, subtask_1_4.txt, subtask_1_5.txt, subtask_1_6.txt, subtask_1_7.txt
Case Name Status Exec Time Memory
sample_01.txt AC 7 ms 2092 KB
sample_02.txt AC 2 ms 2084 KB
sample_03.txt AC 1 ms 2048 KB
subtask_1_1.txt AC 2 ms 2064 KB
subtask_1_2.txt AC 2 ms 2200 KB
subtask_1_3.txt AC 2 ms 2136 KB
subtask_1_4.txt AC 2 ms 2084 KB
subtask_1_5.txt AC 2 ms 2088 KB
subtask_1_6.txt AC 1 ms 2088 KB
subtask_1_7.txt AC 2 ms 2172 KB


2025-04-08 (Tue)
19:01:24 +00:00