제출 #569375

#제출 시각아이디문제언어결과실행 시간메모리
569375DJ035기지국 (IOI20_stations)C++17
컴파일 에러
0 ms0 KiB
#include "stations.h" #include <bits/stdc++.h> #define MEM 1111 #define sanic ios_base::sync_with_stdio(0) #define x first #define y second #define sz size() #define pb push_back #define all(v) v.begin(), v.end() using namespace std; typedef long long ll; typedef pair<ll, ll> pi; const ll INF = 1e13+7; const ll MOD = 1e9+7; vector<ll> g[MEM]; ll lb[MEM]; ll o; void dfs(ll c, ll lv, ll p){ if(lv&1) lb[c] = o++; for(ll nt:g[c]){ if(nt==p) continue; dfs(nt, lv+1, c); } if(!(lv&1)) lb[c] = o++; } std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) { std::vector<int> labels(n); for(int i=0; i<n; i++) g[i].clear(); for(int i=0; i<u.sz; i++){ g[u[i]].pb(v[i]); g[v[i]].pb(u[i]); } memset(lb, 0, sizeof(lb)); o = 0; dfs(0, 1, -1); for(int i=0; i<n; i++) labels[i] = lb[i]; return labels; } int find_next_station(int s, int t, std::vector<int> c) { if(c.back()<s) reverse(c.begin(), c.end()); for(ll r : c) if(min(s, r)<=t && t<=max(s, r)) return r; return c.back(); }

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

stations.cpp: In function 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:29:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |  for(int i=0; i<u.sz; i++){
      |                ^
stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:44:20: error: no matching function for call to 'min(int&, ll&)'
   44 |         if(min(s, r)<=t && t<=max(s, r)) return r;
      |                    ^
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:44:20: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   44 |         if(min(s, r)<=t && t<=max(s, r)) return r;
      |                    ^
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:44:20: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   44 |         if(min(s, r)<=t && t<=max(s, r)) return r;
      |                    ^
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:2:
/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:44:20: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   44 |         if(min(s, r)<=t && t<=max(s, r)) return r;
      |                    ^
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:2:
/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:44:20: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   44 |         if(min(s, r)<=t && t<=max(s, r)) return r;
      |                    ^
stations.cpp:44:39: error: no matching function for call to 'max(int&, ll&)'
   44 |         if(min(s, r)<=t && t<=max(s, r)) return r;
      |                                       ^
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:254:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  254 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:254:5: note:   template argument deduction/substitution failed:
stations.cpp:44:39: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   44 |         if(min(s, r)<=t && t<=max(s, r)) return r;
      |                                       ^
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:300:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  300 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:300:5: note:   template argument deduction/substitution failed:
stations.cpp:44:39: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   44 |         if(min(s, r)<=t && t<=max(s, r)) return r;
      |                                       ^
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:2:
/usr/include/c++/10/bits/stl_algo.h:3480:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)'
 3480 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3480:5: note:   template argument deduction/substitution failed:
stations.cpp:44:39: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   44 |         if(min(s, r)<=t && t<=max(s, r)) return r;
      |                                       ^
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:2:
/usr/include/c++/10/bits/stl_algo.h:3486:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)'
 3486 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3486:5: note:   template argument deduction/substitution failed:
stations.cpp:44:39: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   44 |         if(min(s, r)<=t && t<=max(s, r)) return r;
      |                                       ^