結果

問題 No.232 めぐるはめぐる (2)
ユーザー yuppe19 😺yuppe19 😺
提出日時 2015-06-30 13:39:08
言語 Python2
(2.7.18)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,028 bytes
コンパイル時間 377 ms
コンパイル使用メモリ 7,072 KB
実行使用メモリ 12,160 KB
最終ジャッジ日時 2024-07-07 21:27:23
合計ジャッジ時間 2,109 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/python
from itertools import izip_longest

H, J, K, L = list('<v^>')

def solve(t, a, b):
    if (t, a, b) == (1, 0, 0):
        return None
    elif (t, a, b) == (1, 0, 1):
        return [L]
    elif (t, a, b) == (1, 1, 0):
        return [K]
    elif (t, a, b) == (1, 1, 1):
        return [K+L]
    elif (t, a, b) == (2, 0, 1):
        return [K+L, J]
    elif (t, a, b) == (2, 1, 0):
        return [K+L, H]
    elif (t, a, b) == (2, 0, 0):
        return [L, H]
    elif (t, a, b) == (2, 1, 1):
        return [L, K]
    dist = max(a, b)
    if t < dist:
        return None
    res = map(''.join, izip_longest(K*a, L*b, fillvalue=''))
    left = t - dist
    res += [H, L] * (left / 2)
    if not (left & 1):
        return res
    for i, e in enumerate(res):
        if len(e) < 2:
            continue
        res += e[0] + e[1]
        del res[i]
        break
    return res

t, a, b = map(int, raw_input().split())
res = solve(t, a, b)
if res:
    print 'YES'
    print '\n'.join(res)
else:
    print 'NO'
0