Submission #62273152


Source Code Expand

#[allow(unused_imports)]
use itertools::iproduct;
use proconio::input;
use proconio::marker::Chars;

fn main() {
    input!{
        n: usize,
        m: usize,
        s: [Chars; n],
        t: [Chars; m],
    }
    'ol: for (i, j) in iproduct!(0..n, 0..n) {
        for (di, dj) in iproduct!(0..m, 0..m) {
            let ni = i+di;
            let nj = j+dj;
            if ni >= n || nj >= n {
                continue 'ol;
            }
            if s[ni][nj] != t[di][dj] {
                continue 'ol;
            }
        }
        println!("{} {}", i+1, j+1);
        break;
    }
}

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 B - Seek Grid
User ardRiriy
Language Rust (rustc 1.70.0)
Score 200
Code Size 2694 Byte
Status AC
Exec Time 1 ms
Memory 2092 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 2
AC × 26
Set Name Test Cases
Sample 00_sample_01.txt, 00_sample_02.txt
All 00_sample_01.txt, 00_sample_02.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt, 01_random_20.txt, 02_handmade_01.txt, 02_handmade_02.txt, 02_handmade_03.txt, 02_handmade_04.txt
Case Name Status Exec Time Memory
00_sample_01.txt AC 1 ms 1868 KiB
00_sample_02.txt AC 1 ms 1860 KiB
01_random_01.txt AC 0 ms 1804 KiB
01_random_02.txt AC 1 ms 1932 KiB
01_random_03.txt AC 1 ms 1864 KiB
01_random_04.txt AC 0 ms 1944 KiB
01_random_05.txt AC 1 ms 2004 KiB
01_random_06.txt AC 0 ms 2028 KiB
01_random_07.txt AC 1 ms 1980 KiB
01_random_08.txt AC 0 ms 2092 KiB
01_random_09.txt AC 1 ms 1928 KiB
01_random_10.txt AC 0 ms 2080 KiB
01_random_11.txt AC 1 ms 1872 KiB
01_random_12.txt AC 1 ms 2032 KiB
01_random_13.txt AC 0 ms 1956 KiB
01_random_14.txt AC 1 ms 2080 KiB
01_random_15.txt AC 1 ms 1904 KiB
01_random_16.txt AC 0 ms 1868 KiB
01_random_17.txt AC 0 ms 1876 KiB
01_random_18.txt AC 1 ms 1804 KiB
01_random_19.txt AC 1 ms 1880 KiB
01_random_20.txt AC 1 ms 1940 KiB
02_handmade_01.txt AC 1 ms 1784 KiB
02_handmade_02.txt AC 1 ms 1856 KiB
02_handmade_03.txt AC 1 ms 1872 KiB
02_handmade_04.txt AC 1 ms 1932 KiB