結果
問題 | No.1021 Children in Classrooms |
ユーザー |
|
提出日時 | 2020-04-13 13:43:11 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 82 ms / 2,000 ms |
コード長 | 760 bytes |
コンパイル時間 | 1,792 ms |
コンパイル使用メモリ | 174,068 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-24 19:26:08 |
合計ジャッジ時間 | 4,661 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
#include <bits/stdc++.h> #define rep(i,n) for (int i=0; i<(int)(n); i++) #define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++) using namespace std; using ll = long long; using P = pair<int, int>; int main() { int n; cin >> n; int m; cin >> m; deque<int> a; rep(i,n) { int ai; cin >> ai; a.push_back(ai); } string s; cin >> s; rep(i,m) { int t = 0; if (s[i] == 'L') { t += a.front(); a.pop_front(); t += a.front(); a.pop_front(); a.push_front(t); a.push_back(0); } else if(s[i] == 'R') { t += a.back(); a.pop_back(); t += a.back(); a.pop_back(); a.push_back(t); a.push_front(0); } } rep(i,n) { cout << a[i]; if (i==n-1) cout << endl; else cout << " "; } }