結果

問題 No.1650 Moving Coins
ユーザー reg7777reg7777
提出日時 2021-08-20 21:53:04
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 66 ms / 2,000 ms
コード長 891 bytes
コンパイル時間 1,705 ms
コンパイル使用メモリ 171,184 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2023-08-04 06:16:26
合計ジャッジ時間 6,865 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,384 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 18 ms
4,380 KB
testcase_04 AC 14 ms
4,384 KB
testcase_05 AC 17 ms
4,380 KB
testcase_06 AC 19 ms
4,380 KB
testcase_07 AC 19 ms
4,384 KB
testcase_08 AC 45 ms
4,680 KB
testcase_09 AC 44 ms
4,608 KB
testcase_10 AC 46 ms
4,880 KB
testcase_11 AC 46 ms
4,836 KB
testcase_12 AC 35 ms
4,384 KB
testcase_13 AC 36 ms
4,384 KB
testcase_14 AC 43 ms
4,572 KB
testcase_15 AC 31 ms
4,380 KB
testcase_16 AC 49 ms
4,820 KB
testcase_17 AC 48 ms
4,816 KB
testcase_18 AC 53 ms
5,160 KB
testcase_19 AC 64 ms
6,156 KB
testcase_20 AC 65 ms
6,136 KB
testcase_21 AC 66 ms
6,260 KB
testcase_22 AC 65 ms
6,272 KB
testcase_23 AC 66 ms
6,272 KB
testcase_24 AC 19 ms
4,384 KB
testcase_25 AC 18 ms
4,384 KB
testcase_26 AC 47 ms
6,140 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h> 

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD1 1000000007
#define MOD2 998244353
#define MOD MOD1
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()
#define endl "\n"
#define int ll

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);

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

    return 0;
}
0