結果

問題 No.1650 Moving Coins
ユーザー 👑 ygussanyygussany
提出日時 2021-08-20 21:48:02
言語 C
(gcc 12.3.0)
結果
TLE  
実行時間 -
コード長 538 bytes
コンパイル時間 160 ms
コンパイル使用メモリ 30,848 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-04-22 04:13:19
合計ジャッジ時間 6,714 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
10,624 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 18 ms
5,376 KB
testcase_04 AC 14 ms
5,376 KB
testcase_05 AC 16 ms
5,376 KB
testcase_06 AC 18 ms
5,376 KB
testcase_07 AC 19 ms
5,376 KB
testcase_08 AC 44 ms
5,376 KB
testcase_09 AC 48 ms
5,376 KB
testcase_10 AC 46 ms
5,376 KB
testcase_11 AC 47 ms
5,376 KB
testcase_12 AC 35 ms
5,376 KB
testcase_13 AC 36 ms
5,376 KB
testcase_14 AC 43 ms
5,376 KB
testcase_15 AC 31 ms
5,376 KB
testcase_16 AC 49 ms
5,376 KB
testcase_17 AC 49 ms
5,376 KB
testcase_18 AC 54 ms
5,376 KB
testcase_19 TLE -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <stdlib.h>

int main()
{
	int i, j, N, A[200001], B[200001], ans = 0;
	scanf("%d", &N);
	for (i = 1; i <= N; i++) scanf("%d", &(A[i]));
	for (i = 1; i <= N; i++) scanf("%d", &(B[i]));
	for (i = 1; i <= N; i++) ans += abs(A[i] - B[i]);
	printf("%d\n", ans);
	for (i = 1; i <= N; i++) {
		while (A[i] != B[i]) {
			if (A[i] > B[i]) {
				printf("%d L\n", i);
				A[i]--;
			} else {
				for (j = i; j < N && A[j] == A[j+1] - 1; j++);
				printf("%d R\n", j);
				A[j]++;
			}
		}
	}
	fflush(stdout);
	return 0;
}
0