結果

問題 No.1021 Children in Classrooms
ユーザー takayusamuraitakayusamurai
提出日時 2020-04-13 13:43:11
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 84 ms / 2,000 ms
コード長 760 bytes
コンパイル時間 1,666 ms
コンパイル使用メモリ 173,652 KB
実行使用メモリ 4,580 KB
最終ジャッジ日時 2023-10-25 00:24:08
合計ジャッジ時間 5,596 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 3 ms
4,348 KB
testcase_08 AC 3 ms
4,348 KB
testcase_09 AC 79 ms
4,576 KB
testcase_10 AC 79 ms
4,576 KB
testcase_11 AC 79 ms
4,576 KB
testcase_12 AC 78 ms
4,576 KB
testcase_13 AC 78 ms
4,576 KB
testcase_14 AC 79 ms
4,576 KB
testcase_15 AC 59 ms
4,376 KB
testcase_16 AC 60 ms
4,388 KB
testcase_17 AC 62 ms
4,412 KB
testcase_18 AC 84 ms
4,580 KB
testcase_19 AC 9 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(int)(n); i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int n; cin >> n;
  int m; cin >> m;
  deque<int> a;
  rep(i,n) {
    int ai; cin >> ai;
    a.push_back(ai);
  }
  string s; cin >> s;
  rep(i,m) {
    int t = 0;
    if (s[i] == 'L') {
      t += a.front(); a.pop_front();
      t += a.front(); a.pop_front();
      a.push_front(t);
      a.push_back(0);
    }
    else if(s[i] == 'R') {
      t += a.back(); a.pop_back();
      t += a.back(); a.pop_back();
      a.push_back(t);
      a.push_front(0);
    }
  }
  rep(i,n) {
    cout << a[i];
    if (i==n-1) cout << endl;
    else cout << " ";
  }
}
0