ソースコード

SELECT 
  RANK() OVER(ORDER BY SUM(b.POINT) DESC) AS RANK,
  b.USER_ID AS USER_ID,
  SUM(b.POINT) AS POINT,
  
  
  ( 
  
  SELECT 
  SUM(strftime('%s', c.SUBMITTED_AT) - strftime('%s', d.STARTED_AT) ) 
    + 300 * (SUM(CASE WHEN STATUS="WA" THEN 1 ELSE 0 END))
FROM SUBMISSIONS AS c
INNER JOIN ENTRIES 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 SUBMISSIONS AS c
INNER JOIN ENTRIES 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 SUBMISSIONS AS b
INNER JOIN ENTRIES 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
-- , PROBLEM_ID

ORDER BY
    RANK ASC
    , WRONG_ANS ASC
    , USER_ID ASC;
    
    
提出情報
提出日時2022/10/20 03:57:47
コンテスト第3回 SQLコンテスト
問題順位計算
受験者mokomoko
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量92 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
77 MB
データパターン2
WA
92 MB