結果

問題 No.785 色食い虫
ユーザー mmn15277198mmn15277198
提出日時 2020-07-11 18:00:57
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 1,703 bytes
コンパイル時間 1,332 ms
コンパイル使用メモリ 102,444 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-21 08:40:59
合計ジャッジ時間 2,523 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#pragma GCC optimize("Ofast")
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<map>
#include<iomanip>
#include<queue>

const long long INFL = 1e17+7;
const long long INFI = 1e9+7;
const long long MOD = 1e9+7;
const double EPS = 1e-8;
const double PI=acos(-1);

using namespace std;


int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	string r,g,b;
	cin >> r >> g >> b;
	vector<int> R(16,0),G(16,0),B(16,0);
	
	for(int i=0;i<r.size();i++){
		if('0'<=r[i] && r[i]<='9'){
			R[(int)(r[i]-'0')]=1;
		}else if('A'<=r[i] && r[i]<='F'){
			if(r[i]=='A')R[10]=1;
			if(r[i]=='B')R[11]=1;
			if(r[i]=='C')R[12]=1;
			if(r[i]=='D')R[13]=1;
			if(r[i]=='E')R[14]=1;
			if(r[i]=='F')R[15]=1;
		}
	}
	
	for(int i=0;i<g.size();i++){
		if('0'<=g[i] && g[i]<='9'){
			G[(int)(g[i]-'0')]=1;
		}else if('A'<=g[i] && g[i]<='F'){
			if(g[i]=='A')G[10]=1;
			if(g[i]=='B')G[11]=1;
			if(g[i]=='C')G[12]=1;
			if(g[i]=='D')G[13]=1;
			if(g[i]=='E')G[14]=1;
			if(g[i]=='F')G[15]=1;
		}
	}		
	
	for(int i=0;i<b.size();i++){
		if('0'<=b[i] && b[i]<='9'){
			B[(int)(b[i]-'0')]=1;
		}else if('A'<=b[i] && b[i]<='F'){
			if(b[i]=='A')B[10]=1;
			if(b[i]=='B')B[11]=1;
			if(b[i]=='C')B[12]=1;
			if(b[i]=='D')B[13]=1;
			if(b[i]=='E')B[14]=1;
			if(b[i]=='F')B[15]=1;
		}
	}
	
	int cnt_r=0;
	for(int i=0;i<R.size();i++){
		if(R[i]==0)cnt_r++;
	}
	if(r=="NONE")cnt_r=16;
	
	int cnt_g=0;
	for(int i=0;i<G.size();i++){
		if(G[i]==0)cnt_g++;
	}
	if(g=="NONE")cnt_g=16;
	
	int cnt_b=0;
	for(int i=0;i<B.size();i++){
		if(B[i]==0)cnt_b++;
	}
	if(b=="NONE")cnt_b=16;
	
	long long ans=cnt_r*cnt_r*cnt_g*cnt_g*cnt_b*cnt_b;
	cout << ans << endl;
	
	return 0;
}
0