結果

問題 No.1021 Children in Classrooms
ユーザー konchanksukonchanksu
提出日時 2020-04-10 23:50:00
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 693 bytes
コンパイル時間 537 ms
コンパイル使用メモリ 65,908 KB
実行使用メモリ 8,700 KB
最終ジャッジ日時 2023-10-14 08:22:28
合計ジャッジ時間 4,489 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
8,700 KB
testcase_01 AC 2 ms
4,352 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,352 KB
testcase_04 AC 3 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,352 KB
testcase_07 AC 3 ms
4,348 KB
testcase_08 AC 2 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 <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