ソースコード
SELECT RANK() OVER(ORDER BY B.TOTAL_POINT DESC, (strftime('%s', B.ETIME) - strftime('%s', A.STIME)) + B.WORNING ASC) AS RANK
 , A.USER_ID, B.TOTAL_POINT AS POINT
 , (strftime('%s', B.ETIME) - strftime('%s', A.STIME)) + B.WORNING AS EX_TIME
 , B.W_ANS AS WORNG_ANS
FROM
    (SELECT ENTRY_ID, USER_ID, MIN(STARTED_AT) AS STIME
    FROM ENTRIES
    WHERE CONTEST_ID =2 
    GROUP BY ENTRY_ID, USER_ID) AS A
INNER JOIN
    (SELECT ENTRY_ID, USER_ID, MAX(SUBMITTED_AT) AS ETIME
     , SUM(POINT) AS TOTAL_POINT
     , SUM(CASE WHEN STATUS = 'WA' THEN 5 ELSE 0 END) AS WORNING
     , SUM(CASE WHEN STATUS = 'WA' THEN 1 ELSE 0 END) AS W_ANS
    FROM SUBMISSIONS 
    WHERE CONTEST_ID =2 
    GROUP BY ENTRY_ID, USER_ID) AS B
ON A.ENTRY_ID = B.ENTRY_ID AND A.USER_ID = B.USER_ID
WHERE B.TOTAL_POINT > 0
ORDER BY RANK() OVER(ORDER BY B.TOTAL_POINT DESC, (strftime('%s', B.ETIME) - strftime('%s', A.STIME)) + B.WORNING ASC) ,B.TOTAL_POINT DESC
  , (strftime('%s', B.ETIME) - strftime('%s', A.STIME)) + B.WORNING ASC
  , A.USER_ID ASC
提出情報
提出日時2022/10/20 00:28:45
コンテスト第3回 SQLコンテスト
問題順位計算
受験者Hn1980
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量97 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
97 MB
データパターン2
WA
96 MB