結果

問題 No.1650 Moving Coins
ユーザー abc3abc3
提出日時 2021-08-21 01:41:04
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 310 ms / 2,000 ms
コード長 1,282 bytes
コンパイル時間 2,636 ms
コンパイル使用メモリ 200,608 KB
実行使用メモリ 7,044 KB
最終ジャッジ日時 2024-04-22 11:11:53
合計ジャッジ時間 12,733 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 252 ms
6,940 KB
testcase_04 AC 192 ms
6,944 KB
testcase_05 AC 233 ms
6,940 KB
testcase_06 AC 266 ms
6,940 KB
testcase_07 AC 261 ms
6,940 KB
testcase_08 AC 279 ms
6,940 KB
testcase_09 AC 286 ms
6,940 KB
testcase_10 AC 285 ms
6,944 KB
testcase_11 AC 285 ms
6,940 KB
testcase_12 AC 274 ms
6,940 KB
testcase_13 AC 280 ms
6,944 KB
testcase_14 AC 288 ms
6,944 KB
testcase_15 AC 272 ms
6,940 KB
testcase_16 AC 290 ms
6,944 KB
testcase_17 AC 274 ms
6,940 KB
testcase_18 AC 293 ms
6,944 KB
testcase_19 AC 305 ms
6,948 KB
testcase_20 AC 305 ms
7,044 KB
testcase_21 AC 310 ms
6,944 KB
testcase_22 AC 310 ms
6,944 KB
testcase_23 AC 308 ms
6,944 KB
testcase_24 AC 262 ms
6,940 KB
testcase_25 AC 272 ms
6,940 KB
testcase_26 AC 43 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

    #include <bits/stdc++.h>
    using namespace std;
    #include <math.h>
    #include <iomanip>
    #include <cstdint>
    #include <string>
    #include <sstream>
    template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
    template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
    #define rep(i,n) for (int i = 0; i < (n); ++i)
    typedef long long ll;
    using P=pair<ll,ll>;
    const int INF=1001001001;
    const int mod=1e9+7;

    void solve(){
        int n;
        cin>>n;
        vector<int>a(n+1),b(n+1);
        for(int i=1;i<=n;i++) cin>>a[i];
        for(int i=1;i<=n;i++) cin>>b[i];
        
        vector<pair<int,char>>ans;
        for(int i=n;i>=1;i--){
            while(b[i]-a[i]>0){
                ans.emplace_back(i,'R');
                a[i]++;
            }
        }
        for(int i=1;i<=n;i++){
            while(a[i]-b[i]>0){
                ans.emplace_back(i,'L');
                a[i]--;
            }
        }
        cout<<ans.size()<<endl;
        for(auto u:ans){
            cout<<u.first<<" "<<u.second<<endl;
        }
    }  

    int main(){
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);

        solve();   

        return 0;
    }
0