結果

問題 No.1650 Moving Coins
ユーザー 👑 NachiaNachia
提出日時 2021-08-20 21:43:41
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 63 ms / 2,000 ms
コード長 868 bytes
コンパイル時間 887 ms
コンパイル使用メモリ 80,908 KB
実行使用メモリ 6,768 KB
最終ジャッジ日時 2023-08-04 05:55:52
合計ジャッジ時間 6,146 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 24 ms
5,124 KB
testcase_04 AC 19 ms
5,104 KB
testcase_05 AC 22 ms
5,160 KB
testcase_06 AC 25 ms
5,072 KB
testcase_07 AC 25 ms
5,072 KB
testcase_08 AC 44 ms
6,000 KB
testcase_09 AC 45 ms
5,864 KB
testcase_10 AC 46 ms
5,936 KB
testcase_11 AC 47 ms
5,984 KB
testcase_12 AC 38 ms
5,640 KB
testcase_13 AC 38 ms
5,672 KB
testcase_14 AC 44 ms
5,824 KB
testcase_15 AC 34 ms
5,540 KB
testcase_16 AC 48 ms
6,012 KB
testcase_17 AC 47 ms
6,080 KB
testcase_18 AC 52 ms
6,304 KB
testcase_19 AC 60 ms
6,760 KB
testcase_20 AC 63 ms
6,648 KB
testcase_21 AC 62 ms
6,768 KB
testcase_22 AC 62 ms
6,644 KB
testcase_23 AC 61 ms
6,724 KB
testcase_24 AC 25 ms
5,108 KB
testcase_25 AC 24 ms
5,072 KB
testcase_26 AC 37 ms
4,808 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
#define rep(i,n) for(int i=0; i<(n); i++)

int N;
vector<int> A;
vector<int> B;
vector<pair<int,char>> ans;

int main(){
  cin >> N;
  A.resize(N);
  rep(i,N) cin >> A[i];
  B.resize(N);
  rep(i,N) cin >> B[i];

  rep(i,N) if(A[i] > B[i]){
    while(A[i] != B[i]){
      ans.push_back({i,'L'});
      A[i]--;
    }
  }
  for(int i=N-1; i>=0; i--) if(A[i] < B[i]){
    while(A[i] != B[i]){
      ans.push_back({i,'R'});
      A[i]++;
    }
  }

  cout << ans.size() << "\n";
  for(auto a : ans){
    cout << (a.first+1) << " " << a.second << "\n";
  }
  return 0;
}


struct ios_do_not_sync{
  ios_do_not_sync(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
  }
} ios_do_not_sync_instance;


0