結果

問題 No.1650 Moving Coins
ユーザー erbowlerbowl
提出日時 2022-08-29 22:06:19
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 407 ms / 2,000 ms
コード長 762 bytes
コンパイル時間 2,030 ms
コンパイル使用メモリ 199,480 KB
実行使用メモリ 10,756 KB
最終ジャッジ日時 2024-04-24 11:28:27
合計ジャッジ時間 13,069 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,248 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 237 ms
7,500 KB
testcase_04 AC 186 ms
7,504 KB
testcase_05 AC 230 ms
7,496 KB
testcase_06 AC 243 ms
7,628 KB
testcase_07 AC 241 ms
7,504 KB
testcase_08 AC 301 ms
9,160 KB
testcase_09 AC 302 ms
8,956 KB
testcase_10 AC 319 ms
9,104 KB
testcase_11 AC 332 ms
9,252 KB
testcase_12 AC 287 ms
8,456 KB
testcase_13 AC 311 ms
8,628 KB
testcase_14 AC 307 ms
9,024 KB
testcase_15 AC 291 ms
8,256 KB
testcase_16 AC 340 ms
9,528 KB
testcase_17 AC 328 ms
9,452 KB
testcase_18 AC 346 ms
9,616 KB
testcase_19 AC 372 ms
10,500 KB
testcase_20 AC 388 ms
10,628 KB
testcase_21 AC 389 ms
10,756 KB
testcase_22 AC 407 ms
10,632 KB
testcase_23 AC 383 ms
10,644 KB
testcase_24 AC 261 ms
7,500 KB
testcase_25 AC 260 ms
7,500 KB
testcase_26 AC 126 ms
6,400 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

typedef long long ll;
typedef long double ld;
#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main(){
    ll n;
    std::cin >> n;
    vector<ll> a(n),b(n);
    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
    }
    for (int i = 0; i < n; i++) {
        std::cin >> b[i];
    }
    vector<pair<ll,char>> ans;
    for (int i = 0; i < n; i++) {
        while(a[i]>b[i]){
            ans.push_back({i, 'L'});
            a[i]--;
        }
    }
    for (int i = n-1; i >= 0; i--) {
        while(a[i]<b[i]){
            ans.push_back({i, 'R'});
            a[i]++;
        }
    }
    std::cout << ans.size() << std::endl;
    for (auto e : ans) {
        auto [c,d] = e;
        std::cout << c+1<<" "<<d << std::endl;
    }
}
0