コンテストの制限時間が終了しました。
以降も提出を行うことができますが、順位集計には反映されません。
以降も提出を行うことができますが、順位集計には反映されません。
ソースコード
WITH LOG AS (
SELECT SESSION_ID
,PROCESS_ID
,LAG(PROCESS_ID, 1) OVER(PARTITION BY SESSION_ID ORDER BY EX_TIMESTAMP) B1
,LAG(PROCESS_ID, 2) OVER(PARTITION BY SESSION_ID ORDER BY EX_TIMESTAMP) B2
,LAG(PROCESS_ID, 3) OVER(PARTITION BY SESSION_ID ORDER BY EX_TIMESTAMP) B3
,LAG(PROCESS_ID, 4) OVER(PARTITION BY SESSION_ID ORDER BY EX_TIMESTAMP) B4
FROM PROCESS_LOG
ORDER BY SESSION_ID
,PROCESS_ID
), LOG_Y AS (
SELECT PROCESS_ID
,SESSION_ID
FROM LOG
WHERE PROCESS_ID = 'STEP1'
AND B1 IS NULL
AND B2 IS NULL
AND B3 IS NULL
AND B4 IS NULL
), LOG_2 AS (
SELECT L.PROCESS_ID
,L.SESSION_ID
FROM LOG L
INNER JOIN LOG_Y Y
ON L.SESSION_ID = Y.SESSION_ID
WHERE L.PROCESS_ID = 'STEP2'
AND L.B1 = 'STEP1'
), LOG_3 AS (
SELECT L.PROCESS_ID
,L.SESSION_ID
FROM LOG L
INNER JOIN LOG_Y Y
ON L.SESSION_ID = Y.SESSION_ID
WHERE L.PROCESS_ID = 'STEP3'
AND L.B1 = 'STEP2'
AND L.B2 = 'STEP1'
), LOG_4 AS (
SELECT L.PROCESS_ID
,L.SESSION_ID
FROM LOG L
INNER JOIN LOG_Y Y
ON L.SESSION_ID = Y.SESSION_ID
WHERE L.PROCESS_ID = 'STEP4'
AND L.B1 = 'STEP3'
AND L.B2 = 'STEP2'
AND L.B3 = 'STEP1'
), LOG_5 AS (
SELECT L.PROCESS_ID
,L.SESSION_ID
FROM LOG L
INNER JOIN LOG_Y Y
ON L.SESSION_ID = Y.SESSION_ID
WHERE L.PROCESS_ID = 'STEP5'
AND L.B1 = 'STEP4'
AND L.B2 = 'STEP3'
AND L.B3 = 'STEP2'
AND L.B4 = 'STEP1'
)
SELECT PROCESS_ID PROCESS
,COUNT(PROCESS_ID) CNT
FROM LOG_Y
GROUP BY PROCESS_ID
UNION
SELECT PROCESS_ID PROCESS
,COUNT(PROCESS_ID) CNT
FROM LOG_2
GROUP BY PROCESS_ID
UNION
SELECT PROCESS_ID PROCESS
,COUNT(PROCESS_ID) CNT
FROM LOG_3
GROUP BY PROCESS_ID
UNION
SELECT PROCESS_ID PROCESS
,COUNT(PROCESS_ID) CNT
FROM LOG_4
GROUP BY PROCESS_ID
UNION
SELECT PROCESS_ID PROCESS
,COUNT(PROCESS_ID) CNT
FROM LOG_5
GROUP BY PROCESS_ID
ORDER BY PROCESS_ID
提出情報
提出日時 | 2023/12/17 16:03:25 |
コンテスト | 第10回 SQLコンテスト |
問題 | 顧客行動分析 |
受験者 | yakiniku_tabetai_pakupaku |
状態 (詳細) | WA (Wrong Answer: 誤答) |
メモリ使用量 | 97 MB |
メッセージ
テストケース(通過数/総数)
3/4
状態
メモリ使用量
データパターン1
AC
97 MB
データパターン2
AC
97 MB
データパターン3
AC
86 MB
データパターン4
WA
86 MB