結果

問題 No.3171 Color Restoration
コンテスト
ユーザー atcoder8
提出日時 2025-06-06 21:56:54
言語 Rust
(1.94.0 + proconio + num + itertools)
コンパイル:
/usr/bin/rustc_custom
実行:
./target/release/main
結果
AC  
実行時間 0 ms / 2,000 ms
+ 666µs
コード長 874 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 791 ms
コンパイル使用メモリ 188,448 KB
実行使用メモリ 5,888 KB
最終ジャッジ日時 2026-07-11 06:18:04
合計ジャッジ時間 2,426 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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