結果
問題 | No.331 CodeRunnerでやれ |
ユーザー | climpet |
提出日時 | 2015-12-24 00:25:45 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 344 ms / 5,000 ms |
コード長 | 943 bytes |
コンパイル時間 | 226 ms |
コンパイル使用メモリ | 27,320 KB |
実行使用メモリ | 24,448 KB |
平均クエリ数 | 424.71 |
最終ジャッジ日時 | 2023-09-23 22:37:00 |
合計ジャッジ時間 | 5,761 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 134 ms
24,408 KB |
testcase_01 | AC | 140 ms
23,856 KB |
testcase_02 | AC | 170 ms
23,848 KB |
testcase_03 | AC | 203 ms
24,304 KB |
testcase_04 | AC | 170 ms
23,640 KB |
testcase_05 | AC | 160 ms
23,400 KB |
testcase_06 | AC | 219 ms
23,628 KB |
testcase_07 | AC | 214 ms
24,396 KB |
testcase_08 | AC | 205 ms
23,680 KB |
testcase_09 | AC | 277 ms
24,004 KB |
testcase_10 | AC | 239 ms
23,860 KB |
testcase_11 | AC | 212 ms
24,448 KB |
testcase_12 | AC | 237 ms
23,412 KB |
testcase_13 | AC | 279 ms
23,520 KB |
testcase_14 | AC | 283 ms
24,000 KB |
testcase_15 | AC | 305 ms
23,668 KB |
testcase_16 | AC | 344 ms
23,524 KB |
ソースコード
#include <cstdio> #include <cstdlib> using namespace std; int dd[] = {0, -1, 0, 1, 0}; int val[50][50][4]; bool vis[50][50]; void output(char c){ putchar(c); putchar('\n'); fflush(stdout); } int input(){ int s; if(scanf("%d", &s) == 0){ exit(0); } if(s > 100){ do{ output('F'); } while(scanf("%d", &s) > 0); exit(0); } return s; } void dfs(int y, int x, int d){ vis[y][x] = true; val[y][x][d] = input(); for(int i = 0; i < 3; ++i){ output('L'); d = (d + 1) & 3; val[y][x][d] = input(); } for(int i = 0; i < 4; ++i){ int ny = y + dd[d], nx = x + dd[d + 1]; if(val[y][x][d] != 0 && !vis[ny][nx]){ output('F'); dfs(ny, nx, d); output('R'); } else{ output('L'); } input(); d = (d + 1) & 3; } output('R'); input(); output('F'); input(); } int main(){ for(int i = 0; i < 50; ++i) for(int j = 0; j < 50; ++j) for(int k = 0; k < 4; ++k){ val[i][j][k] = -1; } dfs(25, 25, 0); }