結果

問題 No.331 CodeRunnerでやれ
ユーザー sugim48sugim48
提出日時 2015-12-24 01:05:39
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 1,642 bytes
コンパイル時間 875 ms
コンパイル使用メモリ 94,088 KB
実行使用メモリ 24,424 KB
平均クエリ数 635.24
最終ジャッジ日時 2023-09-23 08:27:48
合計ジャッジ時間 8,155 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 157 ms
23,676 KB
testcase_01 AC 157 ms
23,604 KB
testcase_02 AC 179 ms
24,076 KB
testcase_03 AC 210 ms
23,404 KB
testcase_04 AC 186 ms
24,108 KB
testcase_05 AC 200 ms
23,880 KB
testcase_06 AC 258 ms
23,568 KB
testcase_07 RE -
testcase_08 AC 197 ms
23,464 KB
testcase_09 AC 271 ms
24,424 KB
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 AC 485 ms
24,412 KB
testcase_16 AC 260 ms
24,388 KB
権限があれば一括ダウンロードができます

ソースコード

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();
		}
	}
}

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