ソースコード
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
	,ROUND(LATITUDE - kijunLATITUDE,7)*ROUND(LATITUDE - kijunLATITUDE,7) AS LATITUDEsa
	,ROUND(LONGITUDE - kijunLONGITUDE,7)*ROUND(LONGITUDE - kijunLONGITUDE,7) 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
WHERE t1.DISTRICT_CODE <> '1101'
ORDER BY SQRT(t1.LATITUDEsa + t1.LONGITUDEsa) DESC,t1.DISTRICT_CODE DESC
提出情報
提出日時2023/04/16 14:01:58
コンテスト第6回 SQLコンテスト
問題位置情報
受験者katsu
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量89 MB
メッセージ
テストケース(通過数/総数)
2/3
状態
メモリ使用量
データパターン1
AC
83 MB
データパターン2
WA
89 MB
データパターン3
AC
79 MB