結果

問題 No.1021 Children in Classrooms
ユーザー micheeeeell1001micheeeeell1001
提出日時 2020-04-10 21:39:03
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 37 ms / 2,000 ms
コード長 1,348 bytes
コンパイル時間 1,789 ms
コンパイル使用メモリ 172,088 KB
実行使用メモリ 6,780 KB
最終ジャッジ日時 2023-10-13 23:42:50
合計ジャッジ時間 3,743 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,352 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 2 ms
4,352 KB
testcase_04 AC 2 ms
4,352 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 36 ms
6,576 KB
testcase_10 AC 37 ms
6,644 KB
testcase_11 AC 37 ms
6,512 KB
testcase_12 AC 36 ms
6,780 KB
testcase_13 AC 36 ms
6,680 KB
testcase_14 AC 36 ms
6,600 KB
testcase_15 AC 27 ms
5,712 KB
testcase_16 AC 27 ms
5,756 KB
testcase_17 AC 29 ms
5,896 KB
testcase_18 AC 36 ms
6,400 KB
testcase_19 AC 5 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// #define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define rrep(i,x) for(ll i = (ll)(x)-1;0 <= i; i--)
#define reps(i,x) for(ll i = 1; i < (ll)(x)+1; i++)
#define rreps(i,x) for(ll i = (ll)(x); 1 <= i; i--)
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll INF = numeric_limits<ll>::max()/4;
const int n_max = 1e5+10;
#define int ll

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    ll n,m; cin >> n >> m;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    string s;cin >> s;
    deque<ll> deq;
    rep(i,n)deq.emplace_back(a[i]);
    rep(i,m){
        if(s[i] == 'L'){
            ll t1 = deq.front();deq.pop_front();
            ll t2 = deq.front();deq.pop_front();
            deq.emplace_front(t1 + t2);
            deq.emplace_back(0);
        }
        else{
            ll t1 = deq.back();deq.pop_back();
            ll t2 = deq.back();deq.pop_back();
            deq.emplace_back(t1 + t2);
            deq.emplace_front(0);
        }
    }

    for(auto &i : deq)cout << i << " ";
    cout << endl;
}
0