コンテストの制限時間が終了しました。
以降も提出を行うことができますが、順位集計には反映されません。
以降も提出を行うことができますが、順位集計には反映されません。
ソースコード
SELECT
PROCESS_ID AS PROCESS,
COUNT(SESSION_ID) AS CNT
FROM
PROCESS_LOG
WHERE
PROCESS_ID = "STEP1"
GROUP BY
PROCESS_ID
UNION ALL
SELECT
MAIN.PROCESS_ID AS PROCESS,
COUNT(SESSION_ID) AS CNT
FROM
PROCESS_LOG MAIN
WHERE
MAIN.PROCESS_ID = "STEP2"
AND EXISTS (
SELECT
1
FROM
PROCESS_LOG SUB
WHERE
SUB.SESSION_ID = MAIN.SESSION_ID
AND PROCESS_ID = "STEP1"
AND SUB.EX_TIMESTAMP < MAIN.EX_TIMESTAMP
)
GROUP BY
MAIN.PROCESS_ID
UNION ALL
SELECT
MAIN.PROCESS_ID AS PROCESS,
COUNT(SESSION_ID) AS CNT
FROM
PROCESS_LOG MAIN
WHERE
MAIN.PROCESS_ID = "STEP3"
AND EXISTS (
SELECT
1
FROM
PROCESS_LOG SUB
WHERE
SUB.SESSION_ID = MAIN.SESSION_ID
AND PROCESS_ID = "STEP1"
AND SUB.EX_TIMESTAMP < MAIN.EX_TIMESTAMP
)
AND EXISTS (
SELECT
1
FROM
PROCESS_LOG SUB
WHERE
SUB.SESSION_ID = MAIN.SESSION_ID
AND PROCESS_ID = "STEP2"
AND SUB.EX_TIMESTAMP < MAIN.EX_TIMESTAMP
)
GROUP BY
MAIN.PROCESS_ID
UNION ALL
SELECT
MAIN.PROCESS_ID AS PROCESS,
COUNT(SESSION_ID) AS CNT
FROM
PROCESS_LOG MAIN
WHERE
MAIN.PROCESS_ID = "STEP4"
AND EXISTS (
SELECT
1
FROM
PROCESS_LOG SUB
WHERE
SUB.SESSION_ID = MAIN.SESSION_ID
AND PROCESS_ID = "STEP1"
AND SUB.EX_TIMESTAMP < MAIN.EX_TIMESTAMP
)
AND EXISTS (
SELECT
1
FROM
PROCESS_LOG SUB
WHERE
SUB.SESSION_ID = MAIN.SESSION_ID
AND PROCESS_ID = "STEP2"
AND SUB.EX_TIMESTAMP < MAIN.EX_TIMESTAMP
)
AND EXISTS (
SELECT
1
FROM
PROCESS_LOG SUB
WHERE
SUB.SESSION_ID = MAIN.SESSION_ID
AND PROCESS_ID = "STEP3"
AND SUB.EX_TIMESTAMP < MAIN.EX_TIMESTAMP
AND EXISTS (
SELECT
1
FROM
PROCESS_LOG SUB_2
WHERE
SUB_2.SESSION_ID = SUB.SESSION_ID
AND PROCESS_ID = "STEP2"
AND SUB_2.EX_TIMESTAMP < SUB.EX_TIMESTAMP
)
)
GROUP BY
MAIN.PROCESS_ID
UNION ALL
SELECT
MAIN.PROCESS_ID AS PROCESS,
COUNT(SESSION_ID) AS CNT
FROM
PROCESS_LOG MAIN
WHERE
MAIN.PROCESS_ID = "STEP5"
AND EXISTS (
SELECT
1
FROM
PROCESS_LOG SUB
WHERE
SUB.SESSION_ID = MAIN.SESSION_ID
AND PROCESS_ID = "STEP1"
AND SUB.EX_TIMESTAMP < MAIN.EX_TIMESTAMP
)
AND EXISTS (
SELECT
1
FROM
PROCESS_LOG SUB
WHERE
SUB.SESSION_ID = MAIN.SESSION_ID
AND PROCESS_ID = "STEP2"
AND SUB.EX_TIMESTAMP < MAIN.EX_TIMESTAMP
)
AND EXISTS (
SELECT
1
FROM
PROCESS_LOG SUB
WHERE
SUB.SESSION_ID = MAIN.SESSION_ID
AND PROCESS_ID = "STEP3"
AND SUB.EX_TIMESTAMP < MAIN.EX_TIMESTAMP
AND EXISTS (
SELECT
1
FROM
PROCESS_LOG SUB_2
WHERE
SUB_2.SESSION_ID = SUB.SESSION_ID
AND PROCESS_ID = "STEP2"
AND SUB_2.EX_TIMESTAMP < SUB.EX_TIMESTAMP
)
)
AND EXISTS (
SELECT
1
FROM
PROCESS_LOG SUB
WHERE
SUB.SESSION_ID = MAIN.SESSION_ID
AND PROCESS_ID = "STEP4"
AND SUB.EX_TIMESTAMP < MAIN.EX_TIMESTAMP
AND EXISTS (
SELECT
1
FROM
PROCESS_LOG SUB_2
WHERE
SUB_2.SESSION_ID = SUB.SESSION_ID
AND PROCESS_ID = "STEP3"
AND SUB_2.EX_TIMESTAMP < SUB.EX_TIMESTAMP
AND EXISTS (
SELECT
1
FROM
PROCESS_LOG SUB_3
WHERE
SUB_3.SESSION_ID = SUB_2.SESSION_ID
AND PROCESS_ID = "STEP2"
AND SUB_3.EX_TIMESTAMP < SUB_2.EX_TIMESTAMP
)
)
)
GROUP BY
MAIN.PROCESS_ID
ORDER BY
PROCESS;
提出情報
提出日時 | 2023/12/17 17:24:46 |
コンテスト | 第10回 SQLコンテスト |
問題 | 顧客行動分析 |
受験者 | g_i_f_u |
状態 (詳細) | WA (Wrong Answer: 誤答) |
メモリ使用量 | 87 MB |
メッセージ
テストケース(通過数/総数)
0/4
状態
メモリ使用量
データパターン1
WA
86 MB
データパターン2
WA
87 MB
データパターン3
WA
87 MB
データパターン4
WA
84 MB