結果

問題 No.2482 Sandglasses
ユーザー askr58askr58
提出日時 2023-09-22 22:51:02
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 156 ms / 2,000 ms
コード長 822 bytes
コンパイル時間 4,033 ms
コンパイル使用メモリ 267,704 KB
実行使用メモリ 6,656 KB
最終ジャッジ日時 2024-04-28 09:03:09
合計ジャッジ時間 10,965 ms
ジャッジサーバーID
(参考情報)
judge3 / 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 154 ms
6,528 KB
testcase_04 AC 146 ms
6,400 KB
testcase_05 AC 148 ms
6,400 KB
testcase_06 AC 145 ms
6,400 KB
testcase_07 AC 143 ms
6,400 KB
testcase_08 AC 148 ms
6,528 KB
testcase_09 AC 147 ms
6,528 KB
testcase_10 AC 147 ms
6,656 KB
testcase_11 AC 150 ms
6,528 KB
testcase_12 AC 145 ms
6,400 KB
testcase_13 AC 153 ms
6,400 KB
testcase_14 AC 148 ms
6,400 KB
testcase_15 AC 146 ms
6,656 KB
testcase_16 AC 144 ms
6,400 KB
testcase_17 AC 149 ms
6,656 KB
testcase_18 AC 152 ms
6,400 KB
testcase_19 AC 156 ms
6,656 KB
testcase_20 AC 153 ms
6,400 KB
testcase_21 AC 149 ms
6,656 KB
testcase_22 AC 146 ms
6,656 KB
testcase_23 AC 142 ms
6,528 KB
testcase_24 AC 142 ms
6,528 KB
testcase_25 AC 140 ms
6,528 KB
testcase_26 AC 145 ms
6,400 KB
testcase_27 AC 140 ms
6,528 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll=long long;

int main()
{   int n,k,t;
    cin>>n>>k>>t;
    t%=2*k;
    vector<bool> right(n);
    for(int i=0;i<n;i++){
        char c;
        cin>>c;
        if(c=='B')right[i]=true;
    }
    vector<pair<int,int>> o(n);
    vector<int> p(n);
    for(int i=0;i<n;i++){
        int b;
        cin>>b;
        o[i]={b,i};
        if(right[i])b+=t;
        else b-=t;
        while(b>k||b<0){
        if(b>k)b=2*k-b;
        if(b<0)b=-b;

        }
        p[i]=b;

    }
    sort(o.begin(),o.end());
    sort(p.begin(),p.end());
    vector<int> ans(n);
    for(int i=0;i<n;i++){
        ans[o[i].second]=p[i];
    }
    for(int i=0;i<n-1;i++){
        cout<<ans[i]<<" ";
    }
    cout<<ans[n-1]<<endl;
    return 0;
}
0