ソースコード
WITH 
    AvgPts AS (
        SELECT 
            USER_ID AS USER,
            AVG(POINT * 1.0) AS AVG_PT
        FROM 
            TEST_RESULTS
        WHERE 
            TEST_ID = '100'
        GROUP BY 
            USER_ID
    ),
    VarAndStdDev AS (
        SELECT 
            USER, 
            AVG_PT, 
            AVG((POINT * 1.0 - AVG_PT) * (POINT * 1.0 - AVG_PT)) AS VAR_PT,
            CASE 
                WHEN AVG((POINT * 1.0 - AVG_PT) * (POINT * 1.0 - AVG_PT)) = 0 THEN 0
                ELSE SQRT(AVG((POINT * 1.0 - AVG_PT) * (POINT * 1.0 - AVG_PT)))
            END AS SD_PT
        FROM 
            TEST_RESULTS 
            JOIN AvgPts ON TEST_RESULTS.USER_ID = AvgPts.USER
        WHERE 
            TEST_ID = '100'
        GROUP BY 
            USER_ID
    ),
    DevValue AS (
        SELECT 
            USER, 
            POINT AS PT,
            ROUND((CASE 
                    WHEN SD_PT = 0 THEN 50
                    ELSE ((POINT * 1.0 - AVG_PT) * 10) / SD_PT + 50
                  END), 1) AS DEV_VAL
        FROM 
            TEST_RESULTS 
            JOIN VarAndStdDev ON TEST_RESULTS.USER_ID = VarAndStdDev.USER
        WHERE 
            TEST_ID = '100'
    )
SELECT 
    * 
FROM 
    DevValue 
ORDER BY 
    DEV_VAL DESC, 
    USER ASC;
提出情報
提出日時2023/07/13 14:36:03
コンテスト第5回 SQLコンテスト
問題偏差値の算出
受験者fish_man
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量79 MB
メッセージ
テストケース(通過数/総数)
1/4
状態
メモリ使用量
データパターン1
WA
76 MB
データパターン2
AC
78 MB
データパターン3
WA
79 MB
データパターン4
WA
77 MB