結果

問題 No.2623 Room Allocation
ユーザー manjuuu_onsenmanjuuu_onsen
提出日時 2024-02-09 21:39:38
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 484 bytes
コンパイル時間 1,743 ms
コンパイル使用メモリ 176,228 KB
実行使用メモリ 25,204 KB
最終ジャッジ日時 2024-02-09 21:39:43
合計ジャッジ時間 4,403 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 1 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 2 ms
6,676 KB
testcase_04 AC 2 ms
6,676 KB
testcase_05 AC 2 ms
6,676 KB
testcase_06 AC 51 ms
8,832 KB
testcase_07 AC 52 ms
8,832 KB
testcase_08 AC 54 ms
8,832 KB
testcase_09 AC 52 ms
8,832 KB
testcase_10 AC 44 ms
25,204 KB
testcase_11 AC 44 ms
25,204 KB
testcase_12 AC 23 ms
14,264 KB
testcase_13 AC 21 ms
14,264 KB
testcase_14 AC 132 ms
25,204 KB
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 AC 135 ms
19,732 KB
testcase_28 AC 62 ms
15,040 KB
testcase_29 AC 38 ms
14,432 KB
testcase_30 AC 152 ms
17,140 KB
testcase_31 AC 12 ms
7,040 KB
testcase_32 AC 34 ms
18,388 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>

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


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

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

}
0