結果

問題 No.1021 Children in Classrooms
ユーザー catuppercatupper
提出日時 2020-04-10 21:59:31
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 947 bytes
コンパイル時間 2,508 ms
コンパイル使用メモリ 72,108 KB
実行使用メモリ 4,796 KB
最終ジャッジ日時 2023-10-14 00:30:37
合計ジャッジ時間 6,080 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,372 KB
testcase_01 AC 2 ms
4,352 KB
testcase_02 AC 2 ms
4,352 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 RE -
testcase_06 RE -
testcase_07 AC 3 ms
4,348 KB
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 AC 73 ms
4,348 KB
testcase_19 AC 6 ms
4,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cassert>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
using namespace std;
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;

int n, m;
string s;
int a[220000];

int main(){
    cin >> n >> m;
    for(int i = 0;i < n;i++)cin >> a[i];
    int l = 0, r = n-1;
    cin >> s;
    for(char c:s){
        if(c == 'R'){
            if(r == 0)continue;
            a[r-1] += a[r];
            a[r] = 0;
            l--,r--;
        }
        else{
            if(l == n-1)continue;
            a[l+1] += a[l];
            a[l] = 0;
            l++,r++;
        }
    }
    for(int i = l;i <= r;i++){
        if(0 <= i && i < n)cout << a[i] << " ";
        else cout << 0 << " ";
    }cout << endl;
    return 0;
}
0