結果

問題 No.3664 Manhattan Circumcenter
コンテスト
ユーザー kidodesu
提出日時 2026-09-30 21:31:48
言語 PyPy3
(7.3.23 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
実行時間 -
コード長 1,100 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 72 ms
コンパイル使用メモリ 82,072 KB
実行使用メモリ 84,708 KB
最終ジャッジ日時 2026-09-30 21:32:04
合計ジャッジ時間 5,922 ms
ジャッジサーバーID
(参考情報)
judge4_1 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 52 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

def main():
    x0, y0 = list(map(lambda x: int(x)*2, input().split()))
    x1, y1 = list(map(lambda x: int(x)*2, input().split()))
    x2, y2 = list(map(lambda x: int(x)*2, input().split()))
    N = 201
    dp = [-1]*N*N*3
    dp[x0*N+y0] = 0
    dp[N*N+x1*N+y1] = 0
    dp[N*N*2+x2*N+y2] = 0
    B = [x0*N+y0, N*N+x1*N+y1, N*N*2+x2*N+y2]
    while A:= B:
        B = []
        for u in A:
            t = u//N//N
            x = u%(N*N)//N
            y = u%N
            for nx, ny in [(x+1, y), (x-1, y), (x, y-1), (x, y+1)]:
                if 0 <= nx < N and 0 <= ny < N and dp[t*N*N+nx*N+ny] == -1:
                    dp[t*N*N+nx*N+ny] = dp[u]+1
                    B.append(t*N*N+nx*N+ny)
    Ans = []
    for x in range(N):
        for y in range(N):
            if dp[x*N+y] == dp[N*N+x*N+y] == dp[N*N*2+x*N+y]:
                Ans.append((x, y))
                if min(x, y) == 0 or max(x, y) == N-1:
                    return [[-1], []]
    Ans.sort()
    return [[0], []] if not Ans else [[len(Ans)], Ans]

rep = main()
print(*rep[0])
for ans in rep[1]:
    print(ans[0]/2, ans[1]/2)
0