結果

問題 No.1021 Children in Classrooms
ユーザー polyesterpolyester
提出日時 2020-04-11 15:13:08
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 83 ms / 2,000 ms
コード長 884 bytes
コンパイル時間 1,049 ms
コンパイル使用メモリ 89,208 KB
実行使用メモリ 5,440 KB
最終ジャッジ日時 2023-10-19 06:23:47
合計ジャッジ時間 3,099 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 3 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 78 ms
5,432 KB
testcase_10 AC 78 ms
5,432 KB
testcase_11 AC 78 ms
5,432 KB
testcase_12 AC 76 ms
5,432 KB
testcase_13 AC 77 ms
5,432 KB
testcase_14 AC 77 ms
5,432 KB
testcase_15 AC 59 ms
5,036 KB
testcase_16 AC 60 ms
5,052 KB
testcase_17 AC 62 ms
5,112 KB
testcase_18 AC 83 ms
5,440 KB
testcase_19 AC 9 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include<vector>
#include<functional>
#include<string>
#include<cmath>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<cstdio>
#include<numeric>
using namespace std;
using ll = long long;
int main(){
  int n, m;
  cin >> n >> m;
  deque<ll> a;
  for(int i = 0; i < n; i++){
    int tmp;
    cin >> tmp;
    a.push_back(tmp);
  }
  string s;
  cin >> s;
  for(int i = 0; i < m; i++){
    int tmp = 0;
    if(s[i] == 'L'){
      tmp += a.front();
      a.pop_front();
      tmp += a.front();
      a.pop_front();
      a.push_front(tmp);
      a.push_back(0);
    }else{
      tmp += a.back();
      a.pop_back();
      tmp += a.back();
      a.pop_back();
      a.push_back(tmp);
      a.push_front(0);
    }
  }
  for(int i = 0; i < n; i++){
    cout << a.front() << " ";
    a.pop_front();
  }
  cout << endl;
  return 0;
}
0