結果

問題 No.1021 Children in Classrooms
ユーザー takkun_k_t
提出日時 2020-04-10 22:05:50
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 600 bytes
コンパイル時間 1,714 ms
コンパイル使用メモリ 166,480 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-09-15 20:27:57
合計ジャッジ時間 5,472 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 6 TLE * 1 -- * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
  int n,m;
  string s;
  cin >> n >> m;
  int a[n];
  int num;
  for(int i=0;i<n;i++){
    cin >> num;
    a[i] = num;
  }
  cin >> s;

  for(int i=0;i<s.size();i++){
   if(s[i]=='L'){
     a[0] += a[1];
     for(int i=2;i<n;i++){
       a[i-1] = a[i];
       if(i==n-1){
         a[i] = 0;
       }
     }
   }
   else if(s[i]=='R'){
     a[n-1] += a[n-2];
     for(int i=n-3;i>=0;i--){
       a[i+1] = a[i];
       if(i==0){
         a[i] = 0;
       }
     }
   }
  }
  
  for(int i=0;i<n;i++){
   cout << a[i] << ' ';
  }
  
  return 0;
}
0