結果

問題 No.3171 Color Restoration
ユーザー atcoder8
提出日時 2025-06-06 21:56:54
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 874 bytes
コンパイル時間 14,767 ms
コンパイル使用メモリ 402,524 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-06-06 21:57:16
合計ジャッジ時間 16,595 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

use proconio::input;

fn main() {
    input! {
        mut ss: [String; 3],
    }

    ss.sort_unstable();

    let colors_by_contest: [Vec<&'static str>; 3] = [
        vec![
            "gray", "brown", "green", "cyan", "blue", "yellow", "orange", "red",
        ],
        vec!["gray", "green", "blue", "yellow", "red"],
        vec!["gray", "green", "cyan", "blue", "violet", "orange", "red"],
    ];

    let mut cnt = 0_usize;
    for color1 in &colors_by_contest[0] {
        for color2 in &colors_by_contest[1] {
            for color3 in &colors_by_contest[2] {
                let mut colors = [color1, color2, color3].map(|color| color.to_string());
                colors.sort_unstable();
                if colors == *ss {
                    cnt += 1;
                }
            }
        }
    }

    println!("{}", if cnt == 1 { "Yes" } else { "No" });
}
0