結果

問題 No.1021 Children in Classrooms
ユーザー finefine
提出日時 2020-04-10 23:46:47
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 32 ms / 2,000 ms
コード長 688 bytes
コンパイル時間 1,612 ms
コンパイル使用メモリ 171,284 KB
実行使用メモリ 4,572 KB
最終ジャッジ日時 2023-10-14 08:13:35
合計ジャッジ時間 3,356 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

using ll = long long;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    deque<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }

    string s;
    cin >> s;
    for (char c : s) {
        if (c == 'L') {
            int x = a.front();
            a.pop_front();
            a.front() += x;
            a.push_back(0);
        } else {
            int x = a.back();
            a.pop_back();
            a.back() += x;
            a.push_front(0);
        }
    }

    for (int i = 0; i < n; ++i) {
        cout << a[i] << " \n"[i + 1 == n];
    }
    return 0;
}
0