제출 #705430

#제출 시각아이디문제언어결과실행 시간메모리
705430blacktulipOlympic Bus (JOI20_ho_t4)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; typedef long long lo; typedef pair< lo,lo > PII; #define fi first #define se second #define int long long #define mp make_pair #define endl "\n" #define pb push_back #define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) #define FOR for(int i=1;i<=n;i++) #define mid ((start+end)/2) #define ort ((bas+son)/2) const lo inf = 10000000000000000; const lo KOK = 100000; const lo LOG = 30; const lo li = 205; const lo mod = 1000000007; int n,m,k,flag,t,y[50005],z[50005],c[50005],d[50005],dist[li][li],cur1[li],value,par[li],ekstra1,ekstra2,ekstra3; int cev; bool vis[li],yolda[50005],yolda1[50005],yasak[50005]; string s; vector<pair<int,pair<int,int>>> v[li],rv[li]; inline int in(){ int x; scanf("%lld",&x); return x; } inline void sp(bool cont){ priority_queue<pair<int,int>> pq; pq.push({0,1}); for(int i=1;i<=n;i++){vis[i]=0;cur1[i]=inf;} while(pq.size()){ int node=pq.top().se; int co=-pq.top().fi; pq.pop(); if(vis[node])continue; vis[node]=1; cur1[node]=co; for(auto go:v[node]){ if(!vis[go.fi] && yasak[go.se.se]==0 && go.se.fi+co<cur1[go.fi]){cur1[go.fi]=go.se.fi+co;par[go.fi]=node;pq.push({-co-go.se.fi,go.fi});} } if(node==ekstra1){ if(!vis[ekstra2] && co+ekstra3<cur1[ekstra2]){cur1[ekstra2]=ekstra3+co;pq.push({-co-ekstra3,ekstra2});} } } if(cont){value=cur1[n];return ;} if(vis[n]==0)return ; int node=n; while(node!=1){ for(auto go:rv[node]){ if(go.fi==par[node]){node=go.fi;yolda[go.se.se]=1;break;} } } } inline void sp1(bool cont){ priority_queue<pair<int,int>> pq; pq.push({0,n}); for(int i=1;i<=n;i++){vis[i]=0;cur1[i]=inf;} while(pq.size()){ int node=pq.top().se; int co=-pq.top().fi; pq.pop(); if(vis[node])continue; vis[node]=1; cur1[node]=co; for(auto go:v[node]){ if(!vis[go.fi] && yasak[go.se.se]==0 && go.se.fi+co<cur1[go.fi]){cur1[go.fi]=go.se.fi+co;par[go.fi]=node;pq.push({-co-go.se.fi,go.fi});} } if(node==ekstra1){ if(!vis[ekstra2] && co+ekstra3<cur1[ekstra2]){cur1[ekstra2]=ekstra3+co;pq.push({-co-ekstra3,ekstra2});} } } if(cont){value=cur1[1];return ;} if(vis[1]==0)return ; int node=1; while(node!=n){ for(auto go:rv[node]){ if(go.fi==par[node]){node=go.fi;yolda1[go.se.se]=1;break;} } } } int32_t main(void){ n=in(),m=in(); FOR{ for(int j=1;j<=n;j++){dist[i][j]=inf;} dist[i][i]=0; } for(int i=1;i<=m;i++){ y[i]=in(),z[i]=in(),c[i]=in(),d[i]=in(); dist[y[i]][z[i]]=min(dist[y[i]][z[i]],c[i]); v[y[i]].pb({z[i],{c[i],i}}); rv[z[i]].pb({y[i],{c[i],i}}); } for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ for(int jj=1;jj<=n;jj++){ dist[j][jj]=min(dist[j][jj],dist[j][i]+dist[i][jj]); } } } sp(0); sp1(0); //~ cout<<"**\n"; cev=min(inf,dist[1][n]+dist[n][1]); for(int i=1;i<=m;i++){ if(yolda[i]==0 && yolda1[i]==0){ if(dist[1][n]!=inf && dist[n][z[i]]!=inf && dist[y[i]][1]!=inf)cev=min(cev,dist[1][n]+dist[n][z[i]]+dist[y[i]][1]+d[i]+c[i]); if(dist[n][1]!=inf && dist[1][z[i]]!=inf && dist[y[i]][n]!=inf)cev=min(cev,dist[n][1]+dist[1][z[i]]+dist[y[i]][n]+d[i]+c[i]); if(dist[n][z[i]]!=inf && dist[y[i]][1]!=inf && dist[1][z[i]]!=inf && dist[y[i]][n]!=inf)cev=min(cev,dist[n][z[i]]+c[i]+dist[y[i]][1]+dist[1][z[i]]+dist[y[i]][n]+d[i]+c[i]); continue; } if(yolda[i] && yolda1[i]){ continue; } if(yolda[i]){ yasak[i]=1; ekstra1=z[i]; ekstra2=y[i]; ekstra3=c[i]; sp(1); yasak[i]=0; if(value!=inf && min(min(dist[n][1],dist[n][z[i]]+dist[y[i]][1]+c[i]))!=inf)cev=min(cev,min(dist[n][1],dist[n][z[i]]+dist[y[i]][1]+c[i])+value+d[i]); continue; } ekstra1=z[i]; ekstra2=y[i]; ekstra3=c[i]; yasak[i]=1; sp1(1); yasak[i]=0; if(value!=inf && min(min(dist[n][1],dist[n][z[i]]+dist[y[i]][1]+c[i]))!=inf)cev=min(cev,min(dist[1][n],dist[1][z[i]]+dist[y[i]][n]+c[i])+value+d[i]); } if(cev>=inf)cev=-1; printf("%lld\n",cev); return 0; }

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

