제출 #202860

#제출 시각아이디문제언어결과실행 시간메모리
202860FashoValley (BOI19_valley)C++14
36 / 100
3043 ms33080 KiB
#include <bits/stdc++.h> #define N 1000005 #define ll long long int #define MP make_pair #define pb push_back #define ppb pop_back #define sp " " #define endl "\n" #define fi first #define se second #define ii pair<int,int> #define lli pair<ll,ll> #define fast cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(false) #define fast2 freopen ("badhair.gir","r",stdin);freopen ("badhair.cik","w",stdout); #define mod 1000000007 #define fs(x,y) for(ll i=1;i<=y;i++) cin>>x[i] #define fo(i,x,y) for(ll i=x;i<=y;i++) #define INF 1000000000005 #define ull unsigned long long int using namespace std; ll n,m,ar[N],sum,t,s,q,e,tut,flag,mark[N],tutmac[N]; vector<pair<int,ii> > v[N]; void f(int ind,ll len) { if(mark[ind]) return; mark[ind]++; if(ind==e) { flag=1; return; } if(tutmac[ind]) sum=min(sum,len); for(int i=0;i<v[ind].size();i++) { if(v[ind][i].se.se==tut) continue; int a=v[ind][i].fi; ll b=v[ind][i].se.fi; if(!mark[a]) f(a,len+b); } } int main() { fast; cin>>n>>s>>q>>e; fo(i,1,n-1) { ll a,b,c; cin>>a>>b>>c; v[a].pb({b,{c,i}}); v[b].pb({a,{c,i}}); } fo(i,1,s) { int a; cin>>a; tutmac[a]=1; } // cout<<endl; fo(i,1,q) { int a,b; sum=1e15; flag=0; cin>>b>>a; fo(i,1,n) mark[i]=0; tut=b; f(a,0ll); if(flag) { cout<<"escaped"<<endl; continue; } if(sum==1e15) { cout<<"oo"<<endl; continue; } cout<<sum<<endl; } } /* cd onedrive\desktop\kod cls Sinav:21-22 aralik Aciklama: Muhtemelen 25 aralik */

컴파일 시 표준 에러 (stderr) 메시지

valley.cpp: In function 'void f(int, long long int)':
valley.cpp:38:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0;i<v[ind].size();i++)
              ~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...