結果
| 問題 |
No.1021 Children in Classrooms
|
| コンテスト | |
| ユーザー |
veqcc
|
| 提出日時 | 2020-04-10 23:36:10 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 33 ms / 2,000 ms |
| コード長 | 1,180 bytes |
| コンパイル時間 | 1,169 ms |
| コンパイル使用メモリ | 109,656 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-16 03:01:50 |
| 合計ジャッジ時間 | 3,633 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 |
ソースコード
#include <functional>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;
int main() {
cin.sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n, m;
cin >> n >> m;
deque<int> d;
for (int i = 0; i < n; i++) {
int a;
cin >> a;
d.push_back(a);
}
string s;
cin >> s;
for (int i = 0; i< m; i++) {
if (s[i] == 'L') {
int a = d.front();
d.pop_front();
int b = d.front();
d.pop_front();
d.push_front(a + b);
d.push_back(0);
} else {
int a = d.back();
d.pop_back();
int b = d.back();
d.pop_back();
d.push_back(a + b);
d.push_front(0);
}
}
for (int i = 0; i < n; i++) {
int x = d.front();
d.pop_front();
cout << x << ' ';
}
cout << endl;
return 0;
}
veqcc