結果
問題 | No.232 めぐるはめぐる (2) |
ユーザー | McGregorsh |
提出日時 | 2022-10-26 21:46:41 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 3,793 bytes |
コンパイル時間 | 285 ms |
コンパイル使用メモリ | 87,144 KB |
実行使用メモリ | 202,536 KB |
最終ジャッジ日時 | 2023-09-17 14:56:45 |
合計ジャッジ時間 | 10,929 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | RE | - |
testcase_01 | MLE | - |
testcase_02 | RE | - |
testcase_03 | MLE | - |
testcase_04 | AC | 247 ms
92,844 KB |
testcase_05 | RE | - |
testcase_06 | RE | - |
testcase_07 | AC | 244 ms
92,860 KB |
testcase_08 | MLE | - |
testcase_09 | AC | 247 ms
92,852 KB |
testcase_10 | WA | - |
testcase_11 | RE | - |
testcase_12 | RE | - |
testcase_13 | RE | - |
testcase_14 | WA | - |
testcase_15 | AC | 244 ms
92,972 KB |
testcase_16 | AC | 246 ms
92,856 KB |
testcase_17 | AC | 248 ms
92,688 KB |
testcase_18 | RE | - |
testcase_19 | RE | - |
testcase_20 | RE | - |
testcase_21 | AC | 248 ms
93,048 KB |
testcase_22 | AC | 246 ms
92,856 KB |
testcase_23 | AC | 247 ms
93,068 KB |
testcase_24 | WA | - |
ソースコード
import sys, re from fractions import Fraction from math import ceil, floor, sqrt, pi, factorial, gcd from copy import deepcopy from collections import Counter, deque, defaultdict from heapq import heapify, heappop, heappush from itertools import accumulate, product, combinations, combinations_with_replacement, permutations from bisect import bisect, bisect_left, bisect_right from functools import reduce from decimal import Decimal, getcontext, ROUND_HALF_UP def i_input(): return int(input()) def i_map(): return map(int, input().split()) def i_list(): return list(i_map()) def i_row(N): return [i_input() for _ in range(N)] def i_row_list(N): return [i_list() for _ in range(N)] def s_input(): return input() def s_map(): return input().split() def s_list(): return list(s_map()) def s_row(N): return [s_input for _ in range(N)] def s_row_str(N): return [s_list() for _ in range(N)] def s_row_list(N): return [list(s_input()) for _ in range(N)] def lcm(a, b): return a * b // gcd(a, b) def get_distance(x1, y1, x2, y2): d = sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2) return d def rotate(table): n_fild = [] for x in zip(*table[::-1]): n_fild.append(x) return n_fild sys.setrecursionlimit(10 ** 7) INF = float('inf') MOD = 10 ** 9 + 7 MOD2 = 998244353 ###関数コピーしたか?### def main(): T, A, B = i_map() score = min(A, B) + max(A, B) - min(A, B) if score > T: print('NO') exit() def dfs(y, x, nums): if x == 0 and y == 0: lennums = len(nums) if (T - lennums) % 2 == 0: ko = (T - lennums) // 2 for i in range(ko): nums.append('^') nums.appned('v') ans = nums[::-1] for i in ans: print(i) exit() else: amari = T - lennums amari -= 1 juge = ['^>', '^<', 'v>', 'v<'] for i in range(lennums): if nums[i] in juge: point = i if nums[i] == '^>': state = 0 elif nums[i] == '^<': state = 1 elif nums[i] == 'v>': state = 2 elif nums[i] == 'v<': state = 3 break if state == 0: center1 = '^' center2 = '>' elif state == 1: center1 = '^' center2 = '<' elif state == 2: center1 = 'v' center2 = '>' else: center1 = 'v' center2 = '<' ans = nums[:point] ans.append(center1) ans.append(center2) ko = (T - (lennums+1)) // 2 for i in range(ko): ans.append('^') ans.append('v') ans = ans[::-1] for i in ans: print(i) exit() if x > 0 and y > 0: nums.append('^>') dfs(x-1, y-1, nums) elif x > 0 and y == 0: nums.append('>') dfs(x-1, y, nums) elif x > 0 and y < 0: nums.append('v>') dfs(x-1, y+1, nums) elif x == 0 and y > 0: nums.append('^') dfs(x, y-1, nums) elif x == 0 and y < 0: nums.append('v') dfs(x, y+1, nums) elif x < 0 and y > 0: nums.append('^<') dfs(x+1, y-1, nums) elif x < 0 and y == 0: nums.append('<') dfs(x+1, y, nums) elif x < 0 and y < 0: nums.append('v<') dfs(x+1, y+1, nums) print('YES') dfs(A, B, []) if __name__ == '__main__': main()