結果
問題 |
No.2623 Room Allocation
|
ユーザー |
![]() |
提出日時 | 2024-02-09 21:39:38 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 484 bytes |
コンパイル時間 | 1,837 ms |
コンパイル使用メモリ | 177,172 KB |
実行使用メモリ | 25,108 KB |
最終ジャッジ日時 | 2024-09-28 14:54:59 |
合計ジャッジ時間 | 4,758 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 WA * 12 |
ソースコード
#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; }