結果

問題 No.3723 Climb or Detour
コンテスト
ユーザー tyuyu_62
提出日時 2026-09-19 14:38:46
言語 PyPy3
(7.3.23 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 61 ms / 2,000 ms
+ 857µs
コード長 1,389 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 242 ms
コンパイル使用メモリ 83,224 KB
実行使用メモリ 83,200 KB
最終ジャッジ日時 2026-09-19 14:39:00
合計ジャッジ時間 7,327 ms
ジャッジサーバーID
(参考情報)
judge5_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 58
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

# https://github.com/tyuyu-62/cp-library
from collections import deque, defaultdict
from itertools import permutations, product
from bisect import bisect_left, bisect_right
from heapq import heappush, heappop
from random import randint, shuffle
from time import perf_counter as pc
def II(): return int(input())
def LI(dec=0): return [int(x) - dec for x in input().split()]
def SI(): return input()
def LS(): return list(input().split())
mod = 998244353
inf = 2002002002002002002

import sys
sys.setrecursionlimit(10 ** 6)
input = lambda: sys.stdin.readline().rstrip()
_buf = []
def print(*args, sep=" "): _buf.append(sep.join(map(str, args)))
def debug(*args):
    if DEBUG: sys.stdout.write(" ".join(map(str, args)) + "\n")
DEBUG = True


def solve():
    N, K = LI()
    S = LI(1)
    T = LI(1)
    dist = abs(S[0] - T[0]) + abs(S[1] - T[1])
    if K < dist or (K - dist) % 2 == 1 or (dist + dist // 2 * 2 < K):
        print(-1)
    else:
        A = [["." for _ in range(N)] for _ in range(N)]
        d = (K - dist) // 2 * 2
        for i in range(N):
            for j in range(N):
                c = abs(S[0] - i) + abs(S[1] - j)
                if c & 1 and c < d:
                    A[i][j] = "#"
            print("".join(A[i]))
    return

if __name__ == "__main__":
    T = 1
    # T = II()
    for _ in range(T):
        solve()
    sys.stdout.write("\n".join(_buf) + "\n")
0