結果
問題 | No.1021 Children in Classrooms |
ユーザー |
![]() |
提出日時 | 2020-04-12 11:09:57 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 776 bytes |
コンパイル時間 | 1,816 ms |
コンパイル使用メモリ | 172,568 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-22 02:17:34 |
合計ジャッジ時間 | 4,362 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 16 RE * 1 |
ソースコード
#include <bits/stdc++.h>using namespace std;#define rep(i,n) for(int i = 0; i < (n);i++)#define sz(x) int(x.size())typedef long long ll;typedef pair<int,int> P;int main(){int n, m;cin >> n >> m;vector<int> a(n);rep(i,n) cin >> a[i];string s;cin >> s;int top = a[0], back = a[n - 1];deque<int> que;for (int i = 1; i < n - 1; i++) que.push_back(a[i]);for (int i = 0; i < m; i++) {if (s[i] == 'L') {top += que.front();que.pop_front();que.push_back(back);back = 0;} else {back += que.back();que.pop_back();que.push_front(top);top = 0;}}cout << top << " ";while (!que.empty()) cout << que.front() << " ", que.pop_front();cout << back << endl;return 0;}