結果
| 問題 |
No.2623 Room Allocation
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-02-09 22:25:00 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 43 ms / 2,000 ms |
| コード長 | 457 bytes |
| コンパイル時間 | 1,839 ms |
| コンパイル使用メモリ | 197,328 KB |
| 最終ジャッジ日時 | 2025-02-19 03:49:23 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 30 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int N,X,Y;
cin>>N>>X>>Y;
vector cnt(X+Y,0ll);
ll ans=0;
for(int i=0;i<N;i++){
int P;char C;
cin>>P>>C;
if(C=='A'){
cnt[i%(X+Y)]+=P;
}else{
ans+=P;
cnt[i%(X+Y)]-=P;
}
}
sort(cnt.begin(),cnt.end(),greater<ll>());
for(int i=0;i<X;i++){
ans+=cnt[i];
}
cout<<ans<<'\n';
}