Submission #19442785


Source Code Expand

Copy
use proconio::input;

fn main() {
    input! {
        p: [(i32, i32)],
    }
    let mut ans = 0;
    // p.len() はベクタ p の要素数
    for j in 0..p.len() {
        for i in 0..j {
            // 点 i と点 j が条件を満たすか調べる
            let (dx, dy) = {
                let (x1, y1) = p[i];
                let (x2, y2) = p[j];
                ((x1 - x2).abs(), (y1 - y2).abs())
            };
            // dx は 2 点の x 座標の差の絶対値
            // dy は 2 点の y 座標の差の絶対値
            if dx >= dy {
                ans += 1;
            }
        }
    }
    println!("{}", ans);
}

Submission Info

Submission Time
Task B - Gentle Pairs
User toga57
Language Rust (1.42.0)
Score 200
Code Size 675 Byte
Status AC
Exec Time 8 ms
Memory 2192 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 21
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
random_01.txt AC 6 ms 1972 KB
random_02.txt AC 3 ms 2096 KB
random_03.txt AC 2 ms 2036 KB
random_04.txt AC 3 ms 2036 KB
random_05.txt AC 2 ms 1968 KB
random_06.txt AC 1 ms 1892 KB
random_07.txt AC 1 ms 1896 KB
random_08.txt AC 2 ms 1976 KB
random_09.txt AC 1 ms 1972 KB
random_10.txt AC 2 ms 2092 KB
random_11.txt AC 6 ms 1988 KB
random_12.txt AC 6 ms 1996 KB
random_13.txt AC 8 ms 2056 KB
random_14.txt AC 7 ms 1988 KB
random_15.txt AC 3 ms 2052 KB
random_16.txt AC 8 ms 2192 KB
random_17.txt AC 7 ms 2104 KB
random_18.txt AC 3 ms 2064 KB
sample_01.txt AC 2 ms 2108 KB
sample_02.txt AC 1 ms 2096 KB
sample_03.txt AC 1 ms 1900 KB