結果

問題 No.1650 Moving Coins
ユーザー chocoruskchocorusk
提出日時 2021-07-17 17:48:52
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 150 ms / 2,000 ms
コード長 577 bytes
コンパイル時間 930 ms
コンパイル使用メモリ 76,260 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-22 03:24:07
合計ジャッジ時間 7,455 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 18 ms
5,376 KB
testcase_04 AC 14 ms
5,376 KB
testcase_05 AC 17 ms
5,376 KB
testcase_06 AC 19 ms
5,376 KB
testcase_07 AC 19 ms
5,376 KB
testcase_08 AC 89 ms
5,376 KB
testcase_09 AC 85 ms
5,376 KB
testcase_10 AC 91 ms
5,376 KB
testcase_11 AC 93 ms
5,376 KB
testcase_12 AC 60 ms
5,376 KB
testcase_13 AC 62 ms
5,376 KB
testcase_14 AC 84 ms
5,376 KB
testcase_15 AC 50 ms
5,376 KB
testcase_16 AC 98 ms
5,376 KB
testcase_17 AC 101 ms
5,376 KB
testcase_18 AC 113 ms
5,376 KB
testcase_19 AC 141 ms
5,376 KB
testcase_20 AC 150 ms
5,376 KB
testcase_21 AC 149 ms
5,376 KB
testcase_22 AC 148 ms
5,376 KB
testcase_23 AC 148 ms
5,376 KB
testcase_24 AC 19 ms
5,376 KB
testcase_25 AC 19 ms
5,376 KB
testcase_26 AC 129 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll=long long;
const int MAXA=1000000;
const int MAXN=200000;
const int MAXM=200000;
int a[MAXN+1], b[MAXN+1];
int main()
{
	int n;
	cin>>n;
	for(int i=0; i<n; i++) cin>>a[i];
	for(int i=0; i<n; i++) cin>>b[i];
	int m=0;
	for(int i=0; i<n; i++) m+=abs(a[i]-b[i]);
	printf("%d\n", m);
	for(int i=0; i<n; i++){
		for(int j=0; j<a[i]-b[i]; j++){
		    printf("%d L\n", i+1);
		}
	}
	for(int i=n-1; i>=0; i--){
		for(int j=0; j<b[i]-a[i]; j++){
		    printf("%d R\n", i+1);
		}
	}
    return 0;
}
0