結果
| 問題 | No.1021 Children in Classrooms |
| コンテスト | |
| ユーザー |
catupper
|
| 提出日時 | 2020-04-10 22:03:59 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 79 ms / 2,000 ms |
| コード長 | 1,061 bytes |
| コンパイル時間 | 1,452 ms |
| コンパイル使用メモリ | 72,564 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-15 20:24:20 |
| 合計ジャッジ時間 | 3,946 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 |
ソースコード
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cassert>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
using namespace std;
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;
int n, m;
string s;
int a[220000];
int main(){
cin >> n >> m;
for(int i = 0;i < n;i++)cin >> a[i];
int l = 0, r = n-1;
cin >> s;
for(char c:s){
if(c == 'R'){
if(r == 0)continue;
if(0 <= r-1 && r < n){
a[r-1] += a[r];
a[r] = 0;
}
l--,r--;
}
else{
if(l == n-1)continue;
if(0 <= l && l+1 < n){
a[l+1] += a[l];
a[l] = 0;
}
l++,r++;
}
}
for(int i = l;i <= r;i++){
if(0 <= i && i < n)cout << a[i] << " ";
else cout << 0 << " ";
}cout << endl;
return 0;
}
catupper