結果

問題 No.1650 Moving Coins
ユーザー V_Melville
提出日時 2021-08-20 23:08:36
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 577 bytes
コンパイル時間 2,057 ms
コンパイル使用メモリ 193,488 KB
最終ジャッジ日時 2025-01-24 00:26:56
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 1 WA * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)

using std::cin;
using std::cout;
using std::vector;

int main() {
	int n;
	cin >> n;
	
	vector<int> a(n), b(n);
	rep(i, n) cin >> a[i];
	rep(i, n) cin >> b[i];
	
	int cnt = 0;
	for (int i = n - 1; i >= 0; --i) {
		int p = i + 1;
		int d = a[i] - b[i];
		if (!d) {
		    cnt++;
		    continue;
		}
		else if (d > 0) {
			while (d--) {
				cout << p << " " << "L\n";
				p--;
			}
		}
		else {
			while (d++) {
				cout << p << " " << "R\n";
				p++;
			}
		}
	}
	
	if (cnt == n) puts("0");
	
	return 0;
}
0