結果

問題 No.1021 Children in Classrooms
ユーザー chocorusk
提出日時 2020-03-04 18:33:42
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 576 bytes
コンパイル時間 420 ms
コンパイル使用メモリ 55,912 KB
実行使用メモリ 18,376 KB
最終ジャッジ日時 2024-11-30 23:45:53
合計ジャッジ時間 35,483 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 6 TLE * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <string>
#include <algorithm>
using namespace std;
int n, m;
char s[200020];
int a[200020], tmp[200020];
int main()
{
	scanf("%d %d", &n, &m);
	for(int i=0; i<n; i++) scanf("%d", &a[i]);
	scanf("%s", s);
	for(int i=0; i<m; i++){
		fill(tmp, tmp+n, 0);
		if(s[i]=='L'){
			tmp[0]=a[0];
			for(int j=1; j<n; j++){
				tmp[j-1]+=a[j];
			}
		}else{
			tmp[n-1]=a[n-1];
			for(int j=0; j<n-1; j++){
				tmp[j+1]+=a[j];
			}
		}
		swap(a, tmp);
	}
	for(int i=0; i<n; i++){
		printf("%d", a[i]);
		if(i<n-1) printf(" ");
	}
	printf("\n");
    return 0;
}
0