結果

問題 No.331 CodeRunnerでやれ
ユーザー kotatsugame
提出日時 2020-03-11 03:48:28
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 365 ms / 5,000 ms
コード長 694 bytes
コンパイル時間 554 ms
コンパイル使用メモリ 65,284 KB
実行使用メモリ 25,460 KB
平均クエリ数 352.47
最終ジャッジ日時 2024-07-17 02:35:42
合計ジャッジ時間 6,348 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

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