結果
問題 | No.1021 Children in Classrooms |
ユーザー |
|
提出日時 | 2020-08-29 11:46:34 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 38 ms / 2,000 ms |
コード長 | 1,002 bytes |
コンパイル時間 | 1,819 ms |
コンパイル使用メモリ | 172,496 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-14 05:29:52 |
合計ジャッジ時間 | 3,899 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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 all(x) (x).begin(), (x).end()#define ll long long#define ld long double#define INF 1000000000000000000typedef pair<ll, ll> pll;typedef pair<int, int> pint;int main() {cin.tie(0);ios::sync_with_stdio(false);int N, M;cin >> N >> M;deque<int> de;rep(i, N) {int a;cin >> a;de.push_back(a);}rep(i, M) {char c;cin >> c;if (c == 'L') {int a = de.front();de.pop_front();int b = de.front();de.pop_front();de.push_front(a + b);de.push_back(0);} else {int a = de.back();de.pop_back();int b = de.back();de.pop_back();de.push_back(a + b);de.push_front(0);}}rep(i, de.size()) { cout << de[i] << " "; }cout << endl;}