結果

問題 No.1021 Children in Classrooms
ユーザー ningenMeningenMe
提出日時 2020-03-06 02:04:21
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 68 ms / 2,000 ms
コード長 441 bytes
コンパイル時間 1,966 ms
コンパイル使用メモリ 167,344 KB
実行使用メモリ 8,336 KB
最終ジャッジ日時 2023-08-20 19:33:45
合計ジャッジ時間 3,290 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 63 ms
8,188 KB
testcase_10 AC 62 ms
8,132 KB
testcase_11 AC 63 ms
8,132 KB
testcase_12 AC 61 ms
8,336 KB
testcase_13 AC 63 ms
8,176 KB
testcase_14 AC 61 ms
8,268 KB
testcase_15 AC 48 ms
7,748 KB
testcase_16 AC 48 ms
7,904 KB
testcase_17 AC 50 ms
7,776 KB
testcase_18 AC 68 ms
8,184 KB
testcase_19 AC 7 ms
6,532 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
	int N,M; cin >> N >> M;
	vector<ll> A(M + N + M,0);
	for(int i = M; i < M + N; ++i) cin >> A[i];
	string S; cin >> S;
	int l = M, r = M+N-1;
	for(char c:S){
		if(c=='L'){
			A[l+1] += A[l];
			A[l] = 0;
			l++;r++;
		}
		else{
			A[r-1] += A[r];
			A[r] = 0;
			l--;r--;
		}
	}
	for(int i = l; i <= r; ++i) cout << A[i] << " ";
	cout << endl;
    return 0;
}
0