結果

問題 No.2997 Making YuzuKizu
コンテスト
ユーザー kyotoku1483
提出日時 2025-03-16 21:50:40
言語 Rust
(1.99.1 + proconio + num + itertools + ACL)
コンパイル:
/usr/bin/rustc_custom
実行:
./target/release/main
結果
AC  
実行時間 13 ms / 2,000 ms
+ 491µs
コード長 1,259 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 4,413 ms
コンパイル使用メモリ 196,180 KB
実行使用メモリ 9,872 KB
最終ジャッジ日時 2026-10-24 22:42:46
合計ジャッジ時間 3,660 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge4_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 18
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: use of deprecated constant `std::i32::MAX`: replaced by the `MAX` associated constant on this type
  --> src/main.rs:16:27
   |
16 |     let mut y = std::i32::MAX;
   |                           ^^^
   |
   = note: `#[warn(deprecated)]` on by default

warning: use of deprecated constant `std::i32::MAX`: replaced by the `MAX` associated constant on this type
  --> src/main.rs:25:27
   |
25 |     let mut a = std::i32::MAX;
   |                           ^^^

warning: use of deprecated constant `std::i32::MAX`: replaced by the `MAX` associated constant on this type
  --> src/main.rs:34:27
   |
34 |     let mut x = std::i32::MAX;
   |                           ^^^

ソースコード

diff #
raw source code

#[allow(unused)]
use proconio::{input, marker::Chars};
use std::collections::HashMap;

fn main() {
    input! {
        s: String,
    }
    let mut counter = HashMap::<char, i32>::new();
    for c in s.chars() {
        *counter.entry(c).or_default() += 1;
    }
    let yukari = HashMap::from([('y', 1), ('u', 1), ('k', 1), ('a', 1), ('r', 1), ('i', 1)]);
    let akari = HashMap::from([('a', 2), ('k', 1), ('r', 1), ('i', 1)]);
    let yuzukizu = HashMap::from([('y', 1), ('u', 3), ('z', 2), ('k', 1), ('i', 1)]);
    let mut y = std::i32::MAX;
    for (k, &v) in yukari.iter() {
        if !counter.contains_key(&k) || counter[&k] < v {
            y = 0;
            break;
        } else {
            y = y.min(counter[&k] / v);
        }
    }
    let mut a = std::i32::MAX;
    for (k, &v) in akari.iter() {
        if !counter.contains_key(&k) || counter[&k] < v {
            a = 0;
            break;
        } else {
            a = a.min(counter[&k] / v);
        }
    }
    let mut x = std::i32::MAX;
    for (k, &v) in yuzukizu.iter() {
        if !counter.contains_key(&k) || counter[&k] < v {
            x = 0;
            break;
        } else {
            x = x.min(counter[&k] / v);
        }
    }
    println!("{} {} {}", y, a, x)
}
0