Submission #47139658


Source Code Expand

use proconio::input;

fn main() {
    input! {
        n: usize,
        xy: [(i64, i64); n],
    };

    let mut count = 0_usize;
    for i in 0..n {
        for j in i + 1..n {
            let (x_i, y_i) = xy[i];
            let (x_j, y_j) = xy[j];
            let a = (y_j - y_i) as f64 / (x_j - x_i) as f64;
            if (-1_f64..=1_f64).contains(&a) {
                count += 1;
            }
        }
    }
    let ans = count;
    println!("{}", ans);
}

Submission Info

Submission Time
Task B - Gentle Pairs
User bouzuya
Language Rust (rustc 1.70.0)
Score 200
Code Size 465 Byte
Status AC
Exec Time 2 ms
Memory 2000 KiB

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 1 ms 1936 KiB
random_02.txt AC 1 ms 1928 KiB
random_03.txt AC 0 ms 1856 KiB
random_04.txt AC 0 ms 1868 KiB
random_05.txt AC 1 ms 1900 KiB
random_06.txt AC 1 ms 1856 KiB
random_07.txt AC 0 ms 1940 KiB
random_08.txt AC 0 ms 2000 KiB
random_09.txt AC 0 ms 1964 KiB
random_10.txt AC 1 ms 1860 KiB
random_11.txt AC 2 ms 1972 KiB
random_12.txt AC 1 ms 1820 KiB
random_13.txt AC 1 ms 1920 KiB
random_14.txt AC 1 ms 1968 KiB
random_15.txt AC 1 ms 1880 KiB
random_16.txt AC 2 ms 1944 KiB
random_17.txt AC 1 ms 1956 KiB
random_18.txt AC 1 ms 1992 KiB
sample_01.txt AC 0 ms 1972 KiB
sample_02.txt AC 1 ms 1868 KiB
sample_03.txt AC 0 ms 1940 KiB