結果

問題 No.232 めぐるはめぐる (2)
ユーザー むらためむらため
提出日時 2019-01-25 16:15:02
言語 Nim
(2.0.2)
結果
WA  
実行時間 -
コード長 959 bytes
コンパイル時間 3,329 ms
コンパイル使用メモリ 66,176 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-26 22:56:14
合計ジャッジ時間 5,647 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,380 KB
testcase_01 AC 4 ms
4,376 KB
testcase_02 AC 3 ms
4,376 KB
testcase_03 AC 4 ms
4,376 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 1 ms
4,380 KB
testcase_07 WA -
testcase_08 AC 4 ms
4,376 KB
testcase_09 WA -
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 1 ms
4,384 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 1 ms
4,380 KB
testcase_23 WA -
testcase_24 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

template times*(n:int,body) = (for _ in 0..<n: body)
proc printf(formatstr: cstring){.header: "<stdio.h>", varargs.}
proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "<stdio.h>" .}
proc scan(): int =
  while true:
    let k = getchar_unlocked()
    if k < '0': break
    result = 10 * result + k.ord - '0'.ord

var t = scan()
var a = scan()
var b = scan()
if t < max(a,b) : quit "NO",0
if a == 0 and b == 0 and t == 1:quit "NO",0
printf("YES\n")
if a == 0 and b == 0 and t mod 2 == 1:
  printf(">\n^\n<v\n")
  t -= 3
let m = max(a,b) + 2
while t >= m:
  printf(">\n<\n")
  t -= 2

if t == max(a,b) + 1:
  # 斜めのところか 上に登るところで一回余裕を挟む
  if a == b :
    printf(">\n^\n")
    a -= 1
    b -= 1
  elif a > b:
    printf("^>\n<\n")
    a -= 1
  else :
    printf("^>\nv\n")
    b -= 1
  t -= 2

min(a,b).times: printf(">^\n")
if a > b:
  (a-b).times: printf("^\n")
elif b > a:
  (b-a).times: printf(">\n")
0