Submission #917638

#TimeUsernameProblemLanguageResultExecution timeMemory
917638shenfe1Cyberland (APIO23_cyberland)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "cyberland.h" #pragma GCC optimize("Ofast") #pragma comment(linker, "/stack:200000000") #pragma GCC target( "sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native" ) #pragma GCC optimize("unroll-loops") #pragma GCC optimize("profile-values,profile-reorder-functions,tracer") #pragma GCC optimize("vpt") #pragma GCC optimize("rename-registers") #pragma GCC optimize("move-loop-invariants") #pragma GCC optimize("unswitch-loops") #pragma GCC optimize("function-sections") #pragma GCC optimize("data-sections") #pragma GCC optimize("branch-target-load-optimize") #pragma GCC optimize("branch-target-load-optimize2") #pragma GCC optimize("btr-bb-exclusive") #pragma GCC optimize("inline") #pragma GCC optimize("-fgcse") #pragma GCC optimize("-fgcse-lm") #pragma GCC optimize("-fipa-sra") #pragma GCC optimize("-ftree-pre") #pragma GCC optimize("-ftree-vrp") #pragma GCC optimize("-fpeephole2") #pragma GCC optimize("-ffast-math") #pragma GCC optimize("-fsched-spec") #pragma GCC optimize("-falign-jumps") #pragma GCC optimize("-falign-loops") #pragma GCC optimize("-falign-labels") #pragma GCC optimize("-fdevirtualize") #pragma GCC optimize("-fcaller-saves") #pragma GCC optimize("-fcrossjumping") #pragma GCC optimize("-fthread-jumps") #pragma GCC optimize("-freorder-blocks") #pragma GCC optimize("-fschedule-insns") #pragma GCC optimize("inline-functions") #pragma GCC optimize("-ftree-tail-merge") #pragma GCC optimize("-fschedule-insns2") #pragma GCC optimize("-fstrict-aliasing") #pragma GCC optimize("-foptimize-sibling-calls") #pragma GCC optimize("-fexpensive-optimizations") #pragma GCC optimize("inline-functions-called-once") #pragma GCC optimize("-fdelete-null-pointer-checks") #pragma GCC tartget("avx2") using namespace std; #define F first #define S second #define pb push_back #define pii pair<int,int> const int MAX=1e5+15; const double inf=1e18; int use[MAX]; vector<pii> g[MAX]; double solve(int n,int m,int k,int h,vector<int> x,vector<int> y,vector<int> c,vector<int> arr){ double dp[n+1][67]; for(int i=1;i<=n;i++){ use[i]=0; g[i].clear(); } 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"; } { queue<int> q; q.push(1); use[1]=1; while(!q.empty()){ int v=q.front(); q.pop(); if(v==h+1)continue; for(auto to:g[v]){ if(!use[to]){ q.push(to); use[to]=1; } } } if(!use[h+1]){ return -1.0; } } k=min(k,66); h++; for(int i=1;i<=n;i++){ for(int j=0;j<=k;j++)dp[i][j]=inf; } priority_queue<pair<double,pii>> q; for(int i=1;i<=n;i++){ if((i==1||arr[i-1]==0)&&use[i]){ dp[i][0]=0; q.push({0,{i,0}}); } } while(!q.empty()){ int v=q.top().S.F,c=q.top().S.S; if(dp[v][c]<-q.top().F||v==h){ q.pop(); continue; } q.pop(); // cout<<v<<" "<<c<<" "<<dp[v][c]<<"\n"; for(auto to:g[v]){ 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(arr[to.F-1]==2){ 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]); 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:5: warning: ignoring '#pragma comment ' [-Wunknown-pragmas]
    5 | #pragma comment(linker, "/stack:200000000")
      | 
cyberland.cpp:44: warning: ignoring '#pragma GCC tartget' [-Wunknown-pragmas]
   44 | #pragma GCC tartget("avx2")
      | 
cyberland.cpp:8:71: warning: bad option '-fprofile-values' to pragma 'optimize' [-Wpragmas]
    8 | #pragma GCC optimize("profile-values,profile-reorder-functions,tracer")
      |                                                                       ^
cyberland.cpp:13:41: warning: bad option '-ffunction-sections' to pragma 'optimize' [-Wpragmas]
   13 | #pragma GCC optimize("function-sections")
      |                                         ^
cyberland.cpp:14:37: warning: bad option '-fdata-sections' to pragma 'optimize' [-Wpragmas]
   14 | #pragma GCC optimize("data-sections")
      |                                     ^
cyberland.cpp:15:51: warning: bad option '-fbranch-target-load-optimize' to pragma 'optimize' [-Wpragmas]
   15 | #pragma GCC optimize("branch-target-load-optimize")
      |                                                   ^
cyberland.cpp:16:52: warning: bad option '-fbranch-target-load-optimize2' to pragma 'optimize' [-Wpragmas]
   16 | #pragma GCC optimize("branch-target-load-optimize2")
      |                                                    ^
cyberland.cpp:17:40: warning: bad option '-fbtr-bb-exclusive' to pragma 'optimize' [-Wpragmas]
   17 | #pragma GCC optimize("btr-bb-exclusive")
      |                                        ^
cyberland.cpp:59:95: warning: bad option '-fprofile-values' to attribute 'optimize' [-Wattributes]
   59 | double solve(int n,int m,int k,int h,vector<int> x,vector<int> y,vector<int> c,vector<int> arr){
      |                                                                                               ^
cyberland.cpp:59:95: warning: bad option '-ffunction-sections' to attribute 'optimize' [-Wattributes]
cyberland.cpp:59:95: warning: bad option '-fdata-sections' to attribute 'optimize' [-Wattributes]
cyberland.cpp:59:95: warning: bad option '-fbranch-target-load-optimize' to attribute 'optimize' [-Wattributes]
cyberland.cpp:59:95: warning: bad option '-fbranch-target-load-optimize2' to attribute 'optimize' [-Wattributes]
cyberland.cpp:59:95: warning: bad option '-fbtr-bb-exclusive' to attribute 'optimize' [-Wattributes]
cyberland.cpp: In function 'double solve(int, int, int, int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
cyberland.cpp:81:16: error: no match for 'operator[]' (operand types are 'int [100015]' and 'std::pair<int, int>')
   81 |         if(!use[to]){
      |                ^
cyberland.cpp:82:20: error: no matching function for call to 'std::queue<int>::push(std::pair<int, int>&)'
   82 |           q.push(to);
      |                    ^
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:265:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(const value_type&) [with _Tp = int; _Sequence = std::deque<int, std::allocator<int> >; std::queue<_Tp, _Sequence>::value_type = int]'
  265 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/10/bits/stl_queue.h:265:30: note:   no known conversion for argument 1 from 'std::pair<int, int>' to 'const value_type&' {aka 'const int&'}
  265 |       push(const value_type& __x)
      |            ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_queue.h:270:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(std::queue<_Tp, _Sequence>::value_type&&) [with _Tp = int; _Sequence = std::deque<int, std::allocator<int> >; std::queue<_Tp, _Sequence>::value_type = int]'
  270 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/10/bits/stl_queue.h:270:25: note:   no known conversion for argument 1 from 'std::pair<int, int>' to 'std::queue<int>::value_type&&' {aka 'int&&'}
  270 |       push(value_type&& __x)
      |            ~~~~~~~~~~~~~^~~
cyberland.cpp:83:14: error: no match for 'operator[]' (operand types are 'int [100015]' and 'std::pair<int, int>')
   83 |           use[to]=1;
      |              ^