結果

問題 No.785 色食い虫
ユーザー Manuel1024Manuel1024
提出日時 2021-03-21 02:14:26
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 19 ms / 2,000 ms
コード長 1,431 bytes
コンパイル時間 561 ms
コンパイル使用メモリ 70,300 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-13 22:10:23
合計ジャッジ時間 2,592 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 16 ms
4,376 KB
testcase_04 AC 4 ms
4,376 KB
testcase_05 AC 6 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 15 ms
4,376 KB
testcase_08 AC 15 ms
4,376 KB
testcase_09 AC 6 ms
4,376 KB
testcase_10 AC 6 ms
4,376 KB
testcase_11 AC 3 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 3 ms
4,380 KB
testcase_15 AC 4 ms
4,376 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 4 ms
4,376 KB
testcase_18 AC 5 ms
4,376 KB
testcase_19 AC 4 ms
4,376 KB
testcase_20 AC 4 ms
4,376 KB
testcase_21 AC 3 ms
4,380 KB
testcase_22 AC 3 ms
4,376 KB
testcase_23 AC 5 ms
4,376 KB
testcase_24 AC 8 ms
4,376 KB
testcase_25 AC 1 ms
4,376 KB
testcase_26 AC 2 ms
4,376 KB
testcase_27 AC 3 ms
4,376 KB
testcase_28 AC 2 ms
4,380 KB
testcase_29 AC 6 ms
4,376 KB
testcase_30 AC 19 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
using namespace std;

int main(){
    string r, g, b;
    cin >> r >> g >> b;
    vector<bool> isexist_r(16, true), isexist_g(16, true), isexist_b(16, true);
    auto myctoi = [](char ch){
        if('0' <= ch && ch <= '9') return ch-'0';
        else return ch-'A'+10;
    };
    if(r != "NONE"){
        for(int i = 0; i < r.length(); i += 2){
            isexist_r[myctoi(r[i])] = false;
        }
    }
    if(g != "NONE"){
        for(int i = 0; i < g.length(); i += 2){
            isexist_g[myctoi(g[i])] = false;
        }
    }
    if(b != "NONE"){
        for(int i = 0; i < b.length(); i += 2){
            isexist_b[myctoi(b[i])] = false;
        }
    }

    int ans = 0;
    for(int r1 = 0; r1 < 16; r1++){
        if(!isexist_r[r1]) continue;
        for(int r0 = 0; r0 < 16; r0++){
            if(!isexist_r[r0]) continue;
            for(int g1 = 0; g1 < 16; g1++){
                if(!isexist_g[g1]) continue;
                for(int g0 = 0; g0 < 16; g0++){
                    if(!isexist_g[g0]) continue;
                    for(int b1 = 0; b1 < 16; b1++){
                        if(!isexist_b[b1]) continue;
                        for(int b0 = 0; b0 < 16; b0++){
                            if(isexist_b[b0]) ans++;
                        }
                    }
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}
0