結果

問題 No.1021 Children in Classrooms
ユーザー chocono2230chocono2230
提出日時 2020-04-10 22:31:26
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 94 ms / 2,000 ms
コード長 882 bytes
コンパイル時間 1,507 ms
コンパイル使用メモリ 166,364 KB
実行使用メモリ 9,872 KB
最終ジャッジ日時 2023-10-14 01:16:42
合計ジャッジ時間 3,892 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 1 ms
4,352 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,352 KB
testcase_05 AC 3 ms
4,352 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 3 ms
4,352 KB
testcase_08 AC 3 ms
4,352 KB
testcase_09 AC 89 ms
9,724 KB
testcase_10 AC 90 ms
9,804 KB
testcase_11 AC 90 ms
9,872 KB
testcase_12 AC 87 ms
9,728 KB
testcase_13 AC 89 ms
9,684 KB
testcase_14 AC 88 ms
9,740 KB
testcase_15 AC 68 ms
8,228 KB
testcase_16 AC 69 ms
8,284 KB
testcase_17 AC 72 ms
8,604 KB
testcase_18 AC 94 ms
9,872 KB
testcase_19 AC 12 ms
4,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int main(){
	int n, m;
	cin >> n >> m;
	list<ll> lis;
	rep(i, n){
		ll in;
		cin >> in;
		lis.push_back(in);
	}
	string s;
	cin >> s;
	rep(i, m){
		if(s[i] == 'L'){
			ll l1 = lis.front();
			lis.pop_front();
			lis.front() += l1;
			lis.push_back(0);
		}else{
			ll l1 = lis.back();
			lis.pop_back();
			lis.back() += l1;
			lis.push_front(0);
		}
	}
	rep(i, n){
		if(i != 0) cout << " ";
		cout << lis.front();
		lis.pop_front();
	}
	cout << endl;
	return 0;
}
0