結果

問題 No.1650 Moving Coins
ユーザー kotatsugamekotatsugame
提出日時 2021-08-24 18:50:58
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 745 bytes
コンパイル時間 646 ms
コンパイル使用メモリ 71,728 KB
実行使用メモリ 7,148 KB
最終ジャッジ日時 2024-04-27 06:53:13
合計ジャッジ時間 8,445 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 AC 1 ms
6,944 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 99 ms
6,940 KB
testcase_09 WA -
testcase_10 AC 104 ms
6,940 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 152 ms
7,020 KB
testcase_20 AC 159 ms
7,020 KB
testcase_21 AC 160 ms
7,148 KB
testcase_22 AC 159 ms
7,076 KB
testcase_23 AC 157 ms
6,964 KB
testcase_24 AC 33 ms
6,944 KB
testcase_25 AC 33 ms
6,944 KB
testcase_26 AC 124 ms
6,940 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<vector>
using namespace std;
int N,A[2<<17],B[2<<17];
vector<pair<int,bool> >E;
main()
{
	cin>>N;
	for(int i=0;i<N;i++)cin>>A[i];
	for(int i=0;i<N;i++)cin>>B[i];
	int id=0;
	while(true)
	{
		if(A[id]<=B[id])
		{
			if(id+1==N||A[id+1]>B[id])break;
		}
		else
		{
			if(id==0||A[id-1]<B[id])break;
		}
		id++;
	}
	for(int i=id;i<N;i++)
	{
		for(int t=A[i];t>B[i];t--)E.push_back(make_pair(i+1,false));
		for(int t=A[i];t<B[i];t++)E.push_back(make_pair(i+1,true));
	}
	for(int i=id-1;i>=0;i--)
	{
		for(int t=A[i];t>B[i];t--)E.push_back(make_pair(i+1,false));
		for(int t=A[i];t<B[i];t++)E.push_back(make_pair(i+1,true));
	}
	cout<<E.size()<<endl;
	for(pair<int,bool>p:E)cout<<p.first<<" "<<(p.second?'R':'L')<<"\n";
}
0