結果

問題 No.2623 Room Allocation
ユーザー kotatsugamekotatsugame
提出日時 2024-02-09 21:34:03
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 434 bytes
コンパイル時間 675 ms
コンパイル使用メモリ 69,712 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-02-09 21:34:07
合計ジャッジ時間 2,392 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 2 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 18 ms
6,676 KB
testcase_07 AC 19 ms
6,676 KB
testcase_08 AC 18 ms
6,676 KB
testcase_09 AC 18 ms
6,676 KB
testcase_10 AC 9 ms
6,676 KB
testcase_11 AC 11 ms
6,676 KB
testcase_12 AC 6 ms
6,676 KB
testcase_13 AC 6 ms
6,676 KB
testcase_14 AC 40 ms
6,676 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 49 ms
6,676 KB
testcase_28 AC 21 ms
6,676 KB
testcase_29 AC 14 ms
6,676 KB
testcase_30 AC 47 ms
6,676 KB
testcase_31 AC 5 ms
6,676 KB
testcase_32 AC 10 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include<cassert>
using namespace std;
int N,X,Y;
int x[4<<17],y[4<<17];
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cin>>N>>X>>Y;
	for(int i=0;i<N;i++)
	{
		int p;char c;cin>>p>>c;
		if(c=='A')x[i%(X+Y)]+=p;
		else y[i%(X+Y)]+=p;
	}
	long ans=0;
	for(int i=0;i<X+Y;i++)
	{
		ans+=x[i];
		y[i]=x[i]-y[i];
	}
	sort(y,y+X+Y);
	for(int i=0;i<Y;i++)ans-=y[i];
	cout<<ans<<endl;
}
0