結果

問題 No.2623 Room Allocation
ユーザー nwonwo
提出日時 2024-02-09 21:48:37
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 969 bytes
コンパイル時間 5,196 ms
コンパイル使用メモリ 317,524 KB
実行使用メモリ 26,764 KB
最終ジャッジ日時 2024-02-09 21:48:46
合計ジャッジ時間 8,452 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#include<atcoder/all>
using namespace atcoder;
#define rep(i,n) for (int i = 0; i < (n); ++i)
using ld = long double;
using ll = long long;

template<class T> bool chmax(T &a, T b)
{
	if(a<b)
	{
	a = b;
	return true;
	}
	return false;
}
template<class T> bool chmin(T &a, T b)
{
	if(a>b)
	{
		a = b;
		return true;
	}
	return false;
}

using P = pair<int,int>;

int main()
{
	int N, X, Y;
	cin >> N >> X >> Y;
	vector<pair<int,int>> A(N);
	rep(i,N)
	{
		cin >> A[i].first;
		char c;
		cin >> c;
		if(c=='A') A[i].second++;
	}

	int sz = min(X+Y,N);
	vector<vector<int>> B(sz, vector<int>(2));
	rep(i,N)
	{
		B[i%sz][A[i].second] += A[i].first;
	}
	vector<vector<int>> C(sz, vector<int>(2));
	rep(i,sz)
	{
		C[i][0] = B[i][1]-B[i][0];
		C[i][1] = i;
	}
	sort(C.begin(), C.end());
	reverse(C.begin(), C.end());
	ll ans = 0;
	rep(i,sz)
	{
		if(i<X) ans += B[C[i][1]][1];
		else ans += B[C[i][1]][0];
	}
	cout << ans << endl;
}
0