結果

問題 No.1021 Children in Classrooms
ユーザー ashipan
提出日時 2020-04-10 23:48:49
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 79 ms / 2,000 ms
コード長 806 bytes
コンパイル時間 901 ms
コンパイル使用メモリ 78,296 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-16 03:27:13
合計ジャッジ時間 3,028 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

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