結果
問題 |
No.1021 Children in Classrooms
|
ユーザー |
|
提出日時 | 2020-05-20 15:15:44 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 82 ms / 2,000 ms |
コード長 | 741 bytes |
コンパイル時間 | 1,719 ms |
コンパイル使用メモリ | 173,608 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-01 23:33:39 |
合計ジャッジ時間 | 4,496 ms |
ジャッジサーバーID (参考情報) |
judge5 / 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 REP(i, n) for(int i = a; i < b; i++) using lint = long long; const lint MOD = 1e12; signed main(){ int n, m; cin >> n >> m; vector<int> a(n); rep(i, n) cin >> a[i]; string s; cin >> s; deque<int> que; rep(i, n) que.push_back(a[i]); rep(i, m){ if(s[i] == 'L'){ int x1 = que.front(); que.pop_front(); int x2 = que.front(); que.pop_front(); que.push_front(x1 + x2); que.push_back(0); } if(s[i] == 'R'){ int x1 = que.back(); que.pop_back(); int x2 = que.back(); que.pop_back(); que.push_front(0); que.push_back(x1 + x2); } } rep(i, n){ cout << que.front() << " "; que.pop_front(); } cout << endl; }