結果

問題 No.1021 Children in Classrooms
ユーザー 周宣辰周宣辰
提出日時 2020-04-17 17:15:59
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 36 ms / 2,000 ms
コード長 1,635 bytes
コンパイル時間 1,865 ms
コンパイル使用メモリ 169,332 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-14 12:42:38
合計ジャッジ時間 4,061 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 3 ms
6,940 KB
testcase_08 AC 2 ms
6,940 KB
testcase_09 AC 36 ms
6,944 KB
testcase_10 AC 36 ms
6,944 KB
testcase_11 AC 36 ms
6,944 KB
testcase_12 AC 35 ms
6,944 KB
testcase_13 AC 35 ms
6,940 KB
testcase_14 AC 35 ms
6,944 KB
testcase_15 AC 26 ms
6,944 KB
testcase_16 AC 27 ms
6,940 KB
testcase_17 AC 27 ms
6,940 KB
testcase_18 AC 34 ms
6,944 KB
testcase_19 AC 5 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
#define FOR(i,o,n) for(long long i = o;i<n;i++)
#define oneforall ios::sync_with_stdio(false);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
#define int long long
const long long INF=1e18;
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef vector<pair<long, long > > vpll;
typedef vector<pair<int, int > > vpii;


int32_t main() {
    oneforall
    oneforall
    oneforall
    oneforall
    oneforall
    oneforall
    oneforall
    oneforall
    oneforall
    oneforall
    oneforall
    oneforall
    oneforall
    oneforall
    
    ini(n);
    ini(n1);
    deque<int> morty;
    FOR(i,0,n){
        ini(x);
        morty.push_back(x);
    }
    ins(morty1);
    FOR(i,0,n1){
        if(morty1[i] == 'L'){
            int x1 = morty.front();morty.pop_front();
            int x2 = morty.front();morty.pop_front();
            morty.push_front(x1+x2);
            morty.push_back(0);
        }
        else{
            int x1 = morty.back();morty.pop_back();
            int x2 = morty.back();morty.pop_back();
            morty.push_back(x1+x2);
            morty.push_front(0);
        }
    }
    for(auto v:morty){cout<<v<<" ";}
    
    return 0;
}
0