Submission #1100320

#TimeUsernameProblemLanguageResultExecution timeMemory
1100320vjudge1Race (IOI11_race)C++17
Compilation error
0 ms0 KiB
#include <bits\stdc++.h> using namespace std; int k,dp[200000]; vector<pair<int,int>>v[200000]; int dfs(int x,int s) { if(s>k||dp[x])return -1; else if(s==k)return 0; int sm=-1; dp[x]=1; for(auto [i,vl]:v[x]) { int sl=dfs(i,s+vl); if(sl!=-1) { if(sm==-1)sm=sl+1; else { sm=min(sl+1,sm); } } } dp[x]=0; return sm; } int best_path(int n, int K, int h[][2], int l[]) { k=K; for(int x=0;x<n-1;x++) { v[h[x][0]].push_back({h[x][1],l[x]}); v[h[x][1]].push_back({h[x][0],l[x]}); } if(n<=1000) { int ans=-1; for(int x=0;x<n;x++) { int s=dfs(x,0); if(s!=-1) { if(ans==-1)ans=s; else { ans=min(ans,s); } } } return ans; } else { return 0; } } int main() { int n,k; cin>>n>>k; int h[n][2],l[n]; for(int x=0;x<n-1;x++) { cin>>h[x][0]>>h[x][1]>>l[x]; } cout<<best_path(n,k,h,l); }

Compilation message (stderr)

race.cpp:1:10: fatal error: bits\stdc++.h: No such file or directory
    1 | #include <bits\stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.