結果

問題 No.161 制限ジャンケン
ユーザー karinohitokarinohito
提出日時 2021-04-19 20:08:05
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,651 bytes
コンパイル時間 1,063 ms
コンパイル使用メモリ 110,200 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-17 08:21:49
合計ジャッジ時間 1,987 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 WA -
testcase_11 AC 1 ms
4,380 KB
testcase_12 WA -
testcase_13 AC 2 ms
4,380 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

//#include <atcoder/all>
#include <iostream>
#include <numeric>
#include <cmath>
#include <limits>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
//using namespace atcoder;
using ll = long long;
#define all(A) A.begin(),A.end()
using vll = vector<ll>;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
using Graph = vector<vector<ll>>;

vector<priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>>> edge;
vector<bool> seen;
vll AN;
ll p = 1;
ll N;
void dfs(const Graph & G, int v) {
	seen[v] = true; // v を訪問済にする
	AN[v] = p;
	// v から行ける各頂点 next_v について
	while (!edge[v].empty()) {
		ll next_v = edge[v].top().second;
		edge[v].pop();
		if (seen[next_v]) continue; // next_v が探索済だったらスルー
		p++;
		dfs(G, next_v); // 再帰的に探索
		p++;
	}

}
vll kB;
ll j = 0;
ll tt = 0;
void predfs(const Graph& G, int v) {
	tt++;
	seen[v] = true; // v を訪問済にする
	AN[v] = p;
	ll now = tt;
	j++;
	
	// v から行ける各頂点 next_v について
	ll pe = 0;
	for (auto next_v : G[v]) {
		pe++;
		if (seen[next_v]) continue; // next_v が探索済だったらスルー
		/*if (pe == G[v].size()) {
			edge[v].push(make_pair(N-now, next_v));
		}*/
		
		ll M = j;
		predfs(G, next_v); // 再帰的に探索
		
		edge[v].push(make_pair(j - M, next_v));
	}

}
int main() {
	ll G, C, P;
	cin >> G >> C >> P;
	string S;
	cin >> S;
	ll an = 0;
	N = G + C + P;
	rep(i, N) {
		if (S[i] == 'G') {
			if (P > 0) {
				P--;
				an += 3;
				S[i] = '*';
			}
		}
		else if (S[i] == 'P') {
			if (C > 0) {
				C--;
				an += 3;
				S[i] = '*';
			}
		}
		else if (S[i] == 'C') {
			if (G > 0) {
				G--;
				an += 3;
				S[i] = '*';
			}
		}

	}
	rep(i, N) {
		if (S[i] == 'G') {
			if (G > 0) {
				G--;
				an += 1;
				S[i] = '*';
			}
		}
		else if (S[i] == 'P') {
			if (P > 0) {
				P--;
				an += 1;
				S[i] = '*';
			}
		}
		else if (S[i] == 'C') {
			if (C > 0) {
				C--;
				an += 3;
				S[i] = '*';
			}
		}

	}
	cout << an << endl;
}
0