結果
問題 | No.331 CodeRunnerでやれ |
ユーザー |
|
提出日時 | 2020-01-02 10:10:42 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 376 ms / 5,000 ms |
コード長 | 1,095 bytes |
コンパイル時間 | 601 ms |
コンパイル使用メモリ | 65,952 KB |
実行使用メモリ | 25,476 KB |
平均クエリ数 | 352.47 |
最終ジャッジ日時 | 2024-07-17 02:25:40 |
合計ジャッジ時間 | 6,569 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 16 |
ソースコード
#include<iostream>#include<cstring>using namespace std;#define inRange(x,a,b) (a <= x && x < b)int di[8] = {0,1,0,-1,1,1,-1,-1};int dj[8] = {1,0,-1,0,1,-1,1,-1};int way[50][50][4];bool vis[50][50] = {};void front(){cout << "F" << endl << flush;}void right(){cout << "R" << endl << flush;}void back(){cout << "B" << endl << flush;}void goal(){front();string s;cin >> s;if(s == "20151224") goal();exit(0);}// 次出力するvoid dfs(int i, int j, int dir, int res){if(res == 20151224) goal();for(int k = 0; k < 4; k++){if(res > 0){if(res == 20151224) goal();int ni = i+di[dir], nj = j+dj[dir];if(!vis[ni][nj]){vis[ni][nj] = true;front();cin >> res;dfs(ni, nj, dir, res);}}right();cin >> res;dir = (dir+1)%4;}back();cin >> res;return;}int main(){vis[25][25] = true;int dir = 0, res;cin >> res;dfs(25, 25, 0, res);}