結果
問題 | No.1021 Children in Classrooms |
ユーザー |
|
提出日時 | 2020-04-10 21:31:08 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 39 ms / 2,000 ms |
コード長 | 758 bytes |
コンパイル時間 | 719 ms |
コンパイル使用メモリ | 74,624 KB |
最終ジャッジ日時 | 2025-01-09 15:59:18 |
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
#include <iostream> #include <deque> void solve() { int n, m; std::cin >> n >> m; std::deque<int> xs; for (int i = 0; i < n; ++i) { int x; std::cin >> x; xs.push_back(x); } while (m--) { char c; std::cin >> c; if (c == 'L') { auto f = xs.front(); xs.pop_front(); xs.front() += f; xs.push_back(0); } else { auto b = xs.back(); xs.pop_back(); xs.back() += b; xs.push_front(0); } } for (auto x : xs) std::cout << x << " "; std::cout << std::endl; } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); solve(); return 0; }