結果

問題 No.2482 Sandglasses
ユーザー Nzt3Nzt3
提出日時 2023-09-22 22:35:28
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 86 ms / 2,000 ms
コード長 957 bytes
コンパイル時間 2,516 ms
コンパイル使用メモリ 212,300 KB
実行使用メモリ 7,424 KB
最終ジャッジ日時 2024-04-28 09:02:47
合計ジャッジ時間 8,445 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 83 ms
7,424 KB
testcase_04 AC 83 ms
7,296 KB
testcase_05 AC 83 ms
7,296 KB
testcase_06 AC 83 ms
7,168 KB
testcase_07 AC 83 ms
7,168 KB
testcase_08 AC 86 ms
7,168 KB
testcase_09 AC 85 ms
7,296 KB
testcase_10 AC 82 ms
7,296 KB
testcase_11 AC 84 ms
7,296 KB
testcase_12 AC 83 ms
7,296 KB
testcase_13 AC 83 ms
7,296 KB
testcase_14 AC 83 ms
7,168 KB
testcase_15 AC 84 ms
7,296 KB
testcase_16 AC 83 ms
7,168 KB
testcase_17 AC 84 ms
7,296 KB
testcase_18 AC 83 ms
7,296 KB
testcase_19 AC 83 ms
7,296 KB
testcase_20 AC 84 ms
7,296 KB
testcase_21 AC 83 ms
7,296 KB
testcase_22 AC 84 ms
7,296 KB
testcase_23 AC 81 ms
7,296 KB
testcase_24 AC 82 ms
7,296 KB
testcase_25 AC 84 ms
7,296 KB
testcase_26 AC 82 ms
7,296 KB
testcase_27 AC 83 ms
7,168 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N,K,T;
  cin>>N>>K>>T;
  vector A(N,'/');
  vector B(N,0);
  for(auto &i:A)cin>>i;
  for(auto &i:B)cin>>i;
  vector b_T(N,0);
  for(int i=0;i<N;i++){
    if(A[i]=='A'){
      if(B[i]>=T){
        b_T[i]=B[i]-T;
      }else{
        int k=T-B[i];
        if(k/K%2==0){
          b_T[i]=k%K;
        }else{
          b_T[i]=K-k%K;
        }
      }
    }else{
      if(B[i]+T<=K){
        b_T[i]=B[i]+T;
      }else{
        int k=B[i]+T;
        if(k/K%2==0){
          b_T[i]=k%K;
        }else{
          b_T[i]=K-k%K;
        }
      }
    }
  }
  vector oB(N,array<int,2>());
  for(int i=0;i<N;i++){
    oB[i]={B[i],i};
  }
  sort(oB.begin(),oB.end());
  sort(b_T.begin(),b_T.end());
  vector ans(N,0);
  for(int i=0;i<N;i++){
    ans[oB[i][1]]=b_T[i];
  }
  for(int i=0;i<N;i++){
    cout<<ans[i]<<" \n"[i==N-1];
  }
}
0