結果

問題 No.2482 Sandglasses
ユーザー karinohitokarinohito
提出日時 2023-09-22 22:15:29
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 180 ms / 2,000 ms
コード長 1,185 bytes
コンパイル時間 2,650 ms
コンパイル使用メモリ 212,452 KB
実行使用メモリ 11,392 KB
最終ジャッジ日時 2024-04-28 09:02:08
合計ジャッジ時間 9,868 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 142 ms
11,264 KB
testcase_04 AC 139 ms
11,392 KB
testcase_05 AC 141 ms
11,264 KB
testcase_06 AC 144 ms
11,264 KB
testcase_07 AC 144 ms
11,392 KB
testcase_08 AC 152 ms
11,264 KB
testcase_09 AC 140 ms
11,240 KB
testcase_10 AC 141 ms
11,392 KB
testcase_11 AC 139 ms
11,264 KB
testcase_12 AC 142 ms
11,264 KB
testcase_13 AC 146 ms
11,264 KB
testcase_14 AC 180 ms
11,204 KB
testcase_15 AC 142 ms
11,264 KB
testcase_16 AC 141 ms
11,264 KB
testcase_17 AC 141 ms
11,352 KB
testcase_18 AC 143 ms
11,264 KB
testcase_19 AC 144 ms
11,264 KB
testcase_20 AC 147 ms
11,264 KB
testcase_21 AC 144 ms
11,252 KB
testcase_22 AC 146 ms
11,264 KB
testcase_23 AC 137 ms
11,264 KB
testcase_24 AC 143 ms
11,264 KB
testcase_25 AC 143 ms
11,392 KB
testcase_26 AC 148 ms
11,264 KB
testcase_27 AC 147 ms
11,340 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vll=vector<ll>;
int main() {
    ll N,K,T;
    cin>>N>>K>>T;
    T%=(2*K);
    vll B(N),G(N);
    vector<char> A(N);
    for(ll i=0;i<N;i++){
        cin>>A[i];
    }
    vector<pair<ll,ll>> P(N);
    for(ll i=0;i<N;i++){
        cin>>B[i];
        P[i]={B[i],i};
        ll ZT=T;
        if(A[i]=='B'){
            if(K-B[i]>=ZT){
                G[i]=B[i]+ZT;
                continue;
            }
            ZT-=(K-B[i]);
            B[i]=K;
            if(B[i]>ZT){
                G[i]=B[i]-ZT;
                continue;
            }
            ZT-=B[i];
            B[i]=0;
            G[i]=ZT;
        }
        else{
            if(B[i]>ZT){
                G[i]=B[i]-ZT;
                continue;
            }
            ZT-=B[i];
            B[i]=0;
            if(ZT<=K){
                G[i]=ZT;
                continue;
            }
            ZT-=K;
            G[i]=K-ZT;
        }
    }
    sort(P.begin(),P.end());
    sort(G.begin(),G.end());
    vector<ll> AN(N);
    for(ll i=0;i<N;i++){
        AN[P[i].second]=G[i];
    }
    for(ll i=0;i<N;i++)cout<<AN[i]<<" \n"[i==N-1];
    

}
0