結果

問題 No.1021 Children in Classrooms
ユーザー face4face4
提出日時 2020-07-25 17:35:09
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 95 ms / 2,000 ms
コード長 585 bytes
コンパイル時間 573 ms
コンパイル使用メモリ 68,448 KB
実行使用メモリ 9,724 KB
最終ジャッジ日時 2023-09-09 18:03:28
合計ジャッジ時間 4,699 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 3 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 3 ms
4,384 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 93 ms
9,568 KB
testcase_10 AC 93 ms
9,612 KB
testcase_11 AC 94 ms
9,724 KB
testcase_12 AC 92 ms
9,620 KB
testcase_13 AC 92 ms
9,676 KB
testcase_14 AC 92 ms
9,616 KB
testcase_15 AC 72 ms
8,076 KB
testcase_16 AC 72 ms
8,112 KB
testcase_17 AC 75 ms
8,308 KB
testcase_18 AC 95 ms
9,608 KB
testcase_19 AC 18 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<list>
using namespace std;

int main(){
    int n, m;
    cin >> n >> m;
    list<int> l;
    for(int i = 0; i < n; i++){
        int x;  cin >> x;
        l.push_back(x);
    }
    while(m--){
        char c; cin >> c;
        if(c == 'L')    *(++l.begin()) += l.front(), l.pop_front(), l.push_back(0);
        else            *(----l.end()) += l.back(), l.pop_back(), l.push_front(0);
    }
    for(auto it = l.begin(); it != l.end();){
        cout << *it++;
        if(it == l.end())   break;
        cout << " ";
    }
    cout << endl;
    return 0;
}
0