Submission #61148555


Source Code Expand

#![allow(dead_code)]
use proconio::input;

trait Bound<T> {
    fn lower_bound(&self, x: &T) -> usize;
    fn upper_bound(&self, x: &T) -> usize;
}

impl<T: PartialOrd> Bound<T> for [T] {
    fn lower_bound(&self, x: &T) -> usize {
        let (mut low, mut high) = (0, self.len());
        while low + 1 < high {
            let mid = (low + high) / 2;
            if self[mid] < *x {
                low = mid;
            } else {
                high = mid;
            }
        }
        if self[low] < *x {
            low + 1
        } else {
            low
        }
    }

    fn upper_bound(&self, x: &T) -> usize {
        let (mut low, mut high) = (0, self.len());
        while low + 1 < high {
            let mid = (low + high) / 2;
            if self[mid] <= *x {
                low = mid;
            } else {
                high = mid;
            }
        }
        if self[low] <= *x {
            low + 1
        } else {
            low
        }
    }
}

fn main() {
    input! {a:i32,b:i32,c:i32,d:i32}
    let mut arr = [a, b, c, d];
    arr.sort();

    let have_three =
        (arr[0] == arr[1] && arr[1] == arr[2]) || (arr[1] == arr[2] && arr[2] == arr[3]);

    let have_double_two = (arr[0] == arr[1]) && arr[2] == arr[3];

    let all_same = arr[0] == arr[1] && arr[1] == arr[2] && arr[2] == arr[3];

    if !all_same && (have_three || have_double_two) {
        println!("Yes")
    } else {
        println!("No")
    }
}

Submission Info

Submission Time
Task A - Full House 2
User tsu7magu6
Language Rust (rustc 1.70.0)
Score 100
Code Size 1523 Byte
Status AC
Exec Time 0 ms
Memory 2084 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
AC × 5
AC × 25
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt, sample_05.txt
All sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt, sample_05.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt
Case Name Status Exec Time Memory
sample_01.txt AC 0 ms 1892 KiB
sample_02.txt AC 0 ms 2084 KiB
sample_03.txt AC 0 ms 1960 KiB
sample_04.txt AC 0 ms 1940 KiB
sample_05.txt AC 0 ms 2060 KiB
test_01.txt AC 0 ms 2008 KiB
test_02.txt AC 0 ms 2004 KiB
test_03.txt AC 0 ms 1896 KiB
test_04.txt AC 0 ms 2080 KiB
test_05.txt AC 0 ms 1896 KiB
test_06.txt AC 0 ms 1912 KiB
test_07.txt AC 0 ms 1920 KiB
test_08.txt AC 0 ms 1872 KiB
test_09.txt AC 0 ms 1864 KiB
test_10.txt AC 0 ms 1964 KiB
test_11.txt AC 0 ms 1896 KiB
test_12.txt AC 0 ms 1856 KiB
test_13.txt AC 0 ms 1864 KiB
test_14.txt AC 0 ms 1856 KiB
test_15.txt AC 0 ms 1992 KiB
test_16.txt AC 0 ms 1960 KiB
test_17.txt AC 0 ms 1868 KiB
test_18.txt AC 0 ms 2084 KiB
test_19.txt AC 0 ms 2056 KiB
test_20.txt AC 0 ms 1928 KiB