結果
問題 | No.1021 Children in Classrooms |
ユーザー |
|
提出日時 | 2020-08-08 13:19:16 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 78 ms / 2,000 ms |
コード長 | 1,145 bytes |
コンパイル時間 | 953 ms |
コンパイル使用メモリ | 99,680 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-01 14:29:45 |
合計ジャッジ時間 | 4,019 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
#include <iostream>#include <string>#include <algorithm>#include <vector>#include <iomanip>#include <cmath>#include <stdio.h>#include <queue>#include <deque>#include <cstdio>#include <set>#include <map>#include <bitset>#include <stack>#include <cctype>using namespace std;int main() {int n, m;cin >> n >> m;deque<int> que;for (int i = 0; i < n; i++) {int a;cin >> a;que.push_back(a);}string s;cin >> s;for (int j = 0; j < m; j++) {if (s[j] == 'L') {int x = que.front();que.pop_front();int y = que.front();que.pop_front();que.push_front(x + y);que.push_back(0);}else {int x = que.back();que.pop_back();int y = que.back();que.pop_back();que.push_back(x + y);que.push_front(0);}}for (int i = 0; i < n; i++) {cout << que.front();que.pop_front();if (i != n - 1) {cout << " ";}}cout << endl;return 0;}