結果

問題 No.1021 Children in Classrooms
ユーザー umezoumezo
提出日時 2022-08-08 00:43:08
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 35 ms / 2,000 ms
コード長 605 bytes
コンパイル時間 2,144 ms
コンパイル使用メモリ 203,548 KB
実行使用メモリ 8,504 KB
最終ジャッジ日時 2023-10-17 19:04:26
合計ジャッジ時間 3,961 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
7,860 KB
testcase_01 AC 4 ms
7,860 KB
testcase_02 AC 4 ms
7,860 KB
testcase_03 AC 4 ms
7,860 KB
testcase_04 AC 4 ms
7,860 KB
testcase_05 AC 4 ms
7,860 KB
testcase_06 AC 4 ms
7,860 KB
testcase_07 AC 5 ms
7,860 KB
testcase_08 AC 4 ms
7,860 KB
testcase_09 AC 35 ms
8,256 KB
testcase_10 AC 35 ms
8,260 KB
testcase_11 AC 34 ms
8,252 KB
testcase_12 AC 35 ms
8,256 KB
testcase_13 AC 34 ms
8,248 KB
testcase_14 AC 34 ms
8,252 KB
testcase_15 AC 26 ms
8,296 KB
testcase_16 AC 26 ms
8,312 KB
testcase_17 AC 27 ms
8,264 KB
testcase_18 AC 35 ms
8,504 KB
testcase_19 AC 7 ms
8,264 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;

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

int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);

  int n,m;
  cin>>n>>m;
  vector<ll> A(600000);
  int t=200000;
  rep(i,n) cin>>A[i+t];
  string s;
  cin>>s;
  
  int l=t,r=t+n-1;
  rep(i,m){
    if(s[i]=='L'){
      A[l+1]+=A[l];
      A[l]=0;
      l++,r++;
    }
    else{
      A[r-1]+=A[r];
      A[r]=0;
      l--,r--;
    }
  }
  for(int i=l;i<=r;i++){
    if(i>l) cout<<" ";
    cout<<A[i];
  }
  cout<<endl;
      
  return 0;
}
0