Submission #62508003


Source Code Expand

#[allow(unused_imports)]
use itertools::Itertools;
use proconio::input;

fn main() {
    let n = 3;
    input!{
        a: [i32; n],
    }
    println!("{}", if
    a.iter()
        .copied()
        .permutations(n).any(|v| v[0]*v[1]==v[2]) {
        "Yes"
    } else {
        "No"
    });
}
pub trait Debuggable {
    fn debug_string(&self) -> String;
}

impl<T: std::fmt::Debug + std::fmt::Display> Debuggable for Vec<T> {
    fn debug_string(&self) -> String {
        use itertools::Itertools;
        use std::iter::repeat;
        if let Some(max_size) = self.iter()
            .enumerate()
            .map(|(i, x)| (format!("{:?}", x).len()).max(format!("{:?}", i).len()))
            .max() {
                let mut idx = String::from("idx |");   
                let mut val = String::from("val |");   
                for (i, xi) in self.iter().enumerate() {
                    idx.push_str(
                        &format!(" {:>w$} |", i, w=max_size)
                    );
                    val.push_str(
                        &format!(" {:>w$} |", xi, w=max_size)
                    );
                }

                format!("{}\n{}\n{}\n", idx, repeat('-').take(idx.len()).join(""), val)
            } else {
                format!("idx | \nval |\n")
            }
    }
}

impl<T: std::fmt::Debug + std::fmt::Display> Debuggable for std::collections::BTreeSet<T> {
    fn debug_string(&self) -> String {
        use itertools::Itertools;
        format!("{{ {} }}", self.iter().join(", "))
    }
}

impl<T, U> Debuggable for std::collections::BTreeMap<T, U> 
where T: std::fmt::Debug + std::fmt::Display, U: std::fmt::Debug + std::fmt::Display
{
    fn debug_string(&self) -> String {
        use itertools::Itertools;
        format!(
            "{{\n{}\n }}", self.iter()
                .map(|(k, v)| format!("{k} -> {v}, "))
                .join("\n")
        )
    }
}

// lg! マクロの定義
#[macro_export]
macro_rules! lg {
    ($val:expr) => {
        #[cfg(feature = "local")]
        {
            {
                use Debuggable;
                let val = &$val;
                eprintln!(
                    "[{}:{}] {} = \n{}",
                    file!(),
                    line!(),
                    stringify!($val),
                    val.debug_string()
                );
                val
            }
        }
    }
}
    

Submission Info

Submission Time
Task A - Shuffled Equation
User ardRiriy
Language Rust (rustc 1.70.0)
Score 100
Code Size 2391 Byte
Status AC
Exec Time 1 ms
Memory 2084 KiB

Compile Error

warning: the item `Itertools` is imported redundantly
  --> src/main.rs:25:13
   |
2  | use itertools::Itertools;
   |     -------------------- the item `Itertools` is already imported here
...
25 |         use itertools::Itertools;
   |             ^^^^^^^^^^^^^^^^^^^^
   |
   = note: `#[warn(unused_imports)]` on by default

warning: the item `Itertools` is imported redundantly
  --> src/main.rs:51:13
   |
2  | use itertools::Itertools;
   |     -------------------- the item `Itertools` is already imported here
...
51 |         use itertools::Itertools;
   |             ^^^^^^^^^^^^^^^^^^^^

warning: the item `Itertools` is imported redundantly
  --> src/main.rs:60:13
   |
2  | use itertools::Itertools;
   |     -------------------- the item `Itertools` is already imported here
...
60 |         use itertools::Itertools;
   |             ^^^^^^^^^^^^^^^^^^^^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
AC × 3
AC × 25
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All sample_01.txt, sample_02.txt, sample_03.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, test_21.txt, test_22.txt
Case Name Status Exec Time Memory
sample_01.txt AC 0 ms 1944 KiB
sample_02.txt AC 0 ms 1860 KiB
sample_03.txt AC 0 ms 1928 KiB
test_01.txt AC 0 ms 2068 KiB
test_02.txt AC 1 ms 2052 KiB
test_03.txt AC 0 ms 1936 KiB
test_04.txt AC 0 ms 1948 KiB
test_05.txt AC 0 ms 1952 KiB
test_06.txt AC 0 ms 1852 KiB
test_07.txt AC 0 ms 1924 KiB
test_08.txt AC 0 ms 1908 KiB
test_09.txt AC 0 ms 2000 KiB
test_10.txt AC 0 ms 1920 KiB
test_11.txt AC 0 ms 1868 KiB
test_12.txt AC 0 ms 1860 KiB
test_13.txt AC 0 ms 1880 KiB
test_14.txt AC 0 ms 2072 KiB
test_15.txt AC 0 ms 1804 KiB
test_16.txt AC 0 ms 1868 KiB
test_17.txt AC 0 ms 1860 KiB
test_18.txt AC 0 ms 2080 KiB
test_19.txt AC 0 ms 1920 KiB
test_20.txt AC 0 ms 1972 KiB
test_21.txt AC 0 ms 2084 KiB
test_22.txt AC 0 ms 1968 KiB