結果
| 問題 | No.331 CodeRunnerでやれ |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-03-26 20:14:41 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 955 bytes |
| 記録 | |
| コンパイル時間 | 1,034 ms |
| コンパイル使用メモリ | 80,536 KB |
| 実行使用メモリ | 102,600 KB |
| 平均クエリ数 | 1.35 |
| 最終ジャッジ日時 | 2024-07-16 16:43:41 |
| 合計ジャッジ時間 | 8,628 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 1 TLE * 1 -- * 14 |
ソースコード
#include <array>
#include <iostream>
#include <vector>
using namespace std;
constexpr int N = 50;
// N E S W
constexpr array<int, 4> dr = {-1, 0, 1, 0},
dc = { 0, 1, 0, -1};
vector<vector<vector<bool>>> seen;
void rec(int r, int c, int d, bool save) {
if(save) { seen[r][c][d] = true; }
string s; cin >> s;
if(s[0] == 'M') { exit(0); }
int dist = stoi(s);
if(dist == 20151224) {
cout << 'F' << endl;
rec(r+dr[d], c+dc[d], d, true);
return;
}
if(dist) {
if(seen[r+dr[d]][c+dc[d]][d]) {
int nd = (d + 1) % 4;
cout << 'R' << endl;
rec(r, c, nd, false);
} else {
cout << 'F' << endl;
rec(r+dr[d], c+dc[d], d, true);
}
return;
}
int nd = (d + 1) % 4;
cout << 'R' << endl;
rec(r, c, nd, false);
}
int main(void) {
seen.assign(N, vector<vector<bool>>(N, vector<bool>(4, false)));
rec(N/2, N/2, 2, true);
return 0;
}