結果

問題 No.1021 Children in Classrooms
ユーザー ningenMeningenMe
提出日時 2020-03-06 02:23:57
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 514 bytes
コンパイル時間 1,701 ms
コンパイル使用メモリ 172,040 KB
実行使用メモリ 178,980 KB
最終ジャッジ日時 2024-05-08 01:59:04
合計ジャッジ時間 5,390 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
10,752 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 5 ms
5,376 KB
testcase_04 AC 5 ms
5,376 KB
testcase_05 AC 4 ms
5,376 KB
testcase_06 AC 5 ms
5,376 KB
testcase_07 AC 7 ms
5,376 KB
testcase_08 AC 7 ms
5,376 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 <bits/stdc++.h>
using namespace std;

int main() {
    cin.tie(0);ios::sync_with_stdio(false);	
    int N,M; cin >> N >> M;
	vector<int> A(N);
	for(int i = 0; i < N; ++i) cin >> A[i];
	string S; cin >> S;
	for(char& c:S){
		if(c=='L'){
            for(int i = 1; i < N; ++i) A[i-1] += A[i],A[i] = 0;
		}
		else{
            for(int i = N-2; 0 <= i; --i) A[i+1] += A[i],A[i] = 0;
		}
	}
    string ans = "";
	for(int i = 0; i < N; ++i) ans += to_string(A[i]) + " ";
    cout << ans << endl;
    return 0;
}
0