結果

問題 No.1650 Moving Coins
ユーザー Nzt3Nzt3
提出日時 2022-10-10 02:54:05
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 56 ms / 2,000 ms
コード長 536 bytes
コンパイル時間 2,270 ms
コンパイル使用メモリ 203,884 KB
実行使用メモリ 6,872 KB
最終ジャッジ日時 2023-09-06 04:47:05
合計ジャッジ時間 10,318 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,384 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 18 ms
5,224 KB
testcase_04 AC 14 ms
5,104 KB
testcase_05 AC 17 ms
5,016 KB
testcase_06 AC 18 ms
5,076 KB
testcase_07 AC 19 ms
5,316 KB
testcase_08 AC 38 ms
5,908 KB
testcase_09 AC 37 ms
5,936 KB
testcase_10 AC 39 ms
5,896 KB
testcase_11 AC 39 ms
5,972 KB
testcase_12 AC 31 ms
5,492 KB
testcase_13 AC 30 ms
5,636 KB
testcase_14 AC 37 ms
5,848 KB
testcase_15 AC 28 ms
5,440 KB
testcase_16 AC 41 ms
5,988 KB
testcase_17 AC 41 ms
6,080 KB
testcase_18 AC 45 ms
6,320 KB
testcase_19 AC 54 ms
6,596 KB
testcase_20 AC 56 ms
6,804 KB
testcase_21 AC 56 ms
6,872 KB
testcase_22 AC 55 ms
6,776 KB
testcase_23 AC 55 ms
6,652 KB
testcase_24 AC 19 ms
5,076 KB
testcase_25 AC 18 ms
5,012 KB
testcase_26 AC 37 ms
4,624 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  cin>>N;
  vector<int>A(N),B(N);
  for(int &i:A)cin>>i;
  for(int &i:B)cin>>i;
  vector<pair<int,char>>ans;
  for(int i=0;i<N;i++){
    if(A[i]>B[i]){
      for(int j=0;j<A[i]-B[i];j++)ans.push_back({i+1,'L'});
    }
  }
  for(int i=N-1;i>=0;i--){
    if(A[i]<B[i]){
      for(int j=0;j<B[i]-A[i];j++)ans.push_back({i+1,'R'});
    }
  }
  cout<<ans.size()<<'\n';
  for(auto i:ans)cout<<i.first<<' '<<i.second<<'\n';
}
0