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