ソースコード
SELECT 
  RANK() OVER(ORDER BY SUM(a.POINT) DESC) AS RANK,
  b.USER_ID AS USER_ID,
  SUM(a.POINT) AS POINT,
  ( 
  SELECT 
  (
    strftime('%s', 
      CASE
        WHEN STATUS="AC" THEN MAX(d.SUBMITTED_AT)
        WHEN STATUS="WA" THEN MAX(d.SUBMITTED_AT)
        WHEN STATUS="RE" THEN MAX(d.SUBMITTED_AT) 
      ELSE 0
      END
    ) - strftime('%s', c.STARTED_AT)
  
    ) 
    + 300 * (SUM(CASE WHEN STATUS="WA" THEN 1 ELSE 0 END)
    )
FROM ENTRIES AS c
INNER JOIN SUBMISSIONS AS d ON d.ENTRY_ID = c.ENTRY_ID
WHERE d.USER_ID = a.USER_ID AND c.CONTEST_ID = 2 AND c.ENTRY_ID IS NOT NULL
    GROUP BY d.USER_ID, d.CONTEST_ID
    ) AS EX_TIME,
  ( 
  SELECT 
    (
    SUM(CASE WHEN STATUS="WA" THEN 1 ELSE 0 END))
FROM ENTRIES AS c
INNER JOIN SUBMISSIONS AS d ON d.ENTRY_ID = c.ENTRY_ID
WHERE d.USER_ID = a.USER_ID AND c.CONTEST_ID = 2 AND c.ENTRY_ID IS NOT NULL
    GROUP BY d.USER_ID, d.CONTEST_ID
    ) AS WRONG_ANS
    
FROM ENTRIES AS b
INNER JOIN SUBMISSIONS AS a ON a.ENTRY_ID = b.ENTRY_ID
  AND a.CONTEST_ID = b.CONTEST_ID 
  AND a.USER_ID = b.USER_ID
WHERE a.CONTEST_ID = 2 AND a.ENTRY_ID IS NOT NULL
GROUP BY b.USER_ID, a.CONTEST_ID
ORDER BY
    RANK ASC
    , WRONG_ANS ASC
    , USER_ID ASC;
提出情報
提出日時2022/10/20 11:35:53
コンテスト第3回 SQLコンテスト
問題順位計算
受験者tajima
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量100 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
100 MB
データパターン2
WA
95 MB