結果

問題 No.331 CodeRunnerでやれ
ユーザー tjaketjake
提出日時 2015-12-24 00:29:59
言語 Python2
(2.7.18)
結果
AC  
実行時間 391 ms / 5,000 ms
コード長 673 bytes
コンパイル時間 84 ms
コンパイル使用メモリ 6,632 KB
実行使用メモリ 24,264 KB
平均クエリ数 398.35
最終ジャッジ日時 2023-09-23 22:37:30
合計ジャッジ時間 6,626 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 169 ms
23,404 KB
testcase_01 AC 172 ms
23,848 KB
testcase_02 AC 182 ms
24,264 KB
testcase_03 AC 382 ms
23,448 KB
testcase_04 AC 167 ms
23,448 KB
testcase_05 AC 179 ms
24,264 KB
testcase_06 AC 378 ms
23,448 KB
testcase_07 AC 198 ms
24,036 KB
testcase_08 AC 391 ms
23,400 KB
testcase_09 AC 212 ms
23,628 KB
testcase_10 AC 291 ms
23,892 KB
testcase_11 AC 260 ms
23,544 KB
testcase_12 AC 247 ms
24,252 KB
testcase_13 AC 252 ms
23,844 KB
testcase_14 AC 289 ms
23,440 KB
testcase_15 AC 257 ms
23,556 KB
testcase_16 AC 360 ms
24,216 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

N = 50
flush = sys.stdout.flush

used = [[0]*N for i in xrange(N)]
dx = [-1, 0, 1, 0]
dy = [0, -1, 0, 1]

# (x, y, dir)
st = [[0, 0, 0, 4]]
used[0][0] = 1
while 1:
    s = raw_input()
    if s[0]=="M": exit(0)
    d = int(s)
    if d == 20151124:
        print"F"
        flush()
        continue
    x, y, di, f = el = st[-1]
    nx = x + dx[di]; ny = y + dy[di]
    if d and not used[ny][nx]:
        print"F"; flush()
        st.append([nx, ny, di, 4])
        used[ny][nx] = 1
    else:
        if f==0:
            print "B"; flush()
            st.pop()
        else:
            el[2] = (di + 1) % 4
            el[3] = f-1
            print"R"; flush()
0