ソースコード
WITH WA_RECORD AS
(
    SELECT
       T1.USER_ID
      ,COUNT() AS "WA_CNT"
    FROM
      SUBMISSIONS AS T1
    INNER JOIN
    (
        SELECT
           USER_ID
          ,PROBLEM_ID
          ,SUBMITTED_AT AS "AC_AT"
        FROM
          SUBMISSIONS
        WHERE
          STATUS = "AC"
          AND
          ENTRY_ID IS NOT NULL
    ) AS T2 ON T1.USER_ID = T2.USER_ID AND T1.PROBLEM_ID = T2.PROBLEM_ID
    WHERE
      T1.STATUS != "AC"
      AND
      T1.ENTRY_ID IS NOT NULL
      AND
      T1.SUBMITTED_AT < T2.AC_AT
    GROUP BY
       T1.USER_ID
)

SELECT
   RANK() OVER(ORDER BY SUM(T1.POINT) DESC, STRFTIME('%s',MAX(T1.SUBMITTED_AT)) - STRFTIME('%s',T2.STARTED_AT) + (IFNULL(T3.WA_CNT,0) * 300)) AS "RANK"
  ,T1.USER_ID AS "USER_ID"
  ,SUM(T1.POINT) AS "POINT"
  ,STRFTIME('%s',MAX(T1.SUBMITTED_AT)) - STRFTIME('%s',T2.STARTED_AT) + (IFNULL(T3.WA_CNT,0) * 300) AS "EX_TIME"
  ,IFNULL(T3.WA_CNT,0) AS "WRONG_ANS"
FROM
  SUBMISSIONS AS T1
INNER JOIN
  ENTRIES AS T2 ON T1.USER_ID = T2.USER_ID
LEFT OUTER JOIN
  WA_RECORD AS T3 ON T1.USER_ID = T3.USER_ID
WHERE
  T1.ENTRY_ID IS NOT NULL
  AND
  T1.CONTEST_ID = 2
  AND
  "POINT" != 0
GROUP BY
  T1.USER_ID
ORDER BY
   "RANK"
  ,"WRONG_ANS"
  ,"USER_ID"
提出情報
提出日時2024/05/29 17:37:20
コンテスト第3回 SQLコンテスト
問題順位計算
受験者suzukiyo
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量85 MB
メッセージ
テストケース(通過数/総数)
1/2
状態
メモリ使用量
データパターン1
AC
85 MB
データパターン2
WA
84 MB