ソースコード
WITH kijun AS (
	SELECT 
		LATITUDE AS kijunLATITUDE
		,LONGITUDE AS kijunLONGITUDE
	FROM LOCATION_TBL
	WHERE DISTRICT_CODE = '1101'
)
,sabun AS (
SELECT *
FROM LOCATION_TBL AS t1
CROSS JOIN kijun AS t2
LEFT OUTER JOIN DISTRICT AS t3
	ON t1.DISTRICT_CODE = t3.DISTRICT_CODE
WHERE t1.DISTRICT_CODE <> '1101'
)
,sakeisan AS (
SELECT
	DISTRICT_CODE
	,DISTRICT_NAME
	,LATITUDE
	,LONGITUDE
	,kijunLATITUDE
	,kijunLONGITUDE
	,ROUND(LATITUDE - kijunLATITUDE,7)*ROUND(LATITUDE - kijunLATITUDE,7) AS LATITUDEsa
	,ROUND(LONGITUDE - kijunLONGITUDE,7)*ROUND(LONGITUDE - kijunLONGITUDE,7) AS LONGITUDEsa
FROM sabun
)
SELECT
	DISTRICT_CODE AS CODE
	,DISTRICT_NAME AS NAME
	,LATITUDE AS LAT
	,LONGITUDE AS LON
FROM sakeisan
ORDER BY SQRT(LATITUDEsa + LONGITUDEsa) DESC,DISTRICT_CODE DESC
提出情報
提出日時2023/04/16 14:06:03
コンテスト第6回 SQLコンテスト
問題位置情報
受験者katsu
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量89 MB
メッセージ
テストケース(通過数/総数)
2/3
状態
メモリ使用量
データパターン1
AC
89 MB
データパターン2
WA
81 MB
データパターン3
AC
83 MB