結果

問題 No.1650 Moving Coins
ユーザー srjywrdnprktsrjywrdnprkt
提出日時 2023-06-07 23:45:28
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 382 ms / 2,000 ms
コード長 755 bytes
コンパイル時間 873 ms
コンパイル使用メモリ 107,476 KB
実行使用メモリ 4,764 KB
最終ジャッジ日時 2023-08-28 19:21:58
合計ジャッジ時間 12,197 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 255 ms
4,380 KB
testcase_04 AC 193 ms
4,380 KB
testcase_05 AC 234 ms
4,380 KB
testcase_06 AC 261 ms
4,376 KB
testcase_07 AC 268 ms
4,380 KB
testcase_08 AC 318 ms
4,376 KB
testcase_09 AC 325 ms
4,380 KB
testcase_10 AC 328 ms
4,376 KB
testcase_11 AC 333 ms
4,376 KB
testcase_12 AC 303 ms
4,376 KB
testcase_13 AC 305 ms
4,376 KB
testcase_14 AC 331 ms
4,376 KB
testcase_15 AC 300 ms
4,380 KB
testcase_16 AC 338 ms
4,376 KB
testcase_17 AC 324 ms
4,380 KB
testcase_18 AC 350 ms
4,380 KB
testcase_19 AC 382 ms
4,764 KB
testcase_20 AC 381 ms
4,740 KB
testcase_21 AC 380 ms
4,712 KB
testcase_22 AC 381 ms
4,740 KB
testcase_23 AC 380 ms
4,692 KB
testcase_24 AC 264 ms
4,376 KB
testcase_25 AC 266 ms
4,376 KB
testcase_26 AC 113 ms
4,564 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <iomanip>
#include <queue>
#include <algorithm>
#include <numeric>
#include <deque>
#include <complex>
#include <cassert>

using namespace std;
using ll = long long;

int main(){

    int N, M=0;
    cin >> N;
    vector<int> A(N), B(N);
    for (int i=0; i<N; i++) cin >> A[i];
    for (int i=0; i<N; i++){
        cin >> B[i];
        M += abs(A[i]-B[i]);
    }
    cout << M << endl;
    for (int i=N-1; i>=0; i--){
        if (A[i] < B[i]) for (int j=0; j<B[i]-A[i]; j++) cout << i+1 << " " << 'R' << endl;
    }
    for (int i=0; i<N; i++){
        if (A[i] > B[i]) for (int j=0; j<A[i]-B[i]; j++) cout << i+1 << " " << 'L' << endl;
    }

    return 0;
}
0