結果

問題 No.331 CodeRunnerでやれ
ユーザー sugim48
提出日時 2015-12-24 01:11:18
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
RE  
実行時間 -
コード長 1,681 bytes
コンパイル時間 805 ms
コンパイル使用メモリ 96,868 KB
実行使用メモリ 95,172 KB
平均クエリ数 243.12
最終ジャッジ日時 2024-07-16 08:17:11
合計ジャッジ時間 12,825 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 3 RE * 10 TLE * 1 -- * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int dy[] = {0, -1, 0, 1};
int dx[] = {-1, 0, 1, 0};

string f() {
	string s; cin >> s;
	if (s == "Merry") exit(0);
	return s;
}

void dfs(int y, int x, int k, vector<vector<bool> >& vis) {
	vis[y][x] = true;
	f();
	cout << 'L' << endl; k = (k + 3) % 4;
	if (f() != "0") {
		int _y = y + dy[k], _x = x + dx[k];
		if (!vis[_y][_x]) {
			cout << 'F' << endl;
			dfs(_y, _x, k, vis);
			cout << 'B' << endl;
			f();
		}
	}
	cout << 'R' << endl; k = (k + 1) % 4;
	if (f() != "0") {
		int _y = y + dy[k], _x = x + dx[k];
		if (!vis[_y][_x]) {
			cout << 'F' << endl;
			dfs(_y, _x, k, vis);
			cout << 'B' << endl;
			f();
		}
	}
	cout << 'R' << endl; k = (k + 1) % 4;
	if (f() != "0") {
		int _y = y + dy[k], _x = x + dx[k];
		if (!vis[_y][_x]) {
			cout << 'F' << endl;
			dfs(_y, _x, k, vis);
			cout << 'B' << endl;
			f();
		}
	}
	cout << 'L' << endl; k = (k + 3) % 4;
}

int main() {
	vector<vector<bool> > vis(50, vector<bool>(50));
	for (;;) {
		dfs(25, 25, 0, vis);
		cout << 'R' << endl;
		f();
	}
}
0