結果

問題 No.232 めぐるはめぐる (2)
ユーザー maspy
提出日時 2020-02-06 09:59:47
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 90 ms / 1,000 ms
コード長 783 bytes
コンパイル時間 381 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 18,384 KB
最終ジャッジ日時 2024-09-14 12:47:25
合計ジャッジ時間 2,529 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

T, A, B = map(int, read().split())

class NotFoundError(Exception):
    pass

def solve_1_dim(T, A, words):
    if T < A:
        raise NotFoundError
    add = (T + A) // 2
    sub = add - A
    stay = T - add - sub
    return [''] * stay + [words[0]] * add + [words[1]] * sub

def solve(T, A, B):
    try:
        ans_A = solve_1_dim(T, A, '^v')
        ans_B = solve_1_dim(T, B, '><')
    except NotFoundError:
        print('NO')
    else:
        ans_B.reverse()
        if (not ans_A[0]) and (not ans_B[0]):
            print('NO')
        else:
            print('YES')
            print('\n'.join('{}{}'.format(*z) for z in zip(ans_A, ans_B)))

solve(T, A, B)
0