結果

問題 No.2623 Room Allocation
ユーザー zeta7532zeta7532
提出日時 2024-01-11 01:09:17
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 119 ms / 2,000 ms
コード長 791 bytes
コンパイル時間 2,340 ms
コンパイル使用メモリ 211,680 KB
実行使用メモリ 12,676 KB
最終ジャッジ日時 2024-01-11 01:09:24
合計ジャッジ時間 6,107 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 1 ms
6,676 KB
testcase_02 AC 1 ms
6,676 KB
testcase_03 AC 1 ms
6,676 KB
testcase_04 AC 2 ms
6,676 KB
testcase_05 AC 2 ms
6,676 KB
testcase_06 AC 50 ms
6,676 KB
testcase_07 AC 52 ms
6,676 KB
testcase_08 AC 50 ms
6,676 KB
testcase_09 AC 51 ms
6,676 KB
testcase_10 AC 12 ms
12,676 KB
testcase_11 AC 13 ms
12,676 KB
testcase_12 AC 7 ms
8,064 KB
testcase_13 AC 7 ms
8,064 KB
testcase_14 AC 116 ms
12,676 KB
testcase_15 AC 96 ms
6,676 KB
testcase_16 AC 25 ms
6,676 KB
testcase_17 AC 3 ms
6,676 KB
testcase_18 AC 95 ms
6,676 KB
testcase_19 AC 90 ms
6,676 KB
testcase_20 AC 109 ms
6,676 KB
testcase_21 AC 96 ms
6,676 KB
testcase_22 AC 73 ms
6,676 KB
testcase_23 AC 42 ms
6,676 KB
testcase_24 AC 97 ms
6,676 KB
testcase_25 AC 78 ms
6,676 KB
testcase_26 AC 8 ms
6,676 KB
testcase_27 AC 119 ms
10,368 KB
testcase_28 AC 47 ms
8,320 KB
testcase_29 AC 26 ms
8,064 KB
testcase_30 AC 118 ms
9,216 KB
testcase_31 AC 9 ms
6,676 KB
testcase_32 AC 16 ms
9,856 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
using ll = long long;
#define fi first
#define se second
#define rep(i,n) for(ll i=0;i<n;i++)
#define all(x) x.begin(),x.end()
#define faster ios::sync_with_stdio(false);cin.tie(nullptr)

int main() {
    ll N,X,Y;
    cin >> N >> X >> Y;
    ll mod=X+Y;
    vector<ll> cntA(mod,0),cntB(mod,0);
    rep(i,N){
        ll p;
        char c;
        cin >> p >> c;
        if(c=='A') cntA[i%mod]+=p;
        if(c=='B') cntB[i%mod]+=p;
    }
    vector<ll> cnt(mod);
    rep(i,mod) cnt[i]=cntA[i]-cntB[i];
    sort(all(cnt));
    reverse(all(cnt));
    ll ans=0;
    rep(i,mod) ans+=cntB[i];
    rep(i,X) ans+=cnt[i];
    cout << ans << endl;
    return 0;
}
0