結果
問題 | No.1021 Children in Classrooms |
ユーザー |
|
提出日時 | 2020-04-11 00:14:16 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 70 ms / 2,000 ms |
コード長 | 792 bytes |
コンパイル時間 | 769 ms |
コンパイル使用メモリ | 73,600 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-16 04:12:29 |
合計ジャッジ時間 | 2,552 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
#include <iostream>#include <string>#include <deque>#define rep(i, n) for(int (i) = (0); (i) < (n); (i)++)using namespace std;int main(){int m, n, j;int tmp;cin >> n >> m;deque<int> a(n, 0);rep(i, n) cin >> a[i];string s;cin >> s;rep(i, m){if(s[i] == 'L'){tmp = a.front();a.pop_front();tmp += a.front();a.pop_front();a.push_front(tmp);a.push_back(0);}else{tmp = a.back();a.pop_back();tmp += a.back();a.pop_back();a.push_back(tmp);a.push_front(0);}}rep(i, n) cout << a[i] << ' ';cout << endl;return 0;}