Submission #72524498


Source Code Expand

#include <bits/stdc++.h>
#include <bits/extc++.h>
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
const int maxn = 3e5 + 5;
class A
{
public:
    int to,val;
};
int n,m,l,s,t;
vector<A> G[maxn];
set<int> ans;
void dfs(int d,int sum,int use)
{
    if (sum>=s&&sum<=t&&use==l)
        ans.insert(d);
    if (sum>t||use==l)
        return;
    for (auto i:G[d])
        dfs(i.to,sum+i.val,use+1);
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    cin>>n>>m>>l>>s>>t;
    for (int i=1;i<=m;i++)
    {
        int u,v,w;
        cin>>u>>v>>w;
        G[u].push_back({v,w});
    }
    dfs(1,0,0);
    for (auto i:ans)
        print("{} ",i);
}

Submission Info

Submission Time
Task D - Paid Walk
User Alliy666
Language C++23 (GCC 15.2.0)
Score 400
Code Size 730 Byte
Status AC
Exec Time 126 ms
Memory 23212 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 5 ms 6340 KiB
example_01.txt AC 3 ms 6512 KiB
example_02.txt AC 3 ms 6468 KiB
hand_00.txt AC 38 ms 13840 KiB
hand_01.txt AC 112 ms 23212 KiB
hand_02.txt AC 42 ms 13728 KiB
hand_03.txt AC 57 ms 16040 KiB
hand_04.txt AC 47 ms 14788 KiB
hand_05.txt AC 36 ms 17512 KiB
hand_06.txt AC 7 ms 6260 KiB
hand_07.txt AC 6 ms 6428 KiB
hand_08.txt AC 42 ms 13828 KiB
hand_09.txt AC 42 ms 13872 KiB
hand_10.txt AC 3 ms 6348 KiB
hand_11.txt AC 3 ms 6456 KiB
hand_12.txt AC 37 ms 17556 KiB
hand_13.txt AC 37 ms 17372 KiB
hand_14.txt AC 33 ms 17556 KiB
hand_15.txt AC 52 ms 17640 KiB
hand_16.txt AC 51 ms 15388 KiB
hand_17.txt AC 40 ms 13868 KiB
hand_18.txt AC 50 ms 13868 KiB
hand_19.txt AC 39 ms 13764 KiB
hand_20.txt AC 41 ms 13736 KiB
hand_21.txt AC 41 ms 13756 KiB
hand_22.txt AC 42 ms 13936 KiB
hand_23.txt AC 110 ms 23108 KiB
random_00.txt AC 39 ms 15296 KiB
random_01.txt AC 40 ms 15428 KiB
random_02.txt AC 40 ms 15368 KiB
random_03.txt AC 40 ms 15384 KiB
random_04.txt AC 38 ms 15264 KiB
random_05.txt AC 37 ms 15464 KiB
random_06.txt AC 39 ms 14996 KiB
random_07.txt AC 41 ms 14668 KiB
random_08.txt AC 41 ms 14844 KiB
random_09.txt AC 40 ms 14740 KiB
random_10.txt AC 37 ms 14832 KiB
random_11.txt AC 39 ms 15080 KiB
random_12.txt AC 38 ms 14056 KiB
random_13.txt AC 43 ms 13868 KiB
random_14.txt AC 48 ms 14568 KiB
random_15.txt AC 44 ms 13860 KiB
random_16.txt AC 38 ms 13848 KiB
random_17.txt AC 126 ms 17452 KiB
random_18.txt AC 38 ms 13972 KiB
random_19.txt AC 55 ms 13756 KiB
random_20.txt AC 38 ms 13860 KiB
random_21.txt AC 37 ms 13780 KiB
random_22.txt AC 37 ms 13852 KiB
random_23.txt AC 65 ms 13892 KiB
random_24.txt AC 40 ms 15264 KiB
random_25.txt AC 39 ms 15380 KiB
random_26.txt AC 38 ms 15484 KiB
random_27.txt AC 38 ms 15292 KiB
random_28.txt AC 40 ms 15484 KiB
random_29.txt AC 40 ms 15344 KiB