ho_t4.cpp: In function 'int32_t main()':
ho_t4.cpp:133:73: error: no matching function for call to 'min(const long long int&)'
  133 |    if(value!=inf && min(min(dist[n][1],dist[n][z[i]]+dist[y[i]][1]+c[i]))!=inf)cev=min(cev,min(dist[n][1],dist[n][z[i]]+dist[y[i]][1]+c[i])+value+d[i]);
      |                                                                         ^
In file included 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 ho_t4.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:230:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  230 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:230:5: note:   template argument deduction/substitution failed:
ho_t4.cpp:133:73: note:   candidate expects 2 arguments, 1 provided
  133 |    if(value!=inf && min(min(dist[n][1],dist[n][z[i]]+dist[y[i]][1]+c[i]))!=inf)cev=min(cev,min(dist[n][1],dist[n][z[i]]+dist[y[i]][1]+c[i])+value+d[i]);
      |                                                                         ^
In file included 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 ho_t4.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:278:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:278:5: note:   template argument deduction/substitution failed:
ho_t4.cpp:133:73: note:   candidate expects 3 arguments, 1 provided
  133 |    if(value!=inf && min(min(dist[n][1],dist[n][z[i]]+dist[y[i]][1]+c[i]))!=inf)cev=min(cev,min(dist[n][1],dist[n][z[i]]+dist[y[i]][1]+c[i])+value+d[i]);
      |                                                                         ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from ho_t4.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3468:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)'
 3468 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3468:5: note:   template argument deduction/substitution failed:
ho_t4.cpp:133:73: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
  133 |    if(value!=inf && min(min(dist[n][1],dist[n][z[i]]+dist[y[i]][1]+c[i]))!=inf)cev=min(cev,min(dist[n][1],dist[n][z[i]]+dist[y[i]][1]+c[i])+value+d[i]);
      |                                                                         ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from ho_t4.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3474:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3474 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3474:5: note:   template argument deduction/substitution failed:
ho_t4.cpp:133:73: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
  133 |    if(value!=inf && min(min(dist[n][1],dist[n][z[i]]+dist[y[i]][1]+c[i]))!=inf)cev=min(cev,min(dist[n][1],dist[n][z[i]]+dist[y[i]][1]+c[i])+value+d[i]);
      |                                                                         ^
ho_t4.cpp:142:72: error: no matching function for call to 'min(const long long int&)'
  142 |   if(value!=inf && min(min(dist[n][1],dist[n][z[i]]+dist[y[i]][1]+c[i]))!=inf)cev=min(cev,min(dist[1][n],dist[1][z[i]]+dist[y[i]][n]+c[i])+value+d[i]);
      |                                                                        ^
In file included 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 ho_t4.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:230:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  230 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:230:5: note:   template argument deduction/substitution failed:
ho_t4.cpp:142:72: note:   candidate expects 2 arguments, 1 provided
  142 |   if(value!=inf && min(min(dist[n][1],dist[n][z[i]]+dist[y[i]][1]+c[i]))!=inf)cev=min(cev,min(dist[1][n],dist[1][z[i]]+dist[y[i]][n]+c[i])+value+d[i]);
      |                                                                        ^
In file included 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 ho_t4.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:278:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:278:5: note:   template argument deduction/substitution failed:
ho_t4.cpp:142:72: note:   candidate expects 3 arguments, 1 provided
  142 |   if(value!=inf && min(min(dist[n][1],dist[n][z[i]]+dist[y[i]][1]+c[i]))!=inf)cev=min(cev,min(dist[1][n],dist[1][z[i]]+dist[y[i]][n]+c[i])+value+d[i]);
      |                                                                        ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from ho_t4.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3468:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)'
 3468 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3468:5: note:   template argument deduction/substitution failed:
ho_t4.cpp:142:72: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
  142 |   if(value!=inf && min(min(dist[n][1],dist[n][z[i]]+dist[y[i]][1]+c[i]))!=inf)cev=min(cev,min(dist[1][n],dist[1][z[i]]+dist[y[i]][n]+c[i])+value+d[i]);
      |                                                                        ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from ho_t4.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3474:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3474 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3474:5: note:   template argument deduction/substitution failed:
ho_t4.cpp:142:72: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
  142 |   if(value!=inf && min(min(dist[n][1],dist[n][z[i]]+dist[y[i]][1]+c[i]))!=inf)cev=min(cev,min(dist[1][n],dist[1][z[i]]+dist[y[i]][n]+c[i])+value+d[i]);
      |                                                                        ^
ho_t4.cpp: In function 'long long int in()':
ho_t4.cpp:33:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   33 |     scanf("%lld",&x);
      |     ~~~~~^~~~~~~~~~~