結果
問題 | No.331 CodeRunnerでやれ |
ユーザー | face4 |
提出日時 | 2020-01-02 10:10:42 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 351 ms / 5,000 ms |
コード長 | 1,095 bytes |
コンパイル時間 | 497 ms |
コンパイル使用メモリ | 65,544 KB |
実行使用メモリ | 24,312 KB |
平均クエリ数 | 352.47 |
最終ジャッジ日時 | 2023-09-24 02:23:26 |
合計ジャッジ時間 | 6,366 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 146 ms
23,592 KB |
testcase_01 | AC | 137 ms
23,388 KB |
testcase_02 | AC | 161 ms
24,064 KB |
testcase_03 | AC | 266 ms
23,872 KB |
testcase_04 | AC | 142 ms
24,012 KB |
testcase_05 | AC | 159 ms
24,312 KB |
testcase_06 | AC | 327 ms
24,072 KB |
testcase_07 | AC | 176 ms
23,524 KB |
testcase_08 | AC | 351 ms
24,064 KB |
testcase_09 | AC | 188 ms
23,392 KB |
testcase_10 | AC | 253 ms
23,560 KB |
testcase_11 | AC | 240 ms
23,880 KB |
testcase_12 | AC | 226 ms
23,376 KB |
testcase_13 | AC | 241 ms
23,568 KB |
testcase_14 | AC | 260 ms
24,072 KB |
testcase_15 | AC | 240 ms
24,004 KB |
testcase_16 | AC | 334 ms
24,192 KB |
ソースコード
#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); }