結果

問題 No.1650 Moving Coins
ユーザー 👑 tatyamtatyam
提出日時 2021-08-26 14:20:10
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 148 ms / 2,000 ms
コード長 501 bytes
コンパイル時間 2,025 ms
コンパイル使用メモリ 203,516 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-29 07:32:46
合計ジャッジ時間 7,908 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 20 ms
5,376 KB
testcase_04 AC 15 ms
5,376 KB
testcase_05 AC 19 ms
5,376 KB
testcase_06 AC 20 ms
5,376 KB
testcase_07 AC 21 ms
5,376 KB
testcase_08 AC 87 ms
5,376 KB
testcase_09 AC 86 ms
5,376 KB
testcase_10 AC 91 ms
5,376 KB
testcase_11 AC 92 ms
5,376 KB
testcase_12 AC 60 ms
5,376 KB
testcase_13 AC 62 ms
5,376 KB
testcase_14 AC 83 ms
5,376 KB
testcase_15 AC 50 ms
5,376 KB
testcase_16 AC 99 ms
5,376 KB
testcase_17 AC 99 ms
5,376 KB
testcase_18 AC 113 ms
5,376 KB
testcase_19 AC 140 ms
5,376 KB
testcase_20 AC 147 ms
5,376 KB
testcase_21 AC 146 ms
5,376 KB
testcase_22 AC 148 ms
5,376 KB
testcase_23 AC 144 ms
5,376 KB
testcase_24 AC 20 ms
5,376 KB
testcase_25 AC 20 ms
5,376 KB
testcase_26 AC 125 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    int N;
    cin >> N;
    vector<int> A(N), B(N);
    for(int& a : A) cin >> a;
    for(int& b : B) cin >> b;
    cout << transform_reduce(A.begin(), A.end(), B.begin(), 0, plus{}, [](int x, int y){ return abs(x - y); }) << endl;
    for(int i = 0; i < N; i++) while(A[i] > B[i]){
        cout << i + 1 << " L\n";
        A[i]--;
    }
    for(int i = N; i--; ) while(A[i] < B[i]){
        cout << i + 1 << " R\n";
        A[i]++;
    }
}
0