コンテストの制限時間が終了しました。
以降も提出を行うことができますが、順位集計には反映されません。
以降も提出を行うことができますが、順位集計には反映されません。
ソースコード
CREATE TEMP TABLE AAA AS
SELECT * FROM ENTRIES AS A,SUBMISSIONS AS B WHERE A.CONTEST_ID == 2 AND B.CONTEST_ID == 2 AND A.USER_ID = B.USER_ID AND strftime('%s', B.SUBMITTED_AT) - strftime('%s',A.STARTED_AT) <= 3600 AND B.ENTRY_ID IS NOT NULL
;
SELECT RANK () OVER(ORDER BY POIN DESC,EX_TIME ASC) AS RANK,
USER_ID AS USER_ID,
POIN AS POINT,
EX_TIME AS EX_TIME,
WRONG_ANS AS WRONG_ANS FROM (
SELECT
A.USER_ID AS USER_ID,
SUM(POINT) AS POIN,
MAX(CASE WHEN B.STATUS = "AC" THEN strftime('%s', B.SUBMITTED_AT) ELSE NULL END) - strftime('%s', A.STARTED_AT) + 300 * SUM(
CASE WHEN B.STATUS != "AC" AND
NOT EXISTS(SELECT * FROM AAA AS C WHERE C.STATUS="AC" AND B.USER_ID=C.USER_ID AND B.PROBLEM_ID=C.PROBLEM_ID AND strftime('%s', C.SUBMITTED_AT) < strftime('%s', B.SUBMITTED_AT))
AND
EXISTS(SELECT * FROM AAA AS C WHERE C.STATUS="AC" AND B.USER_ID=C.USER_ID AND B.PROBLEM_ID=C.PROBLEM_ID)
THEN 1 ELSE 0 END
) AS EX_TIME,
SUM(
CASE WHEN B.STATUS != "AC" AND
NOT EXISTS(SELECT * FROM AAA AS C WHERE C.STATUS="AC" AND B.USER_ID=C.USER_ID AND B.PROBLEM_ID=C.PROBLEM_ID AND strftime('%s', C.SUBMITTED_AT) < strftime('%s', B.SUBMITTED_AT))
AND
EXISTS(SELECT * FROM AAA AS C WHERE C.STATUS="AC" AND B.USER_ID=C.USER_ID AND B.PROBLEM_ID=C.PROBLEM_ID)
THEN 1 ELSE 0 END
) AS WRONG_ANS FROM
ENTRIES AS A,SUBMISSIONS AS B WHERE A.CONTEST_ID == 2 AND A.USER_ID = B.USER_ID AND strftime('%s', B.SUBMITTED_AT) - strftime('%s',A.STARTED_AT) < 3600 AND B.ENTRY_ID IS NOT NULL GROUP BY A.USER_ID ORDER BY POIN DESC,EX_TIME ASC,USER_ID ASC
) WHERE POINT != 0 ORDER BY POIN DESC,EX_TIME ASC,USER_ID ASC
提出情報
提出日時 | 2022/10/19 18:38:31 |
コンテスト | 第3回 SQLコンテスト |
問題 | 順位計算 |
受験者 | hiikunZ |
状態 (詳細) | WA (Wrong Answer: 誤答) |
メモリ使用量 | 89 MB |
メッセージ
テストケース(通過数/総数)
1/2
状態
メモリ使用量
データパターン1
AC
89 MB
データパターン2
WA
80 MB