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