結果

問題 No.331 CodeRunnerでやれ
ユーザー sugim48sugim48
提出日時 2015-12-24 01:11:47
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 324 ms / 5,000 ms
コード長 1,687 bytes
コンパイル時間 892 ms
コンパイル使用メモリ 93,116 KB
実行使用メモリ 24,384 KB
平均クエリ数 344.82
最終ジャッジ日時 2023-09-23 22:47:18
合計ジャッジ時間 6,555 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 148 ms
23,616 KB
testcase_01 AC 144 ms
23,400 KB
testcase_02 AC 165 ms
24,064 KB
testcase_03 AC 201 ms
24,040 KB
testcase_04 AC 168 ms
24,384 KB
testcase_05 AC 190 ms
23,520 KB
testcase_06 AC 206 ms
23,376 KB
testcase_07 AC 279 ms
24,288 KB
testcase_08 AC 180 ms
23,380 KB
testcase_09 AC 247 ms
23,380 KB
testcase_10 AC 248 ms
24,028 KB
testcase_11 AC 324 ms
23,368 KB
testcase_12 AC 297 ms
24,376 KB
testcase_13 AC 248 ms
23,844 KB
testcase_14 AC 273 ms
23,352 KB
testcase_15 AC 285 ms
23,380 KB
testcase_16 AC 254 ms
23,500 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();
		}
	}
	cout << 'L' << endl; k = (k + 3) % 4;
	f();
}

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