結果

問題 No.331 CodeRunnerでやれ
ユーザー kotatsugamekotatsugame
提出日時 2020-03-11 03:48:28
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 337 ms / 5,000 ms
コード長 694 bytes
コンパイル時間 567 ms
コンパイル使用メモリ 65,120 KB
実行使用メモリ 24,036 KB
平均クエリ数 352.47
最終ジャッジ日時 2023-09-24 02:32:11
合計ジャッジ時間 6,148 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 146 ms
23,400 KB
testcase_01 AC 133 ms
23,844 KB
testcase_02 AC 158 ms
23,572 KB
testcase_03 AC 263 ms
23,668 KB
testcase_04 AC 154 ms
23,544 KB
testcase_05 AC 164 ms
23,652 KB
testcase_06 AC 325 ms
23,424 KB
testcase_07 AC 171 ms
23,392 KB
testcase_08 AC 337 ms
23,548 KB
testcase_09 AC 200 ms
23,560 KB
testcase_10 AC 256 ms
23,692 KB
testcase_11 AC 230 ms
23,548 KB
testcase_12 AC 222 ms
23,832 KB
testcase_13 AC 220 ms
23,436 KB
testcase_14 AC 262 ms
24,036 KB
testcase_15 AC 218 ms
23,848 KB
testcase_16 AC 326 ms
23,680 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
using namespace std;
int dx[4]={1,0,-1,0};
int dy[4]={0,-1,0,1};
bool vis[50][50];
void ending()
{
	while(true)
	{
		cout<<"F"<<endl;
		string s;
		cin>>s;
		if(s=="Merry")cin>>s,exit(0);
	}
}
void dfs(int x,int y,int r)
{
	int t;cin>>t;
	vis[x][y]=true;
	if(t==20151224)ending();
	if(t>0)
	{
		int tx=x+dx[r],ty=y+dy[r],tr=r;
		if(!vis[tx][ty])
		{
			cout<<"F"<<endl;
			dfs(tx,ty,tr);
		}
	}
	for(int nr=1;nr<=4;nr++)
	{
		int tr=(r+nr)%4;
		cout<<"R"<<endl;
		cin>>t;
		if(t==20151224)ending();
		if(t>0&&!vis[x+dx[tr]][y+dy[tr]])
		{
			cout<<"F"<<endl;
			dfs(x+dx[tr],y+dy[tr],tr);
		}
	}
	cout<<"B"<<endl;
	cin>>t;
}
main()
{
	int nx=25,ny=25,nr=0;
	dfs(nx,ny,nr);
}
0