結果

問題 No.1021 Children in Classrooms
ユーザー ashipanashipan
提出日時 2020-04-10 23:48:49
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 76 ms / 2,000 ms
コード長 806 bytes
コンパイル時間 822 ms
コンパイル使用メモリ 78,296 KB
実行使用メモリ 4,448 KB
最終ジャッジ日時 2023-10-14 08:20:19
合計ジャッジ時間 3,177 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,372 KB
testcase_01 AC 1 ms
4,368 KB
testcase_02 AC 2 ms
4,372 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,368 KB
testcase_05 AC 2 ms
4,372 KB
testcase_06 AC 2 ms
4,368 KB
testcase_07 AC 2 ms
4,368 KB
testcase_08 AC 2 ms
4,372 KB
testcase_09 AC 71 ms
4,368 KB
testcase_10 AC 71 ms
4,372 KB
testcase_11 AC 72 ms
4,448 KB
testcase_12 AC 70 ms
4,368 KB
testcase_13 AC 70 ms
4,372 KB
testcase_14 AC 70 ms
4,376 KB
testcase_15 AC 54 ms
4,372 KB
testcase_16 AC 54 ms
4,368 KB
testcase_17 AC 57 ms
4,372 KB
testcase_18 AC 76 ms
4,372 KB
testcase_19 AC 8 ms
4,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <deque>
#define rep(i, a, n) for(int i = a; i < n; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main()
{
    int n, m;
    cin >> n >> m;
    deque<int> a(n);
    rep(i, 0, n){
        cin >> a[i];
    }
    string s;
    cin >> s;
    rep(i, 0, m){
        if(s[i] == 'L'){
            int temp = a[0] + a[1];
            a.pop_front();
            a.pop_front();
            a.push_front(temp);
            a.push_back(0);
        }
        else{
            int temp = a[n-1] + a[n-2];
            a.pop_back();
            a.pop_back();
            a.push_back(temp);
            a.push_front(0);
        }
    }
    rep(i, 0, n){
        cout << a[i] << " ";
    }
    cout << endl;
    return 0;
}
0