結果
問題 | No.1021 Children in Classrooms |
ユーザー |
|
提出日時 | 2020-04-10 21:38:28 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 82 ms / 2,000 ms |
コード長 | 1,060 bytes |
コンパイル時間 | 1,648 ms |
コンパイル使用メモリ | 171,732 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-15 19:33:01 |
合計ジャッジ時間 | 3,632 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge6 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
#include <bits/stdc++.h> #define rep(i,n) for(int i=0;i<n;i++) using namespace std; using ll = long long ; using P = pair<int,int> ; const int INF = 1e9; const int MOD = 1000000007; int main(){ int n,m; cin >> n >> m; deque<int> a(n); rep(i,n) cin >> a[i]; string s; cin >> s; int l=0,r=0; rep(i,m){ if(s[i] =='L'){ if(l==0){ if(a.size() == 1) continue; else{ a[1] += a[0]; a.pop_front(); r++; } }else{ --l;++r; } }else{ if(r==0){ if(a.size() == 1) continue; else{ a[a.size()-2] += a[a.size()-1]; a.pop_back(); ++l; } }else{ --r;++l; } } } rep(i,l) cout << 0 << " " ; rep(i,a.size()) cout << a[i] << " "; rep(i,r) cout << 0 << " " ; cout << endl; return 0; }