結果

問題 No.232 めぐるはめぐる (2)
ユーザー MamonboMamonbo
提出日時 2015-07-05 19:36:13
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 1,931 bytes
コンパイル時間 102 ms
コンパイル使用メモリ 10,892 KB
実行使用メモリ 8,572 KB
最終ジャッジ日時 2023-09-22 06:25:01
合計ジャッジ時間 3,667 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 112 ms
8,096 KB
testcase_01 AC 166 ms
8,228 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 16 ms
8,100 KB
testcase_05 AC 16 ms
8,052 KB
testcase_06 AC 16 ms
8,096 KB
testcase_07 AC 16 ms
8,156 KB
testcase_08 WA -
testcase_09 AC 16 ms
8,144 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 16 ms
8,044 KB
testcase_13 AC 15 ms
8,092 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 18 ms
8,200 KB
testcase_17 AC 16 ms
8,068 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 16 ms
8,096 KB
testcase_22 AC 16 ms
7,984 KB
testcase_23 AC 16 ms
8,164 KB
testcase_24 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#coding=UTF-8
#Dragon Slayer I の8歩歩きの話の類い
#余ったときの調整はできそう

#A=Bのとき 最短経路は/
#A>Bのとき 最短経路は_/
#A<Bのとき 最短経路は /
#                  |
#max(A,B)-1歩で(A-1,B-1)に到達できる
#歩き方示せと言ったらそんな感じかな

#再帰ぶん回してみる
#無理でした



hoko=[(-1,-1),(0,-1),(1,-1),(-1,0),(1,0),(-1,1),(0,1),(1,1)]

mojir=input()
hyo=mojir.split(" ")
T=int(hyo[0])
A=int(hyo[1])
B=int(hyo[2])


if T < max(A,B):
    print("NO")
elif A==0 and B==0 and T==1:
    print("NO")
else:
    print("YES")
    tx=0
    ty=0
    for idx in range(0,T,1):
        if idx==T-1:
            demoji=""
            if tx==A-1:
                demoji=demoji+">"
            elif tx==A+1:
                demoji=demoji+"<"

            if ty==B-1:
                demoji=demoji+"^"
            elif ty==B+1:
                demoji=demoji+"v"

            print(demoji)
        else:
            if tx==A and ty==B:
                print(">")
                tx=tx+1
            elif (tx==A+1 or tx==A-1) and (ty==B-1 or ty==B):
                print("^")
                ty=ty+1
            elif tx==A and (ty==B+1 or ty==B-1):
                print(">")
                tx=tx+1
            elif (tx==A+1 or tx==A-1) and ty==B+1:
                print("v")
                ty=ty-1
                # ↓→↓
                # ↑ ↑
                # ↑→↑
            else:
                demoji=""
                if tx<= A-2:
                    demoji=demoji+">"
                    tx=tx+1
                elif tx>=A+2:
                    demoji=demoji+"<"
                    tx=tx-1
                if ty<=B-2:
                    demoji=demoji+"^"
                    ty=ty+1
                elif ty>=B+2:
                    demoji=demoji+"v"
                    ty=ty-1
                print(demoji)
            
0