結果

問題 No.1650 Moving Coins
ユーザー publflpublfl
提出日時 2021-08-20 21:58:42
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 75 ms / 2,000 ms
コード長 590 bytes
コンパイル時間 360 ms
コンパイル使用メモリ 50,304 KB
実行使用メモリ 7,140 KB
最終ジャッジ日時 2024-04-22 04:31:03
合計ジャッジ時間 5,412 ms
ジャッジサーバーID
(参考情報)
judge5 / 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 26 ms
5,592 KB
testcase_04 AC 21 ms
5,848 KB
testcase_05 AC 25 ms
5,592 KB
testcase_06 AC 28 ms
5,572 KB
testcase_07 AC 28 ms
5,588 KB
testcase_08 AC 52 ms
6,416 KB
testcase_09 AC 52 ms
6,380 KB
testcase_10 AC 54 ms
6,392 KB
testcase_11 AC 54 ms
6,460 KB
testcase_12 AC 43 ms
6,060 KB
testcase_13 AC 43 ms
6,084 KB
testcase_14 AC 51 ms
6,340 KB
testcase_15 AC 39 ms
5,852 KB
testcase_16 AC 56 ms
6,536 KB
testcase_17 AC 55 ms
6,564 KB
testcase_18 AC 61 ms
6,696 KB
testcase_19 AC 74 ms
7,012 KB
testcase_20 AC 75 ms
7,012 KB
testcase_21 AC 75 ms
7,012 KB
testcase_22 AC 74 ms
7,140 KB
testcase_23 AC 74 ms
7,140 KB
testcase_24 AC 27 ms
6,940 KB
testcase_25 AC 27 ms
6,944 KB
testcase_26 AC 48 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <vector>

std::vector< std::pair<int,char> > ans;
int x[200010],y[200010];

int main()
{
	int a;
	scanf("%d",&a);
	for(int i=1;i<=a;i++) scanf("%d",&x[i]);
	for(int i=1;i<=a;i++) scanf("%d",&y[i]);
	
	for(int i=1;i<=a;i++)
	{
		if(y[i]<x[i])
		{
			int t = x[i]-y[i];
			while(t--) ans.push_back(std::make_pair(i,'L'));
		}
	}
	for(int i=a;i>=1;i--)
	{
		if(y[i]>x[i])
		{
			int t = y[i]-x[i];
			while(t--) ans.push_back(std::make_pair(i,'R'));
		}
	}
	
	printf("%d\n",ans.size());
	for(int i=0;i<ans.size();i++) printf("%d %c\n",ans[i].first,ans[i].second);
}
0