제출 #831380

#제출 시각아이디문제언어결과실행 시간메모리
831380Trumling기지국 (IOI20_stations)C++14
컴파일 에러
0 ms0 KiB
#include "stations.h" #include <vector> #include<bits/stdc++.h> using namespace std; #define F first #define S second #define all(x) x.begin(),x.end() typedef long long ll; #define pb push_back #define INF 9999999999999999 vector<vector<int>>g; ll nn; vector<int> label(int n, int k, vector<int> u, vector<int> v) { /* g.assign(n,vector<int>()); for (int i = 0; i < n-1; i++) { g[u[i]].pb(v[i]); g[v[i]].pb(u[i]); } */ nn =n; vector<int>labels(n); for(int i=0;i<n;i++) labels[i]=i; return labels; } int find_next_station(int s, int t, vector<int> c) { ll mini=INF; for(auto x:c) mini=min(x,mini); if(t<s) return mini; queue<int>q; q.push(s); int tf=-1; while(!q.empty()) { ll curr=q.front(); q.pop(); if(curr*2+1 ==t) { tf=0; break; } if(curr*2+2 ==t) { tf=1; break; } if(curr*2+1<t) q.push(curr*2+1); if(curr*2+2<t) q.push(curr*2+2); } if(tf==-1) return mini; if(tf==0) return s*2+1; else return s*2+2; }

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

stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:38:17: error: no matching function for call to 'min(int&, ll&)'
   38 |  mini=min(x,mini);
      |                 ^
In file included from /usr/include/c++/10/vector:60,
                 from stations.h:1,
                 from stations.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:
stations.cpp:38:17: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   38 |  mini=min(x,mini);
      |                 ^
In file included from /usr/include/c++/10/vector:60,
                 from stations.h:1,
                 from stations.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:
stations.cpp:38:17: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   38 |  mini=min(x,mini);
      |                 ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from stations.cpp:3:
/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:
stations.cpp:38:17: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   38 |  mini=min(x,mini);
      |                 ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from stations.cpp:3:
/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:
stations.cpp:38:17: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   38 |  mini=min(x,mini);
      |                 ^