結果

問題 No.1650 Moving Coins
ユーザー risujirohrisujiroh
提出日時 2021-08-20 22:27:02
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 61 ms / 2,000 ms
コード長 674 bytes
コンパイル時間 2,162 ms
コンパイル使用メモリ 199,228 KB
実行使用メモリ 7,048 KB
最終ジャッジ日時 2024-04-22 05:12:14
合計ジャッジ時間 6,967 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 17 ms
5,476 KB
testcase_04 AC 14 ms
5,376 KB
testcase_05 AC 16 ms
5,468 KB
testcase_06 AC 18 ms
5,376 KB
testcase_07 AC 18 ms
5,376 KB
testcase_08 AC 40 ms
6,176 KB
testcase_09 AC 40 ms
6,140 KB
testcase_10 AC 43 ms
6,216 KB
testcase_11 AC 42 ms
6,344 KB
testcase_12 AC 31 ms
5,956 KB
testcase_13 AC 32 ms
5,904 KB
testcase_14 AC 39 ms
6,240 KB
testcase_15 AC 28 ms
5,852 KB
testcase_16 AC 44 ms
6,296 KB
testcase_17 AC 44 ms
6,320 KB
testcase_18 AC 48 ms
6,328 KB
testcase_19 AC 58 ms
6,920 KB
testcase_20 AC 61 ms
6,912 KB
testcase_21 AC 60 ms
7,048 KB
testcase_22 AC 61 ms
6,916 KB
testcase_23 AC 59 ms
6,916 KB
testcase_24 AC 18 ms
5,376 KB
testcase_25 AC 18 ms
5,472 KB
testcase_26 AC 42 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
  cin.tie(nullptr)->sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> a(n), b(n);
  for (auto&& e : a) cin >> e;
  for (auto&& e : b) cin >> e;

  vector<pair<int, char>> ans;

  for (int i = 0; i < n; ++i) {
    if (b[i] < a[i]) {
      for (int _ = a[i] - b[i]; _--;) {
        ans.emplace_back(i, 'L');
      }
    }
  }

  for (int i = n; i--;) {
    if (a[i] < b[i]) {
      for (int _ = b[i] - a[i]; _--;) {
        ans.emplace_back(i, 'R');
      }
    }
  }

  cout << size(ans) << '\n';
  for (auto&& [i, c] : ans) {
    cout << i + 1 << ' ' << c << '\n';
  }
}
0