結果
問題 | No.1021 Children in Classrooms |
ユーザー |
|
提出日時 | 2020-06-05 19:56:25 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 35 ms / 2,000 ms |
コード長 | 1,204 bytes |
コンパイル時間 | 1,727 ms |
コンパイル使用メモリ | 172,492 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-16 07:35:22 |
合計ジャッジ時間 | 3,402 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
#include <bits/stdc++.h>using namespace std;#define rep(i, n) for(int i = 0; i < (int)n; ++i)#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)using ll = long long;using ld = long double;const ll INF = 1e18;const int Inf = 1e9;const double EPS = 1e-9;const int MOD = 1e9 + 7;int main() {cin.tie(nullptr);ios::sync_with_stdio(0);int n, m;string s;cin >> n >> m;deque<int> dq;rep (i, n) {int a;cin >> a;dq.push_back(a);}cin >> s;rep (i, s.size()) {if (s[i] == 'L') {int f1 = dq.front();dq.pop_front();int f2 = dq.front();dq.pop_front();dq.push_front(f1 + f2);dq.push_back(0);} else {int b1 = dq.back();dq.pop_back();int b2 = dq.back();dq.pop_back();dq.push_back(b1 + b2);dq.push_front(0);}}while (!dq.empty()) {cout << dq.front();dq.pop_front();if (dq.size() == 0) cout << endl;else cout << " ";}return 0;}