結果
問題 | No.1948 足し算するだけのパズルゲーム(1) |
ユーザー | McGregorsh |
提出日時 | 2022-07-28 19:36:35 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 2,048 bytes |
コンパイル時間 | 458 ms |
コンパイル使用メモリ | 87,276 KB |
実行使用メモリ | 149,896 KB |
最終ジャッジ日時 | 2023-09-25 12:50:23 |
合計ジャッジ時間 | 9,711 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 251 ms
99,532 KB |
testcase_01 | AC | 266 ms
92,364 KB |
testcase_02 | AC | 259 ms
92,436 KB |
testcase_03 | AC | 250 ms
92,244 KB |
testcase_04 | AC | 263 ms
92,424 KB |
testcase_05 | AC | 246 ms
92,304 KB |
testcase_06 | AC | 243 ms
92,584 KB |
testcase_07 | AC | 273 ms
95,064 KB |
testcase_08 | AC | 283 ms
95,096 KB |
testcase_09 | AC | 284 ms
95,952 KB |
testcase_10 | AC | 279 ms
95,516 KB |
testcase_11 | AC | 284 ms
95,592 KB |
testcase_12 | TLE | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
ソースコード
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 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(): h, w = i_map() A = [i_list() for i in range(h)] def dfs(x, y, cou, cont): #print(x, y, cou, cont) if x == h-1 and y == w-1 and cou > A[h-1][w-1]: print('Yes') exit() if not (0 <= x < h and 0 <= y < w): return if cont == 2: return if 0 <= x + 1 < h: if A[x+1][y] < cou: dfs(x+1, y, cou + A[x+1][y], cont) else: dfs(x+1, y, cou, cont+1) if 0 <= y + 1 < w: if A[x][y+1] < cou: dfs(x, y+1, cou + A[x][y+1], cont) else: dfs(x, y+1, cou, cont+1) dfs(0, 0, A[0][0], 0) print('No') if __name__ == '__main__': main()