結果

問題 No.1650 Moving Coins
ユーザー sigma425sigma425
提出日時 2021-08-20 21:46:09
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 308 ms / 2,000 ms
コード長 2,332 bytes
コンパイル時間 2,183 ms
コンパイル使用メモリ 199,924 KB
実行使用メモリ 6,268 KB
最終ジャッジ日時 2024-04-22 04:10:37
合計ジャッジ時間 12,368 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 254 ms
5,376 KB
testcase_04 AC 190 ms
5,376 KB
testcase_05 AC 244 ms
5,376 KB
testcase_06 AC 259 ms
5,376 KB
testcase_07 AC 264 ms
5,376 KB
testcase_08 AC 276 ms
5,404 KB
testcase_09 AC 284 ms
5,620 KB
testcase_10 AC 286 ms
5,564 KB
testcase_11 AC 283 ms
5,580 KB
testcase_12 AC 275 ms
5,376 KB
testcase_13 AC 281 ms
5,376 KB
testcase_14 AC 287 ms
5,464 KB
testcase_15 AC 274 ms
5,376 KB
testcase_16 AC 288 ms
5,656 KB
testcase_17 AC 274 ms
5,808 KB
testcase_18 AC 292 ms
5,684 KB
testcase_19 AC 308 ms
6,140 KB
testcase_20 AC 306 ms
6,144 KB
testcase_21 AC 305 ms
6,140 KB
testcase_22 AC 299 ms
6,268 KB
testcase_23 AC 308 ms
6,268 KB
testcase_24 AC 266 ms
5,376 KB
testcase_25 AC 265 ms
5,376 KB
testcase_26 AC 43 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using uint = unsigned int;
using ull = unsigned long long;
#define rep(i,n) for(int i=0;i<int(n);i++)
#define rep1(i,n) for(int i=1;i<=int(n);i++)
#define per(i,n) for(int i=int(n)-1;i>=0;i--)
#define per1(i,n) for(int i=int(n);i>0;i--)
#define all(c) c.begin(),c.end()
#define si(x) int(x.size())
#define pb emplace_back
#define fs first
#define sc second
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
template<class T,class U> void chmax(T& x, U y){if(x<y) x=y;}
template<class T,class U> void chmin(T& x, U y){if(y<x) x=y;}
template<class T> void mkuni(V<T>& v){sort(all(v));v.erase(unique(all(v)),v.end());}
template<class T> int lwb(const V<T>& v, const T& a){return lower_bound(all(v),a) - v.begin();}
template<class T>
V<T> Vec(size_t a) {
    return V<T>(a);
}
template<class T, class... Ts>
auto Vec(size_t a, Ts... ts) {
  return V<decltype(Vec<T>(ts...))>(a, Vec<T>(ts...));
}
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

#ifdef LOCAL
#define show(x) cerr << "LINE" << __LINE__ << " : " << #x << " = " << (x) << endl
void dmpr(ostream& os){os<<endl;}
template<class T,class... Args>
void dmpr(ostream&os,const T&t,const Args&... args){
	os<<t<<" ~ ";
	dmpr(os,args...);
}
#define shows(...) cerr << "LINE" << __LINE__ << " : ";dmpr(cerr,##__VA_ARGS__)
#define dump(x) cerr << "LINE" << __LINE__ << " : " << #x << " = {";  \
	for(auto v: x) cerr << v << ","; cerr << "}" << endl;
#else
#define show(x) void(0)
#define dump(x) void(0)
#define shows(...) void(0)
#endif

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);		//DON'T USE scanf/printf/puts !!
	cout << fixed << setprecision(20);

	int N; cin >> N;
	V<int> a(N); rep(i,N) cin >> a[i];
	V<int> b(N); rep(i,N) cin >> b[i];
	V<int> ans; string dir;
	rep(i,N) if(a[i] > b[i]){
		rep(j,a[i]-b[i]) ans.pb(i), dir += 'L';
	}
	per(i,N) if(a[i] < b[i]){
		rep(j,b[i]-a[i]) ans.pb(i), dir += 'R';
	}
	cout << si(ans) << endl;
	rep(i,si(ans)) cout << ans[i]+1 << " " << dir[i] << endl;
}
0