Submission #16652539


Source Code Expand

use proconio::input;
use proconio::marker::Chars;

fn main() {
    input! {
        _: usize,
        _: usize,
        name: Chars,
        kit: Chars,
    };
    let mut required_map = std::collections::BTreeMap::new();
    for &block in name.iter() {
        *required_map.entry(block).or_insert(0) += 1;
    }
    let mut unit_map = std::collections::BTreeMap::new();
    for &block in kit.iter() {
        *unit_map.entry(block).or_insert(0) += 1;
    }
    let mut max_count = 0;
    for (block, required_count) in required_map.iter() {
        match unit_map.get(&block) {
            None => {
                println!("-1");
                return;
            }
            Some(count) => {
                max_count = std::cmp::max(max_count, (required_count + count - 1) / count);
            }
        }
    }
    let ans = max_count;
    println!("{}", ans);
}

Submission Info

Submission Time
Task B - 謎のたこ焼きおじさん
User bouzuya
Language Rust (1.42.0)
Score 100
Code Size 875 Byte
Status AC
Exec Time 7 ms
Memory 2172 KiB

Judge Result

Set Name All
Score / Max Score 100 / 100
Status
AC × 68
Set Name Test Cases
All 00_min_01.txt, 00_min_02.txt, 00_retmax.txt, 00_retmin.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 00_sample_04.txt, 01_rand_00.txt, 01_rand_01.txt, 01_rand_02.txt, 01_rand_03.txt, 01_rand_04.txt, 01_rand_05.txt, 01_rand_06.txt, 01_rand_07.txt, 01_rand_08.txt, 01_rand_09.txt, 02_maxrand_00.txt, 02_maxrand_01.txt, 02_maxrand_02.txt, 02_maxrand_03.txt, 02_maxrand_04.txt, 02_maxrand_05.txt, 02_maxrand_06.txt, 02_maxrand_07.txt, 02_maxrand_08.txt, 02_maxrand_09.txt, 03_lowtyperand_00.txt, 03_lowtyperand_01.txt, 03_lowtyperand_02.txt, 03_lowtyperand_03.txt, 03_lowtyperand_04.txt, 03_lowtyperand_05.txt, 03_lowtyperand_06.txt, 03_lowtyperand_07.txt, 03_lowtyperand_08.txt, 03_lowtyperand_09.txt, 03_lowtyperand_10.txt, 03_lowtyperand_11.txt, 03_lowtyperand_12.txt, 03_lowtyperand_13.txt, 03_lowtyperand_14.txt, 03_lowtyperand_15.txt, 03_lowtyperand_16.txt, 03_lowtyperand_17.txt, 03_lowtyperand_18.txt, 03_lowtyperand_19.txt, 04_lowtypemaxrand_00.txt, 04_lowtypemaxrand_01.txt, 04_lowtypemaxrand_02.txt, 04_lowtypemaxrand_03.txt, 04_lowtypemaxrand_04.txt, 04_lowtypemaxrand_05.txt, 04_lowtypemaxrand_06.txt, 04_lowtypemaxrand_07.txt, 04_lowtypemaxrand_08.txt, 04_lowtypemaxrand_09.txt, 04_lowtypemaxrand_10.txt, 04_lowtypemaxrand_11.txt, 04_lowtypemaxrand_12.txt, 04_lowtypemaxrand_13.txt, 04_lowtypemaxrand_14.txt, 04_lowtypemaxrand_15.txt, 04_lowtypemaxrand_16.txt, 04_lowtypemaxrand_17.txt, 04_lowtypemaxrand_18.txt, 04_lowtypemaxrand_19.txt
Case Name Status Exec Time Memory
00_min_01.txt AC 7 ms 2104 KiB
00_min_02.txt AC 1 ms 2048 KiB
00_retmax.txt AC 2 ms 2048 KiB
00_retmin.txt AC 3 ms 2040 KiB
00_sample_01.txt AC 1 ms 1992 KiB
00_sample_02.txt AC 2 ms 2140 KiB
00_sample_03.txt AC 1 ms 1996 KiB
00_sample_04.txt AC 2 ms 1996 KiB
01_rand_00.txt AC 2 ms 2080 KiB
01_rand_01.txt AC 1 ms 2124 KiB
01_rand_02.txt AC 1 ms 2060 KiB
01_rand_03.txt AC 1 ms 2164 KiB
01_rand_04.txt AC 1 ms 2168 KiB
01_rand_05.txt AC 1 ms 2068 KiB
01_rand_06.txt AC 1 ms 2064 KiB
01_rand_07.txt AC 1 ms 1972 KiB
01_rand_08.txt AC 1 ms 2108 KiB
01_rand_09.txt AC 2 ms 2112 KiB
02_maxrand_00.txt AC 2 ms 2072 KiB
02_maxrand_01.txt AC 1 ms 2144 KiB
02_maxrand_02.txt AC 2 ms 2040 KiB
02_maxrand_03.txt AC 1 ms 2136 KiB
02_maxrand_04.txt AC 1 ms 2064 KiB
02_maxrand_05.txt AC 2 ms 2172 KiB
02_maxrand_06.txt AC 2 ms 2084 KiB
02_maxrand_07.txt AC 1 ms 2120 KiB
02_maxrand_08.txt AC 2 ms 2116 KiB
02_maxrand_09.txt AC 2 ms 2096 KiB
03_lowtyperand_00.txt AC 4 ms 2088 KiB
03_lowtyperand_01.txt AC 2 ms 2044 KiB
03_lowtyperand_02.txt AC 1 ms 2056 KiB
03_lowtyperand_03.txt AC 1 ms 2056 KiB
03_lowtyperand_04.txt AC 2 ms 2072 KiB
03_lowtyperand_05.txt AC 3 ms 1988 KiB
03_lowtyperand_06.txt AC 1 ms 2112 KiB
03_lowtyperand_07.txt AC 1 ms 2128 KiB
03_lowtyperand_08.txt AC 1 ms 2080 KiB
03_lowtyperand_09.txt AC 1 ms 1976 KiB
03_lowtyperand_10.txt AC 1 ms 2036 KiB
03_lowtyperand_11.txt AC 1 ms 1948 KiB
03_lowtyperand_12.txt AC 3 ms 2060 KiB
03_lowtyperand_13.txt AC 1 ms 2128 KiB
03_lowtyperand_14.txt AC 1 ms 1956 KiB
03_lowtyperand_15.txt AC 3 ms 2168 KiB
03_lowtyperand_16.txt AC 2 ms 1968 KiB
03_lowtyperand_17.txt AC 2 ms 2020 KiB
03_lowtyperand_18.txt AC 2 ms 2024 KiB
03_lowtyperand_19.txt AC 1 ms 1956 KiB
04_lowtypemaxrand_00.txt AC 1 ms 2064 KiB
04_lowtypemaxrand_01.txt AC 1 ms 2032 KiB
04_lowtypemaxrand_02.txt AC 1 ms 2080 KiB
04_lowtypemaxrand_03.txt AC 2 ms 2116 KiB
04_lowtypemaxrand_04.txt AC 1 ms 2108 KiB
04_lowtypemaxrand_05.txt AC 1 ms 1992 KiB
04_lowtypemaxrand_06.txt AC 2 ms 2096 KiB
04_lowtypemaxrand_07.txt AC 2 ms 2116 KiB
04_lowtypemaxrand_08.txt AC 2 ms 1948 KiB
04_lowtypemaxrand_09.txt AC 1 ms 2088 KiB
04_lowtypemaxrand_10.txt AC 1 ms 2064 KiB
04_lowtypemaxrand_11.txt AC 2 ms 2044 KiB
04_lowtypemaxrand_12.txt AC 1 ms 2064 KiB
04_lowtypemaxrand_13.txt AC 1 ms 2032 KiB
04_lowtypemaxrand_14.txt AC 2 ms 2104 KiB
04_lowtypemaxrand_15.txt AC 1 ms 2084 KiB
04_lowtypemaxrand_16.txt AC 2 ms 2096 KiB
04_lowtypemaxrand_17.txt AC 2 ms 2132 KiB
04_lowtypemaxrand_18.txt AC 3 ms 2048 KiB
04_lowtypemaxrand_19.txt AC 1 ms 1980 KiB