# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
917551 | shenfe1 | Cyberland (APIO23_cyberland) | C++17 | Compilation error | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "cyberland.h"
#pragma GCC optimize("Ofast")
#pragma GCC optimize("03")
#pragma GCC tartget("avx2")
using namespace std;
#define pb push_back
#define pii pair<int,int>
const int MAX=1e5+15;
const double inf=1e18;
double dp[MAX][32];
double solve(int n,int m,int k,int h,vector<int> x,vector<int> y,vector<int> c,vector<int> arr){
vector<pii> g[n+1];
for(int i=0;i<m;i++){
x[i]++;
y[i]++;
g[x[i]].pb({y[i],c[i]});
g[y[i]].pb({x[i],c[i]});
// cout<<x[i]<<" "<<y[i]<<" "<<c[i]<<"\n";
}
k=min(k,30);
h++;
for(int i=1;i<=n;i++){
for(int j=0;j<=k;j++)dp[i][j]=inf;
}
dp[1][0]=0;
priority_queue<pair<double,pii>> q;
q.push({0,{1,0}});
while(!q.empty()){
pair<double,pii> boofer=q.top();
q.pop();
int v=boofer.S.F,c=boofer.S.S;
if(dp[v][c]<boofer.F||v==h)continue;
// cout<<v<<" "<<c<<" "<<dp[v][c]<<"\n";
for(auto to:g[v]){
if(arr[to.F-1]==0){
if(dp[to.F][c]>0){
dp[to.F][c]=0;
q.push({dp[to.F][c],{to.F,c}});
}
}
else if(arr[to.F-1]==1){
if(dp[v][c]+to.S<dp[to.F][c]){
dp[to.F][c]=dp[v][c]+to.S;
q.push({dp[to.F][c],{to.F,c}});
}
}
else{
if(dp[v][c]+to.S<dp[to.F][c]){
dp[to.F][c]=dp[v][c]+to.S;
q.push({dp[to.F][c],{to.F,c}});
}
if(c+1<=k&&(dp[v][c]+to.S)/2<dp[to.F][c+1]){
dp[to.F][c+1]=(dp[v][c]+to.S)/2;
q.push({dp[to.F][c+1],{to.F,c+1}});
}
}
}
}
double ans=inf;
for(int i=0;i<=k;i++)ans=min(ans,dp[h][i]);
if(ans==inf)return -1.0;
return ans;
}
// int main(){
// ios_base::sync_with_stdio(0);
// cin.tie(0);
// cout.tie(0);
// int t;
// cin>>t;
// cout.precision(10);
// while(t--){
// int n,m,k,h;
// cin>>n>>m>>k>>h;
// vector<int> arr(n);
// for(int i=0;i<n;i++)cin>>arr[i];
// vector<int> x(m),y(m),c(m);
// for(int i=0;i<m;i++)cin>>x[i]>>y[i]>>c[i];
// cout<<fixed<<solve(n,m,k,h,x,y,c,arr)<<"\n";
// }
// }
Compilation message (stderr)
cyberland.cpp:6: warning: ignoring '#pragma GCC tartget' [-Wunknown-pragmas] 6 | #pragma GCC tartget("avx2") | cyberland.cpp: In function 'double solve(int, int, int, int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)': cyberland.cpp:38:18: error: 'struct std::pair<double, std::pair<int, int> >' has no member named 'S' 38 | int v=boofer.S.F,c=boofer.S.S; | ^ cyberland.cpp:39:13: error: no match for 'operator[]' (operand types are 'double [32]' and 'std::vector<int>') 39 | if(dp[v][c]<boofer.F||v==h)continue; | ^ cyberland.cpp:39:24: error: 'struct std::pair<double, std::pair<int, int> >' has no member named 'F' 39 | if(dp[v][c]<boofer.F||v==h)continue; | ^ cyberland.cpp:42:17: error: 'struct std::pair<int, int>' has no member named 'F' 42 | if(arr[to.F-1]==0){ | ^ cyberland.cpp:43:18: error: 'struct std::pair<int, int>' has no member named 'F' 43 | if(dp[to.F][c]>0){ | ^ cyberland.cpp:44:17: error: 'struct std::pair<int, int>' has no member named 'F' 44 | dp[to.F][c]=0; | ^ cyberland.cpp:45:25: error: 'struct std::pair<int, int>' has no member named 'F' 45 | q.push({dp[to.F][c],{to.F,c}}); | ^ cyberland.cpp:45:35: error: 'struct std::pair<int, int>' has no member named 'F' 45 | q.push({dp[to.F][c],{to.F,c}}); | ^ cyberland.cpp:45:40: error: no matching function for call to 'std::priority_queue<std::pair<double, std::pair<int, int> > >::push(<brace-enclosed initializer list>)' 45 | q.push({dp[to.F][c],{to.F,c}}); | ^ In file included from /usr/include/c++/10/queue:64, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86, from cyberland.cpp:1: /usr/include/c++/10/bits/stl_queue.h:640:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = std::pair<double, std::pair<int, int> >; _Sequence = std::vector<std::pair<double, std::pair<int, int> >, std::allocator<std::pair<double, std::pair<int, int> > > >; _Compare = std::less<std::pair<double, std::pair<int, int> > >; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::pair<double, std::pair<int, int> >]' 640 | push(const value_type& __x) | ^~~~ /usr/include/c++/10/bits/stl_queue.h:640:30: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const std::pair<double, std::pair<int, int> >&'} 640 | push(const value_type& __x) | ~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/10/bits/stl_queue.h:648:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(std::priority_queue<_Tp, _Sequence, _Compare>::value_type&&) [with _Tp = std::pair<double, std::pair<int, int> >; _Sequence = std::vector<std::pair<double, std::pair<int, int> >, std::allocator<std::pair<double, std::pair<int, int> > > >; _Compare = std::less<std::pair<double, std::pair<int, int> > >; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::pair<double, std::pair<int, int> >]' 648 | push(value_type&& __x) | ^~~~ /usr/include/c++/10/bits/stl_queue.h:648:25: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::priority_queue<std::pair<double, std::pair<int, int> > >::value_type&&' {aka 'std::pair<double, std::pair<int, int> >&&'} 648 | push(value_type&& __x) | ~~~~~~~~~~~~~^~~ cyberland.cpp:48:22: error: 'struct std::pair<int, int>' has no member named 'F' 48 | else if(arr[to.F-1]==1){ | ^ cyberland.cpp:49:17: error: no match for 'operator[]' (operand types are 'double [32]' and 'std::vector<int>') 49 | if(dp[v][c]+to.S<dp[to.F][c]){ | ^ cyberland.cpp:49:24: error: 'struct std::pair<int, int>' has no member named 'S' 49 | if(dp[v][c]+to.S<dp[to.F][c]){ | ^ cyberland.cpp:49:32: error: 'struct std::pair<int, int>' has no member named 'F' 49 | if(dp[v][c]+to.S<dp[to.F][c]){ | ^ cyberland.cpp:50:17: error: 'struct std::pair<int, int>' has no member named 'F' 50 | dp[to.F][c]=dp[v][c]+to.S; | ^ cyberland.cpp:50:28: error: no match for 'operator[]' (operand types are 'double [32]' and 'std::vector<int>') 50 | dp[to.F][c]=dp[v][c]+to.S; | ^ cyberland.cpp:50:35: error: 'struct std::pair<int, int>' has no member named 'S' 50 | dp[to.F][c]=dp[v][c]+to.S; | ^ cyberland.cpp:51:25: error: 'struct std::pair<int, int>' has no member named 'F' 51 | q.push({dp[to.F][c],{to.F,c}}); | ^ cyberland.cpp:51:35: error: 'struct std::pair<int, int>' has no member named 'F' 51 | q.push({dp[to.F][c],{to.F,c}}); | ^ cyberland.cpp:51:40: error: no matching function for call to 'std::priority_queue<std::pair<double, std::pair<int, int> > >::push(<brace-enclosed initializer list>)' 51 | q.push({dp[to.F][c],{to.F,c}}); | ^ In file included from /usr/include/c++/10/queue:64, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86, from cyberland.cpp:1: /usr/include/c++/10/bits/stl_queue.h:640:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = std::pair<double, std::pair<int, int> >; _Sequence = std::vector<std::pair<double, std::pair<int, int> >, std::allocator<std::pair<double, std::pair<int, int> > > >; _Compare = std::less<std::pair<double, std::pair<int, int> > >; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::pair<double, std::pair<int, int> >]' 640 | push(const value_type& __x) | ^~~~ /usr/include/c++/10/bits/stl_queue.h:640:30: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const std::pair<double, std::pair<int, int> >&'} 640 | push(const value_type& __x) | ~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/10/bits/stl_queue.h:648:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(std::priority_queue<_Tp, _Sequence, _Compare>::value_type&&) [with _Tp = std::pair<double, std::pair<int, int> >; _Sequence = std::vector<std::pair<double, std::pair<int, int> >, std::allocator<std::pair<double, std::pair<int, int> > > >; _Compare = std::less<std::pair<double, std::pair<int, int> > >; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::pair<double, std::pair<int, int> >]' 648 | push(value_type&& __x) | ^~~~ /usr/include/c++/10/bits/stl_queue.h:648:25: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::priority_queue<std::pair<double, std::pair<int, int> > >::value_type&&' {aka 'std::pair<double, std::pair<int, int> >&&'} 648 | push(value_type&& __x) | ~~~~~~~~~~~~~^~~ cyberland.cpp:55:17: error: no match for 'operator[]' (operand types are 'double [32]' and 'std::vector<int>') 55 | if(dp[v][c]+to.S<dp[to.F][c]){ | ^ cyberland.cpp:55:24: error: 'struct std::pair<int, int>' has no member named 'S' 55 | if(dp[v][c]+to.S<dp[to.F][c]){ | ^ cyberland.cpp:55:32: error: 'struct std::pair<int, int>' has no member named 'F' 55 | if(dp[v][c]+to.S<dp[to.F][c]){ | ^ cyberland.cpp:56:17: error: 'struct std::pair<int, int>' has no member named 'F' 56 | dp[to.F][c]=dp[v][c]+to.S; | ^ cyberland.cpp:56:28: error: no match for 'operator[]' (operand types are 'double [32]' and 'std::vector<int>') 56 | dp[to.F][c]=dp[v][c]+to.S; | ^ cyberland.cpp:56:35: error: 'struct std::pair<int, int>' has no member named 'S' 56 | dp[to.F][c]=dp[v][c]+to.S; | ^ cyberland.cpp:57:25: error: 'struct std::pair<int, int>' has no member named 'F' 57 | q.push({dp[to.F][c],{to.F,c}}); | ^ cyberland.cpp:57:35: error: 'struct std::pair<int, int>' has no member named 'F' 57 | q.push({dp[to.F][c],{to.F,c}}); | ^ cyberland.cpp:57:40: error: no matching function for call to 'std::priority_queue<std::pair<double, std::pair<int, int> > >::push(<brace-enclosed initializer list>)' 57 | q.push({dp[to.F][c],{to.F,c}}); | ^ In file included from /usr/include/c++/10/queue:64, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86, from cyberland.cpp:1: /usr/include/c++/10/bits/stl_queue.h:640:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = std::pair<double, std::pair<int, int> >; _Sequence = std::vector<std::pair<double, std::pair<int, int> >, std::allocator<std::pair<double, std::pair<int, int> > > >; _Compare = std::less<std::pair<double, std::pair<int, int> > >; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::pair<double, std::pair<int, int> >]' 640 | push(const value_type& __x) | ^~~~ /usr/include/c++/10/bits/stl_queue.h:640:30: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const std::pair<double, std::pair<int, int> >&'} 640 | push(const value_type& __x) | ~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/10/bits/stl_queue.h:648:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(std::priority_queue<_Tp, _Sequence, _Compare>::value_type&&) [with _Tp = std::pair<double, std::pair<int, int> >; _Sequence = std::vector<std::pair<double, std::pair<int, int> >, std::allocator<std::pair<double, std::pair<int, int> > > >; _Compare = std::less<std::pair<double, std::pair<int, int> > >; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::pair<double, std::pair<int, int> >]' 648 | push(value_type&& __x) | ^~~~ /usr/include/c++/10/bits/stl_queue.h:648:25: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::priority_queue<std::pair<double, std::pair<int, int> > >::value_type&&' {aka 'std::pair<double, std::pair<int, int> >&&'} 648 | push(value_type&& __x) | ~~~~~~~~~~~~~^~~ cyberland.cpp:59:13: error: no match for 'operator+' (operand types are 'std::vector<int>' and 'int') 59 | if(c+1<=k&&(dp[v][c]+to.S)/2<dp[to.F][c+1]){ | ~^~ | | | | | int | std::vector<int> In file included from /usr/include/c++/10/bits/stl_algobase.h:67, from /usr/include/c++/10/bits/specfun.h:45, from /usr/include/c++/10/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41, from cyberland.cpp:1: /usr/include/c++/10/bits/stl_iterator.h:508:5: note: candidate: 'template<class _Iterator> constexpr std::reverse_iterator<_Iterator> std::operator+(typename std::reverse_iterator<_Iterator>::difference_type, const std::reverse_iterator<_Iterator>&)' 508 | operator+(typename reverse_iterator<_Iterator>::difference_type __n, | ^~~~~~~~ /usr/include/c++/10/bits/stl_iterator.h:508:5: note: template argument deduction/substitution failed: cyberland.cpp:59:14: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int' 59 | if(c+1<=k&&(dp[v][c]+to.S)/2<dp[to.F][c+1]){ | ^ In file included from /usr/include/c++/10/bits/stl_algobase.h:67, from /usr/include/c++/10/bits/specfun.h:45, from /usr/include/c++/10/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41, from cyberland.cpp:1: /usr/include/c++/10/bits/stl_iterator.h:1540:5: note: candidate: 'template<class _Iterator> constexpr std::move_iterator<_IteratorL> std::operator+(typename std::move_iterator<_IteratorL>::difference_type, const std::move_iterator<_IteratorL>&)' 1540 | operator+(typename move_iterator<_Iterator>::difference_type __n, | ^~~~~~~~ /usr/include/c++/10/bits/stl_iterator.h:1540:5: note: template argument deduction/substitution failed: cyberland.cpp:59:14: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int' 59 | if(c+1<=k&&(dp[v][c]+to.S)/2<dp[to.F][c+1]){ | ^ In file included from /usr/include/c++/10/string:55, from /usr/include/c++/10/bits/locale_classes.h:40, from /usr/include/c++/10/bits/ios_base.h:41, from /usr/include/c++/10/ios:42, from /usr/include/c++/10/istream:38, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from cyberland.cpp:1: /usr/include/c++/10/bits/basic_string.h:6022:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&, const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 6022 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/10/bits/basic_string.h:6022:5: note: template argument deduction/substitution failed: cyberland.cpp:59:14: note: 'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 59 | if(c+1<=k&&(dp[v][c]+to.S)/2<dp[to.F][c+1]){ | ^ In file included from /usr/include/c++/10/string:56, from /usr/include/c++/10/bits/locale_classes.h:40, from /usr/include/c++/10/bits/ios_base.h:41, from /usr/include/c++/10/ios:42, from /usr/include/c++/10/istream:38, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from cyberland.cpp:1: /usr/include/c++/10/bits/basic_string.tcc:1160:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 1160 | operator+(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/10/bits/basic_string.tcc:1160:5: note: template argument deduction/substitution failed: cyberland.cpp:59:14: note: mismatched types 'const _CharT*' and 'std::vector<int>' 59 | if(c+1<=k&&(dp[v][c]+to.S)/2<dp[to.F][c+1]){ | ^ In file included from /usr/include/c++/10/string:56, from /usr/include/c++/10/bits/locale_classes.h:40, from /usr/include/c++/10/bits/ios_base.h:41, from /usr/include/c++/10/ios:42, from /usr/include/c++/10/istream:38, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from cyberland.cpp:1: /usr/include/c++/10/bits/basic_string.tcc:1180:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 1180 | operator+(_CharT __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) | ^~~~~~~~ /usr/include/c++/10/bits/basic_string.tcc:1180:5: note: template argument deduction/substitution failed: cyberland.cpp:59:14: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 59 | if(c+1<=k&&(dp[v][c]+to.S)/2<dp[to.F][c+1]){ | ^ In file included from /usr/include/c++/10/string:55, from /usr/include/c++/10/bits/locale_classes.h:40, from /usr/include/c++/10/bits/ios_base.h:41, from /usr/include/c++/10/ios:42, from /usr/include/c++/10/istream:38, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from cyberland.cpp:1: /usr/include/c++/10/bits/basic_string.h:6059:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 6059 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/10/bits/basic_string.h:6059:5: note: template argument deduction/substitution failed: cyberland.cpp:59:14: note: 'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 59 | if(c+1<=k&&(dp[v][c]+to.S)/2<dp[to.F][c+1]){ | ^ In file included from /usr/include/c++/10/string:55, from /usr/include/c++/10/bits/locale_classes.h:40, from /usr/include/c++/10/bits/ios_base.h:41, from /usr/include/c++/10/ios:42, from /usr/include/c++/10/istream:38, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from cyberland.cpp:1: /usr/include/c++/10/bits/basic_string.h:6075:5: note: candidate: 'templat