結果

問題 No.1021 Children in Classrooms
ユーザー risujirohrisujiroh
提出日時 2020-04-10 21:36:15
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 32 ms / 2,000 ms
コード長 586 bytes
コンパイル時間 1,824 ms
コンパイル使用メモリ 169,848 KB
実行使用メモリ 4,480 KB
最終ジャッジ日時 2023-10-13 23:37:11
合計ジャッジ時間 3,573 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

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

#ifdef LOCAL
#include "debug.h"
#else
#define DEBUG(...)
#endif

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  deque<int> deq(n);
  for (auto&& e : deq) {
    cin >> e;
  }
  string s;
  cin >> s;
  for (char c : s) {
    if (c == 'L') {
      deq[1] += deq[0];
      deq.pop_front();
      deq.push_back(0);
    } else {
      deq[n - 2] += deq[n - 1];
      deq.pop_back();
      deq.push_front(0);
    }
  }
  for (int i = 0; i < n; ++i) {
    cout << deq[i] << " \n"[i == n - 1];
  }
}
0