結果

問題 No.1021 Children in Classrooms
ユーザー ashipanashipan
提出日時 2020-04-10 22:14:10
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 909 bytes
コンパイル時間 704 ms
コンパイル使用メモリ 76,720 KB
実行使用メモリ 10,200 KB
最終ジャッジ日時 2023-10-14 00:52:19
合計ジャッジ時間 4,625 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
8,700 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,352 KB
testcase_03 AC 7 ms
4,352 KB
testcase_04 AC 7 ms
4,352 KB
testcase_05 AC 6 ms
4,352 KB
testcase_06 AC 6 ms
4,352 KB
testcase_07 AC 9 ms
4,352 KB
testcase_08 AC 10 ms
4,348 KB
testcase_09 TLE -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0