結果

問題 No.331 CodeRunnerでやれ
ユーザー kotatsugame
提出日時 2020-03-11 03:46:05
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 689 bytes
コンパイル時間 578 ms
コンパイル使用メモリ 65,712 KB
実行使用メモリ 25,604 KB
平均クエリ数 2891.24
最終ジャッジ日時 2024-07-16 20:36:51
合計ジャッジ時間 9,533 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 6 WA * 8 RE * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

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