結果
問題 | No.1021 Children in Classrooms |
ユーザー |
![]() |
提出日時 | 2020-04-12 08:49:10 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 35 ms / 2,000 ms |
コード長 | 703 bytes |
コンパイル時間 | 1,692 ms |
コンパイル使用メモリ | 172,604 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-22 02:03:24 |
合計ジャッジ時間 | 3,399 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
#include <bits/stdc++.h>#define rep(i,n) for(int i=(0);i<(n);i++)using namespace std;typedef long long ll;int main(){cin.tie(0);ios::sync_with_stdio(false);int n, m;cin >> n >> m;deque<ll> a;rep(i, n){ll x;cin >> x;a.push_back(x);}string s;cin >> s;rep(i, m){if(s[i] == 'L'){ll x = a.front();a.pop_front();x += a.front();a.pop_front();a.push_front(x);a.push_back(0);}else{ll x = a.back();a.pop_back();x += a.back();a.pop_back();a.push_back(x);a.push_front(0);}}int cnt = 0;for(auto itr = a.begin(); itr != a.end(); itr++){cout << *itr;cnt++;if(cnt < n) cout << " ";}cout << "\n";}