結果

問題 No.1021 Children in Classrooms
ユーザー RhoRho
提出日時 2020-04-10 21:28:06
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 70 ms / 2,000 ms
コード長 665 bytes
コンパイル時間 1,478 ms
コンパイル使用メモリ 170,016 KB
実行使用メモリ 6,764 KB
最終ジャッジ日時 2023-10-13 23:18:32
合計ジャッジ時間 3,523 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 1 ms
4,352 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,352 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 67 ms
6,752 KB
testcase_10 AC 68 ms
6,724 KB
testcase_11 AC 66 ms
6,668 KB
testcase_12 AC 67 ms
6,764 KB
testcase_13 AC 67 ms
6,668 KB
testcase_14 AC 65 ms
6,664 KB
testcase_15 AC 50 ms
5,956 KB
testcase_16 AC 51 ms
5,968 KB
testcase_17 AC 53 ms
6,236 KB
testcase_18 AC 70 ms
6,676 KB
testcase_19 AC 8 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include"bits/stdc++.h"
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const long long inf = 1ll << 61;
int a[200006];
signed main() {
	int n, m; cin >> n >> m;
	deque<int>Q;
	rep(i, n) {
		cin >> a[i];
		Q.push_back(a[i]);
	}
	string s; cin >> s;
	int L = 0;
	rep(i, m) {
		if (s[i] == 'L') {
			int a = Q.front(); Q.pop_front();
			int b = Q.front(); Q.pop_front();
			Q.push_front(a + b);
			Q.push_back(0);
		}
		else {
			int a = Q.back(); Q.pop_back();
			int b = Q.back(); Q.pop_back();
			Q.push_back(a + b);
			Q.push_front(0);
		}
	}
	rep(i, n) {
		if (i)cout << ' ';
		cout << Q.front(); Q.pop_front();
	}cout << endl;
}
0