結果
問題 |
No.1021 Children in Classrooms
|
ユーザー |
![]() |
提出日時 | 2020-04-10 22:14:10 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 909 bytes |
コンパイル時間 | 694 ms |
コンパイル使用メモリ | 77,344 KB |
実行使用メモリ | 11,392 KB |
最終ジャッジ日時 | 2024-09-15 20:38:55 |
合計ジャッジ時間 | 4,555 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 6 TLE * 1 -- * 10 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> #include <queue> #include <set> #define rep(i, a, n) for(int i = a; i < n; i++) using namespace std; using ll = long long; using P = pair<int, int>; int main() { int n, m; cin >> n >> m; vector<int> a(n); rep(i, 0, n){ cin >> a[i]; } string s; cin >> s; vector<int> count(n, 0); vector<int> ans(n, 0); int state; rep(i, 0, n){ state = i; rep(j, 0, m){ if(s[j] == 'L'){ if(state == 0) continue; else state--; } else{ if(state == n-1) continue; else state++; } } count[i] = state; //cout << count[i] << endl; ans[count[i]] += a[i]; } rep(i, 0, n){ cout << ans[i] << " "; } cout << endl; return 0; }