ソースコード
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)*(LATITUDE-kijunLATITUDE),14) AS LATITUDEsa
	,ROUND((LONGITUDE-kijunLONGITUDE)*(LONGITUDE-kijunLONGITUDE),14) 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:08:05
コンテスト第6回 SQLコンテスト
問題位置情報
受験者katsu
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量90 MB
メッセージ
テストケース(通過数/総数)
2/3
状態
メモリ使用量
データパターン1
AC
82 MB
データパターン2
WA
86 MB
データパターン3
AC
90 MB