結果

問題 No.1021 Children in Classrooms
ユーザー takkun_k_ttakkun_k_t
提出日時 2020-04-10 22:05:50
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 600 bytes
コンパイル時間 1,706 ms
コンパイル使用メモリ 165,636 KB
実行使用メモリ 8,740 KB
最終ジャッジ日時 2023-10-14 00:39:26
合計ジャッジ時間 5,574 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
8,740 KB
testcase_01 WA -
testcase_02 AC 2 ms
4,368 KB
testcase_03 AC 4 ms
4,368 KB
testcase_04 AC 5 ms
4,368 KB
testcase_05 AC 4 ms
4,372 KB
testcase_06 AC 5 ms
4,368 KB
testcase_07 AC 8 ms
4,372 KB
testcase_08 AC 6 ms
4,368 KB
testcase_09 TLE -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

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