結果

問題 No.1650 Moving Coins
ユーザー 沙耶花沙耶花
提出日時 2021-08-20 21:44:03
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 350 ms / 2,000 ms
コード長 825 bytes
コンパイル時間 4,596 ms
コンパイル使用メモリ 256,352 KB
実行使用メモリ 13,392 KB
最終ジャッジ日時 2024-04-22 04:06:51
合計ジャッジ時間 15,324 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 3 ms
5,248 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 258 ms
5,580 KB
testcase_04 AC 200 ms
5,580 KB
testcase_05 AC 240 ms
5,580 KB
testcase_06 AC 266 ms
5,580 KB
testcase_07 AC 267 ms
5,708 KB
testcase_08 AC 326 ms
6,412 KB
testcase_09 AC 311 ms
6,496 KB
testcase_10 AC 288 ms
6,440 KB
testcase_11 AC 303 ms
6,332 KB
testcase_12 AC 289 ms
6,060 KB
testcase_13 AC 285 ms
6,084 KB
testcase_14 AC 291 ms
6,228 KB
testcase_15 AC 279 ms
6,084 KB
testcase_16 AC 350 ms
6,532 KB
testcase_17 AC 286 ms
6,680 KB
testcase_18 AC 305 ms
6,820 KB
testcase_19 AC 346 ms
13,392 KB
testcase_20 AC 322 ms
7,148 KB
testcase_21 AC 322 ms
10,268 KB
testcase_22 AC 319 ms
7,276 KB
testcase_23 AC 317 ms
7,148 KB
testcase_24 AC 270 ms
5,580 KB
testcase_25 AC 265 ms
5,584 KB
testcase_26 AC 49 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 1000000001

vector<int> A,B;
int N;
vector<pair<int,char>> ans;
void Right(int ind){
	A[ind]++;
	if(ind!=N-1&&A[ind]==A[ind+1]){
		Right(ind+1);
	}
	ans.emplace_back(ind+1,'R');
}

void Left(int ind){
	A[ind]--;
	if(ind!=0&&A[ind]==A[ind-1]){
		Right(ind-1);
	}
	ans.emplace_back(ind+1,'L');
}

int main(){
	
	
	cin>>N;
	
	A.resize(N);
	B.resize(N);
	rep(i,N){
		scanf("%d",&A[i]);
	}
	rep(i,N){
		scanf("%d",&B[i]);
	}
	
	rep(i,N){
		while(A[i]<B[i]){
			Right(i);
		}
		while(A[i]>B[i]){
			Left(i);
		}
	}
	
	cout<<ans.size()<<endl;
	
	rep(i,ans.size()){
		cout<<ans[i].first<<' '<<ans[i].second<<endl;
	}
	
	return 0;
}
0