結果
問題 | No.785 色食い虫 |
ユーザー |
![]() |
提出日時 | 2021-03-21 02:14:26 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 19 ms / 2,000 ms |
コード長 | 1,431 bytes |
コンパイル時間 | 585 ms |
コンパイル使用メモリ | 71,388 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-21 16:13:15 |
合計ジャッジ時間 | 1,793 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 |
ソースコード
#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; }