Submission #72520208


Source Code Expand

#include <stdio.h>
#include <vector>
int n, m, l, s, t;
struct edge
{
	int v, w;
};
std::vector<edge> g[200005];
bool flag[200005];
void dfs(int u, long long len, int d)
{
	if (d == l)
	{
		flag[u] |= s <= len && len <= t;
		return;
	}
	for (auto [v, w] : g[u])
		dfs(v, len + w, d + 1);
}
int main()
{
	scanf("%d%d%d%d%d", &n, &m, &l, &s, &t);
	for (int u, v, w, i = 0; i < m; ++i)
	{
		scanf("%d%d%d", &u, &v, &w);
		g[u].push_back({ v, w });
	}
	dfs(1, 0, 0);
	for (int i = 1; i <= n; ++i)
		if (flag[i])
			printf("%d ", i);
	putchar('\n');
	return 0;
}

Submission Info

Submission Time
Task D - Paid Walk
User XiangXunyi
Language C++23 (GCC 15.2.0)
Score 400
Code Size 590 Byte
Status AC
Exec Time 55 ms
Memory 14792 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 3
AC × 57
Set Name Test Cases
Sample example_00.txt, example_01.txt, example_02.txt
All example_00.txt, example_01.txt, example_02.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, hand_06.txt, hand_07.txt, hand_08.txt, hand_09.txt, hand_10.txt, hand_11.txt, hand_12.txt, hand_13.txt, hand_14.txt, hand_15.txt, hand_16.txt, hand_17.txt, hand_18.txt, hand_19.txt, hand_20.txt, hand_21.txt, hand_22.txt, hand_23.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, random_23.txt, random_24.txt, random_25.txt, random_26.txt, random_27.txt, random_28.txt, random_29.txt
Case Name Status Exec Time Memory
example_00.txt AC 2 ms 3796 KiB
example_01.txt AC 2 ms 3712 KiB
example_02.txt AC 2 ms 3884 KiB
hand_00.txt AC 41 ms 11160 KiB
hand_01.txt AC 51 ms 11260 KiB
hand_02.txt AC 46 ms 11244 KiB
hand_03.txt AC 48 ms 11328 KiB
hand_04.txt AC 44 ms 11372 KiB
hand_05.txt AC 39 ms 14784 KiB
hand_06.txt AC 4 ms 3712 KiB
hand_07.txt AC 4 ms 3812 KiB
hand_08.txt AC 44 ms 11244 KiB
hand_09.txt AC 43 ms 11244 KiB
hand_10.txt AC 2 ms 3844 KiB
hand_11.txt AC 2 ms 3712 KiB
hand_12.txt AC 38 ms 14792 KiB
hand_13.txt AC 37 ms 14788 KiB
hand_14.txt AC 34 ms 14768 KiB
hand_15.txt AC 41 ms 12292 KiB
hand_16.txt AC 45 ms 11268 KiB
hand_17.txt AC 43 ms 11140 KiB
hand_18.txt AC 43 ms 11312 KiB
hand_19.txt AC 44 ms 11348 KiB
hand_20.txt AC 44 ms 11200 KiB
hand_21.txt AC 43 ms 11408 KiB
hand_22.txt AC 46 ms 11312 KiB
hand_23.txt AC 53 ms 11264 KiB
random_00.txt AC 42 ms 12816 KiB
random_01.txt AC 42 ms 12844 KiB
random_02.txt AC 42 ms 12988 KiB
random_03.txt AC 42 ms 12772 KiB
random_04.txt AC 42 ms 12696 KiB
random_05.txt AC 41 ms 12772 KiB
random_06.txt AC 43 ms 12476 KiB
random_07.txt AC 42 ms 12432 KiB
random_08.txt AC 42 ms 12460 KiB
random_09.txt AC 42 ms 12348 KiB
random_10.txt AC 43 ms 12260 KiB
random_11.txt AC 43 ms 12336 KiB
random_12.txt AC 41 ms 11312 KiB
random_13.txt AC 47 ms 11268 KiB
random_14.txt AC 47 ms 11364 KiB
random_15.txt AC 46 ms 11244 KiB
random_16.txt AC 46 ms 11452 KiB
random_17.txt AC 55 ms 11452 KiB
random_18.txt AC 42 ms 11264 KiB
random_19.txt AC 44 ms 11372 KiB
random_20.txt AC 44 ms 11244 KiB
random_21.txt AC 42 ms 11364 KiB
random_22.txt AC 44 ms 11332 KiB
random_23.txt AC 44 ms 11348 KiB
random_24.txt AC 42 ms 12776 KiB
random_25.txt AC 41 ms 12860 KiB
random_26.txt AC 41 ms 12780 KiB
random_27.txt AC 42 ms 12740 KiB
random_28.txt AC 42 ms 12720 KiB
random_29.txt AC 42 ms 12776 KiB