結果
| 問題 | No.3664 Manhattan Circumcenter |
| コンテスト | |
| ユーザー |
kidodesu
|
| 提出日時 | 2026-09-30 21:38:39 |
| 言語 | PyPy3 (7.3.23 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 52 ms / 2,000 ms |
| + 904µs | |
| コード長 | 1,147 bytes |
| 記録 | |
| コンパイル時間 | 64 ms |
| コンパイル使用メモリ | 83,516 KB |
| 実行使用メモリ | 84,204 KB |
| 最終ジャッジ日時 | 2026-09-30 21:38:46 |
| 合計ジャッジ時間 | 5,706 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 57 |
ソースコード
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()
if len(Ans) > 1:
return [[-1], []]
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)
kidodesu