Submission #30125612


Source Code Expand

use proconio::input;

fn main() {
    input! {
        n: usize,
        x: usize,
        y: usize,
    };

    let mut ds = vec![];
    for i in 1..=n {
        if i * i > y {
            break;
        }
        if y % i == 0 {
            ds.push(i);
            if i != y / i && y / i <= n {
                ds.push(y / i);
            }
        }
    }
    ds.sort();

    for i in 0..ds.len() {
        for j in i..ds.len() {
            for k in j..ds.len() {
                for l in k..ds.len() {
                    let (a, b, c, d) = (ds[i], ds[j], ds[k], ds[l]);
                    if (a + b + c + d == x) && (a * b * c * d == y) {
                        println!("Yes");
                        return;
                    }
                }
            }
        }
    }
    println!("No");
}

Submission Info

Submission Time
Task 085 - Two Conditions
User bouzuya
Language Rust (1.42.0)
Score 1000
Code Size 811 Byte
Status AC
Exec Time 7 ms
Memory 2136 KiB

Judge Result

Set Name Sample Subtask1
Score / Max Score 0 / 0 1000 / 1000
Status
AC × 2
AC × 23
Set Name Test Cases
Sample sample_01.txt, sample_02.txt
Subtask1 hand.txt, hand2.txt, hand3.txt, hand4.txt, hand5.txt, hand6.txt, max_1.txt, max_2.txt, max_3.txt, max_4.txt, max_5.txt, normal_1.txt, normal_10.txt, normal_2.txt, normal_3.txt, normal_4.txt, normal_5.txt, normal_6.txt, normal_7.txt, normal_8.txt, normal_9.txt, sample_01.txt, sample_02.txt
Case Name Status Exec Time Memory
hand.txt AC 7 ms 2004 KiB
hand2.txt AC 1 ms 2096 KiB
hand3.txt AC 2 ms 2028 KiB
hand4.txt AC 3 ms 2012 KiB
hand5.txt AC 2 ms 2004 KiB
hand6.txt AC 1 ms 1892 KiB
max_1.txt AC 2 ms 2100 KiB
max_2.txt AC 2 ms 2024 KiB
max_3.txt AC 1 ms 2060 KiB
max_4.txt AC 2 ms 2136 KiB
max_5.txt AC 2 ms 2028 KiB
normal_1.txt AC 2 ms 1968 KiB
normal_10.txt AC 3 ms 1996 KiB
normal_2.txt AC 1 ms 2036 KiB
normal_3.txt AC 2 ms 2024 KiB
normal_4.txt AC 2 ms 2040 KiB
normal_5.txt AC 1 ms 2016 KiB
normal_6.txt AC 2 ms 2096 KiB
normal_7.txt AC 2 ms 1992 KiB
normal_8.txt AC 2 ms 2104 KiB
normal_9.txt AC 2 ms 2112 KiB
sample_01.txt AC 1 ms 2008 KiB
sample_02.txt AC 1 ms 1896 KiB