結果

問題 No.1021 Children in Classrooms
ユーザー furafura
提出日時 2020-05-06 22:05:29
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 45 ms / 2,000 ms
コード長 461 bytes
コンパイル時間 2,003 ms
コンパイル使用メモリ 204,444 KB
実行使用メモリ 4,668 KB
最終ジャッジ日時 2023-09-16 07:34:33
合計ジャッジ時間 5,452 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 45 ms
4,436 KB
testcase_10 AC 44 ms
4,504 KB
testcase_11 AC 44 ms
4,668 KB
testcase_12 AC 44 ms
4,476 KB
testcase_13 AC 43 ms
4,444 KB
testcase_14 AC 43 ms
4,420 KB
testcase_15 AC 33 ms
4,384 KB
testcase_16 AC 34 ms
4,376 KB
testcase_17 AC 35 ms
4,504 KB
testcase_18 AC 43 ms
4,496 KB
testcase_19 AC 6 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

int main(){
	int n,m; scanf("%d%d",&n,&m);
	deque<int> D(n);
	rep(i,n) scanf("%d",&D[i]);

	string s; cin>>s;
	for(char c:s){
		if(c=='L'){
			int a=D.front();
			D.pop_front();
			D.front()+=a;
			D.emplace_back(0);
		}
		else{
			int a=D.back();
			D.pop_back();
			D.back()+=a;
			D.emplace_front(0);
		}
	}

	rep(i,n) printf("%d%c",D[i],i<n-1?' ':'\n');

	return 0;
}
0