結果
問題 | No.1021 Children in Classrooms |
ユーザー |
|
提出日時 | 2023-07-31 12:02:50 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 30 ms / 2,000 ms |
コード長 | 613 bytes |
コンパイル時間 | 1,831 ms |
コンパイル使用メモリ | 199,544 KB |
最終ジャッジ日時 | 2025-02-15 21:10:06 |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
#include <bits/stdc++.h>using namespace std;int N, M, t;string S;deque<int> p;int main(){ios_base::sync_with_stdio(0); cin.tie(0);cin >> N >> M;for (int i = 1; i <= N; ++i) {cin >> t; p.push_back(t);}cin >> S;for (int i = 0; i < (int)S.size(); ++i) {if (S[i] == 'L') {t = p.front(); p.pop_front();p[0] += t;p.push_back(0);}else {t = p.back(); p.pop_back();p[N - 2] += t;p.push_front(0);}}for (auto &t : p) cout << t << ' ';return 0;}