| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 917550 | 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<ld,pii>> q;
q.push({0,{1,0}});
while(!q.empty()){
pair<ld,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:33:23: error: 'ld' was not declared in this scope
33 | priority_queue<pair<ld,pii>> q;
| ^~
cyberland.cpp:11:13: error: template argument 1 is invalid
11 | #define pii pair<int,int>
| ^~~~~~~~~~~~~
cyberland.cpp:33:26: note: in expansion of macro 'pii'
33 | priority_queue<pair<ld,pii>> q;
| ^~~
cyberland.cpp:33:29: error: template argument 1 is invalid
33 | priority_queue<pair<ld,pii>> q;
| ^~
cyberland.cpp:33:29: error: template argument 2 is invalid
cyberland.cpp:33:29: error: template argument 3 is invalid
cyberland.cpp:34:5: error: request for member 'push' in 'q', which is of non-class type 'int'
34 | q.push({0,{1,0}});
| ^~~~
cyberland.cpp:35:12: error: request for member 'empty' in 'q', which is of non-class type 'int'
35 | while(!q.empty()){
| ^~~~~
cyberland.cpp:36:27: error: request for member 'top' in 'q', which is of non-class type 'int'
36 | pair<ld,pii> boofer=q.top();
| ^~~
cyberland.cpp:37:7: error: request for member 'pop' in 'q', which is of non-class type 'int'
37 | q.pop();
| ^~~
cyberland.cpp:38:18: error: request for member 'S' in 'boofer', which is of non-class type 'int'
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: request for member 'F' in 'boofer', which is of non-class type 'int'
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:13: error: request for member 'push' in 'q', which is of non-class type 'int'
45 | q.push({dp[to.F][c],{to.F,c}});
| ^~~~
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: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:13: error: request for member 'push' in 'q', which is of non-class type 'int'
51 | q.push({dp[to.F][c],{to.F,c}});
| ^~~~
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: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:13: error: request for member 'push' in 'q', which is of non-class type 'int'
57 | q.push({dp[to.F][c],{to.F,c}});
| ^~~~
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: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: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&, _CharT)'
6075 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs)
| ^~~~~~~~
/usr/include/c++/10/bits/basic_string.h:6075: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:6087:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
6087 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
| ^~~~~~~~
/usr/include/c++/10/bits/basic_string.h:6087:5: note: template argument deduction/substitution failed:
cyberland.cpp:59:14: note: 'std::vector<int>' is not derived from '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:6093: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>&, std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
6093 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/10/bits/basic_string.h:6093: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:6099:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
6099 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
| ^~~~~~~~
/usr/include/c++/10/bits/basic_string.h:6099:5: note: template argument deduction/substitution failed:
cyberland.cpp:59:14: note: 'std::vector<int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
59 |