結果

問題 No.1021 Children in Classrooms
ユーザー ashipanashipan
提出日時 2020-04-10 21:52:35
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 785 bytes
コンパイル時間 706 ms
コンパイル使用メモリ 76,628 KB
実行使用メモリ 8,768 KB
最終ジャッジ日時 2023-10-14 00:23:44
合計ジャッジ時間 4,611 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
8,700 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 1 ms
4,352 KB
testcase_03 AC 3 ms
4,348 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 3 ms
4,348 KB
testcase_08 AC 3 ms
4,352 KB
testcase_09 TLE -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#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;
    vector<int> a(n);
    rep(i, 0, n){
        cin >> a[i];
    }
    string s;
    cin >> s;
    rep(j, 0, m){
        if(s[j] == 'L'){
            a[0] += a[1];
            rep(i, 1, n-1){
                a[i] = a[i+1];
            }
            a[n-1] = 0;
        }
        else{
            a[n-1] += a[n-2];
            for(int i = n-2; i >= 1; i--){
                a[i] = a[i-1];
            }
            a[0] = 0;
        }
    }
    rep(i, 0, n){
        cout << a[i] << " ";
    }
    cout << endl;
    return 0;
}
0