結果

問題 No.1021 Children in Classrooms
ユーザー ns6251ns6251
提出日時 2020-04-17 18:02:52
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 690 bytes
コンパイル時間 1,572 ms
コンパイル使用メモリ 165,980 KB
実行使用メモリ 13,756 KB
最終ジャッジ日時 2024-04-14 12:43:02
合計ジャッジ時間 5,547 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
13,756 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 6 ms
6,944 KB
testcase_04 AC 7 ms
6,948 KB
testcase_05 AC 6 ms
6,944 KB
testcase_06 AC 6 ms
6,944 KB
testcase_07 AC 9 ms
6,940 KB
testcase_08 AC 9 ms
6,940 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>
using namespace std;

int n, m;

void f(vector<int>& a, char c)
{
    if (c == 'L') {
        for (int i = 1; i < n; i++) {
            a.at(i - 1) += a.at(i);
            a.at(i) = 0;
        }
    } else {
        for (int i = n - 2; i >= 0; i--) {
            a.at(i + 1) += a.at(i);
            a.at(i) = 0;
        }
    }
}

int main()
{
    cin >> n >> m;
    vector<int> a(n);
    for (auto&& v : a) {
        cin >> v;
    }
    string s;
    cin >> s;

    auto p = s.begin();
    while (p != s.end()) {
        f(a, *p);
        p++;
    }

    cout << a.at(0);
    for (int i = 1; i < n; i++) {
        cout << " " << a.at(i);
    }
    cout << endl;
}
0