結果
問題 |
No.2623 Room Allocation
|
ユーザー |
|
提出日時 | 2024-02-09 21:34:03 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 434 bytes |
コンパイル時間 | 638 ms |
コンパイル使用メモリ | 70,088 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-09-28 14:45:30 |
合計ジャッジ時間 | 2,547 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 WA * 12 |
ソースコード
#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; }