結果

問題 No.232 めぐるはめぐる (2)
ユーザー kotatsugamekotatsugame
提出日時 2019-10-12 07:30:36
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 672 bytes
コンパイル時間 776 ms
コンパイル使用メモリ 64,576 KB
実行使用メモリ 4,388 KB
最終ジャッジ日時 2023-08-18 04:04:44
合計ジャッジ時間 5,341 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
4,376 KB
testcase_01 AC 130 ms
4,376 KB
testcase_02 WA -
testcase_03 AC 130 ms
4,380 KB
testcase_04 AC 1 ms
4,384 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 WA -
testcase_09 AC 1 ms
4,376 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 1 ms
4,380 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 1 ms
4,376 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 1 ms
4,380 KB
testcase_22 WA -
testcase_23 AC 2 ms
4,384 KB
testcase_24 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:5:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-Wreturn-type]
    5 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
using namespace std;
int T,A,B;
int X[1<<17],Y[1<<17];
main()
{
	cin>>T>>A>>B;
	if(T<A||T<B)
	{
		cout<<"NO"<<endl;
		return 0;
	}
	for(int i=0;i<T;i++)
	{
		if(i<A)
		{
			X[i]+=1;
		}
		else
		{
			if(i+1<T)
			{
				X[i]+=1;
				X[i+1]+=2;
				i+=1;
			}
		}
	}
	for(int i=0;i<T;i++)
	{
		int j=T-i-1;
		if(i<B)
		{
			Y[j]+=1;
		}
		else
		{
			if(i+1<T)
			{
				Y[j]+=1;
				Y[j-1]+=2;
				i+=1;
			}
		}
	}
	bool flag=true;
	for(int i=0;i<T;i++)flag&=X[i]&&Y[i];
	if(!flag)
	{
		cout<<"NO"<<endl;
		return 0;
	}
	cout<<"YES"<<endl;
	for(int i=0;i<T;i++)
	{
		if(X[i])cout<<(X[i]==1?'^':'v');
		if(Y[i])cout<<(Y[i]==1?'>':'<');
		cout<<endl;
	}
}
0