ソースコード
CREATE TEMP TABLE AAA AS 
SELECT * 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
;
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
提出情報
提出日時2022/10/19 18:34:37
コンテスト第3回 SQLコンテスト
問題順位計算
受験者hiikunZ
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量87 MB
メッセージ
テストケース(通過数/総数)
1/2
状態
メモリ使用量
データパターン1
AC
87 MB
データパターン2
WA
87 MB