結果

問題 No.1021 Children in Classrooms
ユーザー 👑 zeronosu77108zeronosu77108
提出日時 2020-04-10 23:06:10
言語 C++17(clang)
(14.0.0 + boost 1.83.0)
結果
AC  
実行時間 81 ms / 2,000 ms
コード長 732 bytes
コンパイル時間 1,151 ms
コンパイル使用メモリ 94,604 KB
実行使用メモリ 4,548 KB
最終ジャッジ日時 2023-08-20 14:42:41
合計ジャッジ時間 3,254 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,384 KB
testcase_01 AC 2 ms
4,384 KB
testcase_02 AC 2 ms
4,384 KB
testcase_03 AC 2 ms
4,384 KB
testcase_04 AC 2 ms
4,384 KB
testcase_05 AC 3 ms
4,384 KB
testcase_06 AC 2 ms
4,384 KB
testcase_07 AC 3 ms
4,388 KB
testcase_08 AC 2 ms
4,384 KB
testcase_09 AC 76 ms
4,468 KB
testcase_10 AC 75 ms
4,548 KB
testcase_11 AC 76 ms
4,504 KB
testcase_12 AC 74 ms
4,476 KB
testcase_13 AC 75 ms
4,476 KB
testcase_14 AC 75 ms
4,536 KB
testcase_15 AC 57 ms
4,384 KB
testcase_16 AC 58 ms
4,384 KB
testcase_17 AC 60 ms
4,388 KB
testcase_18 AC 81 ms
4,544 KB
testcase_19 AC 8 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <deque>

using namespace std;
using P = pair<char,int>;

int main() {
    int n,m;
    cin >> n >> m;
    deque<int> a;
    for (int i=0; i<n; i++) {
        int ai;
        cin >> ai;
        a.push_back(ai);
    }
    string s;
    cin >> s;

    int t;
    for (int i=0; i<s.size(); i++) {
        if (s[i] == 'R') {
            t = a.back(); a.pop_back();
            a.back() += t;
            a.push_front(0);
        } else {
            t = a.front(); a.pop_front();
            a.front() += t;
            a.push_back(0);
        }
    }

    for (auto ai : a) {
        cout << ai << " ";
    }
    cout << endl;

}
0