結果

問題 No.1021 Children in Classrooms
ユーザー konchanksu
提出日時 2020-04-10 23:50:00
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 693 bytes
コンパイル時間 550 ms
コンパイル使用メモリ 65,024 KB
実行使用メモリ 9,728 KB
最終ジャッジ日時 2024-09-16 03:29:12
合計ジャッジ時間 4,363 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 6 TLE * 1 -- * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#define rep(i, n) for(int (i) = (0); (i) < (n); (i)++)
using namespace std;

int main(){
    int m, n, j;
    cin >> n >> m;
    int a[n];
    rep(i, n) cin >> a[i];
    string s;
    cin >> s;
    
    rep(i, m){
        if(s[i] == 'L'){
            a[0] += a[1];
            for(j = 1; j < n - 1; j++){
                a[j] = a[j + 1];
            }
            a[n - 1] = 0;
        }
        
        else{
            a[n - 1] += a[n - 2];
            for(j = n - 2; j > 0; j--){
                a[j] = a[j - 1];
            }
            a[0] = 0;
        }       
    }
    
    rep(i, n) cout << a[i] << ' ';
    cout << endl;
    
    return 0;
}
0