ソースコード

WITH STEP_1 AS 
(
  SELECT 
   AVG(POINT) AS AVG_POINT
  FROM TEST_RESULTS
  WHERE TEST_ID = '100'
)
, STEP_2 AS 
(
  SELECT 
    USER_ID 
    ,POINT 
    ,POINT - STEP_1.AVG_POINT AS DIFF 
  FROM TEST_RESULTS
  CROSS JOIN STEP_1
  WHERE TEST_ID = '100'
)
, STEP_3 AS 
(
  SELECT 
    AVG(DIFF*DIFF) AS SQUAVG
  FROM STEP_2 
)
,STEP_4 AS 
(
  SELECT 
    SQRT(SQUAVG) AS SD 
  FROM STEP_3 
)
,STEP_5 AS 
(
  SELECT 
    USER_ID 
    ,POINT
    ,DIFF*10 AS DIFF10
  FROM STEP_2 
)
  SELECT 
    USER_ID AS USER 
    ,POINT AS PT 
    ,ROUND(50 + DIFF10 / SD, 1) AS DEV_VAL
  FROM STEP_5 
  CROSS JOIN STEP_4 
ORDER BY DEV_VAL DESC, USER
;
提出情報
提出日時2023/02/20 09:37:42
コンテスト第5回 SQLコンテスト
問題偏差値の算出
受験者hattsuriboy
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量81 MB
メッセージ
テストケース(通過数/総数)
3/4
状態
メモリ使用量
データパターン1
AC
80 MB
データパターン2
WA
78 MB
データパターン3
AC
77 MB
データパターン4
AC
81 MB