コンテストの制限時間が終了しました。
以降も提出を行うことができますが、順位集計には反映されません。
以降も提出を行うことができますが、順位集計には反映されません。
ソースコード
SELECT
RANK() OVER (ORDER BY POINT DESC, EX_TIME ASC) AS RANK
, USER_ID
, POINT
, EX_TIME
, WRONG_ANS
FROM (
SELECT
t1.USER_ID
, t1.POINT
-- , t1.WRONG_ANS
, COUNT(SUBMIT_ID)
FILTER (WHERE t1.STATUS != 'AC')
OVER (PARTITION BY t1.USER_ID, t1.ENTRY_ID) AS WRONG_ANS
, strftime('%s', datetime(t1.MAX_SUBMITTED_AT))
- strftime('%s', datetime(t2.STARTED_AT))
+ (300 *
COUNT(SUBMIT_ID)
FILTER (WHERE STATUS != 'AC')
OVER (PARTITION BY t1.USER_ID, t1.ENTRY_ID)
) AS EX_TIME
FROM (
SELECT
USER_ID
, SUBMIT_ID
, ENTRY_ID
, SUBMITTED_AT
, STATUS
, CONTEST_ID
, SUM(POINT) OVER (PARTITION BY USER_ID, ENTRY_ID) AS POINT
, MAX(SUBMITTED_AT) FILTER(WHERE STATUS = 'AC') OVER (PARTITION BY USER_ID, ENTRY_ID) AS MAX_SUBMITTED_AT
-- , COUNT(SUBMIT_ID)
-- FILTER (WHERE STATUS != 'AC')
-- OVER (PARTITION BY USER_ID, ENTRY_ID) AS WRONG_ANS
-- COUNT (
-- CASE
-- WHEN STATUS != 'AC'
-- AND SUBMITTED_AT < MAX(SUBMITTED_AT) FILTER(WHERE STATUS = 'AC') OVER (PARTITION BY USER_ID, ENTRY_ID)SUBMIT_ID)
-- THEN SUBMIT_ID
-- ELSE NULL END
-- ) AS WRONG_ANS
FROM SUBMISSIONS
WHERE
ENTRY_ID IS NOT NULL -- 回答時間外除外
AND CONTEST_ID = 2
) AS t1
INNER JOIN ENTRIES AS t2
ON t1.USER_ID = t2.USER_ID
AND t1.ENTRY_ID = t2.ENTRY_ID
AND t1.CONTEST_ID = t2.CONTEST_ID
WHERE
t1.POINT > 0
AND t1.MAX_SUBMITTED_AT >= t1.SUBMITTED_AT
GROUP BY 1, 2
)
ORDER BY
RANK ASC
, WRONG_ANS ASC
, USER_ID ASC
提出情報
提出日時 | 2022/10/19 20:22:11 |
コンテスト | 第3回 SQLコンテスト |
問題 | 順位計算 |
受験者 | Udwei22 |
状態 (詳細) | WA (Wrong Answer: 誤答) |
メモリ使用量 | 103 MB |
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
103 MB
データパターン2
WA
99 MB