結果

問題 No.2623 Room Allocation
ユーザー manjuuu_onsenmanjuuu_onsen
提出日時 2024-02-09 21:40:17
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 181 ms / 2,000 ms
コード長 473 bytes
コンパイル時間 1,670 ms
コンパイル使用メモリ 176,740 KB
実行使用メモリ 25,204 KB
最終ジャッジ日時 2024-02-09 21:40:22
合計ジャッジ時間 4,920 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 1 ms
6,676 KB
testcase_03 AC 2 ms
6,676 KB
testcase_04 AC 1 ms
6,676 KB
testcase_05 AC 2 ms
6,676 KB
testcase_06 AC 59 ms
8,832 KB
testcase_07 AC 60 ms
8,832 KB
testcase_08 AC 60 ms
8,832 KB
testcase_09 AC 60 ms
8,832 KB
testcase_10 AC 53 ms
25,204 KB
testcase_11 AC 52 ms
25,204 KB
testcase_12 AC 25 ms
14,264 KB
testcase_13 AC 24 ms
14,264 KB
testcase_14 AC 155 ms
25,204 KB
testcase_15 AC 94 ms
6,676 KB
testcase_16 AC 24 ms
6,676 KB
testcase_17 AC 3 ms
6,676 KB
testcase_18 AC 94 ms
6,676 KB
testcase_19 AC 88 ms
6,676 KB
testcase_20 AC 92 ms
6,676 KB
testcase_21 AC 95 ms
6,676 KB
testcase_22 AC 71 ms
6,676 KB
testcase_23 AC 41 ms
6,676 KB
testcase_24 AC 95 ms
6,676 KB
testcase_25 AC 77 ms
6,676 KB
testcase_26 AC 8 ms
6,676 KB
testcase_27 AC 181 ms
19,732 KB
testcase_28 AC 67 ms
15,040 KB
testcase_29 AC 44 ms
14,432 KB
testcase_30 AC 150 ms
17,140 KB
testcase_31 AC 15 ms
7,040 KB
testcase_32 AC 39 ms
18,388 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>

using namespace std;
using ll = long long;
using P = pair<ll,ll>;


int main()
{
	ll n,x,y;
	cin>>n>>x>>y;
	vector<vector<ll>> w(x+y,vector<ll>(2));
	for(ll i=0; i<n; i++) {
		ll p;
		char c;
		cin>>p>>c;
		w[i%(x+y)][c-'A'] += p;
	}

	sort(w.begin(), w.end(), [&](vector<ll>& x, vector<ll>&y){return x[0] - x[1] > y[0] - y[1];});
	ll ans = 0;
	for(ll i=0; i<x; i++) ans += w[i][0];
	for(ll j=x; j<x+y; j++) ans += w[j][1];
	cout << ans << endl;

}
0