結果

問題 No.1021 Children in Classrooms
ユーザー takayusamuraitakayusamurai
提出日時 2020-04-10 22:52:01
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 552 bytes
コンパイル時間 1,561 ms
コンパイル使用メモリ 168,352 KB
実行使用メモリ 9,664 KB
最終ジャッジ日時 2023-10-14 03:41:35
合計ジャッジ時間 5,656 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
9,664 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 2 ms
4,352 KB
testcase_03 AC 5 ms
4,356 KB
testcase_04 AC 6 ms
4,356 KB
testcase_05 AC 5 ms
4,352 KB
testcase_06 AC 5 ms
4,352 KB
testcase_07 AC 7 ms
4,356 KB
testcase_08 AC 7 ms
4,348 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>
#define rep(i,n) for (int i=0; i<(int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int n, m; cin >> n >> m;
  vector<ll> a(n);
  rep(i,n) cin >> a[i];
  string s; cin >> s;
  
  rep(i,m) {
    if (s[i] == 'L') {
      rep(j, n-1) {
        a[j] += a[j+1];
        a[j+1] = 0;
      }
    } else {
      rep(j, n-1) {
        a[n-1-j] += a[n-2-j];
        a[n-2-j] = 0;
      }
    }
  }
  rep(i,n) {
    cout << a[i];
    if (i!=n-1) cout << " "; 
    else cout << endl;
  }
}
0