제출 #975779

#제출 시각아이디문제언어결과실행 시간메모리
975779Nexus사이버랜드 (APIO23_cyberland)C++17
0 / 100
1512 ms2097152 KiB
#define ll long long #include "cyberland.h" #include <bits/stdc++.h> using namespace std; const ll N=1e5+9; ll a[N],h,k; bool balt; vector<ll>v[N],r; map<pair<ll,ll>,double>m; void dfs(ll node,ll pa) { if(node==h) { r.push_back(node); balt=1; return; } //cout<<node<<' '; for(auto i:v[node]) { if(i!=pa) dfs(i,node); if(balt) { r.push_back(node); return; } } } double solve(int N, int M, int K, int H, vector<int> x, vector<int> y, vector<int> c, vector<int> arr) { h=H,k=K; for(ll i=0;i<M;++i) { v[x[i]].push_back(y[i]); v[y[i]].push_back(x[i]); m[{x[i],y[i]}]=c[i]; m[{y[i],x[i]}]=c[i]; } dfs(0,0); if(!balt)return -1; reverse(r.begin(),r.end()); //cout<<r.size(); ll s=0; for(ll i=0;i<r.size();++i) { //cout<<r[i]<<' '; if(!arr[r[i]])s=i; } for(ll i=r.size()-1;i>=s;--i) { //cout<<r[i]<<' '; if(arr[r[i]]==2 && k)--k,a[i]=1; } double ans=0; for(ll i=s;i<r.size()-1;++i) { //cout<<m[{r[i],r[i+1]}]<<' '; if(a[i])ans/=2.0; ans+=m[{r[i],r[i+1]}]; } return ans; }

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

cyberland.cpp: In function 'double solve(int, int, int, int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
cyberland.cpp:60:17: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   60 |     for(ll i=0;i<r.size();++i)
      |                ~^~~~~~~~~
cyberland.cpp:77:17: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   77 |     for(ll i=s;i<r.size()-1;++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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...