結果
| 問題 |
No.1021 Children in Classrooms
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-06-19 00:02:17 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,251 bytes |
| コンパイル時間 | 2,239 ms |
| コンパイル使用メモリ | 195,492 KB |
| 最終ジャッジ日時 | 2025-01-11 05:18:07 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 11 WA * 4 RE * 2 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using ll = long long int;
using lc = complex<double>;
int main(void) {
constexpr ll MOD = 1e9 + 7;
constexpr double PI = acos(-1);
cout << fixed << setprecision(32);
cin.tie(0); ios::sync_with_stdio(false);
ll n, m;
cin >> n >> m;
vector<ll> a(n);
for(auto &e: a) cin >> e;
string s;
cin >> s;
ll i = 0, j = 0, l = 0, r = n-1;
for(auto &c: s) {
switch(c) {
case 'L':
if(++j, --i < 0) {
if(j == n) {
j = n-1;
continue;
}
++l;
a[l] += a[l-1];
i = 0;
}
break;
case 'R':
if(++i, --j < 0) {
if(i == n) {
i = n-1;
continue;
}
--r;
a[r] += a[r+1];
j = 0;
}
break;
}
}
for(ll k=0; k<i; k++) cout << 0 << ' ';
for(ll k=l; k<=r; k++) cout << a[k] << ' ';
for(ll k=0; k<j; k++) cout << 0 << ' ';
cout << endl;
}