結果

問題 No.1021 Children in Classrooms
ユーザー takayusamurai
提出日時 2020-04-10 22:52:01
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 552 bytes
コンパイル時間 1,617 ms
コンパイル使用メモリ 168,928 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-09-15 23:12:09
合計ジャッジ時間 5,427 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 6 TLE * 1 -- * 10
権限があれば一括ダウンロードができます

ソースコード

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