結果

問題 No.1650 Moving Coins
ユーザー chocoruskchocorusk
提出日時 2021-07-17 17:48:52
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 134 ms / 2,000 ms
コード長 577 bytes
コンパイル時間 1,532 ms
コンパイル使用メモリ 74,104 KB
実行使用メモリ 5,200 KB
最終ジャッジ日時 2023-08-04 05:06:34
合計ジャッジ時間 10,742 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 17 ms
4,376 KB
testcase_04 AC 13 ms
4,380 KB
testcase_05 AC 16 ms
4,384 KB
testcase_06 AC 17 ms
4,376 KB
testcase_07 AC 17 ms
4,380 KB
testcase_08 AC 79 ms
4,376 KB
testcase_09 AC 76 ms
4,380 KB
testcase_10 AC 82 ms
4,376 KB
testcase_11 AC 83 ms
4,380 KB
testcase_12 AC 54 ms
4,376 KB
testcase_13 AC 55 ms
4,380 KB
testcase_14 AC 74 ms
4,376 KB
testcase_15 AC 44 ms
4,376 KB
testcase_16 AC 89 ms
4,384 KB
testcase_17 AC 90 ms
4,600 KB
testcase_18 AC 99 ms
4,620 KB
testcase_19 AC 126 ms
5,200 KB
testcase_20 AC 134 ms
5,028 KB
testcase_21 AC 132 ms
5,120 KB
testcase_22 AC 132 ms
5,008 KB
testcase_23 AC 131 ms
4,988 KB
testcase_24 AC 17 ms
4,380 KB
testcase_25 AC 17 ms
4,376 KB
testcase_26 AC 113 ms
5,036 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