제출 #1002931

#제출 시각아이디문제언어결과실행 시간메모리
1002931LalicIzvanzemaljci (COI21_izvanzemaljci)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define pb push_back #define all(x) x.begin(), x.end() #define allr(x) x.rbegin(), x.rend() #define mp make_pair #define int long long typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef complex<double> cd; const int MAXN = 1e5+10; const int MOD = 1e9+7; const int INF = 0x3f3f3f3f; const ll LINF = 0x3f3f3f3f3f3f3f3f; const double PI = acos(-1); void solve(){ int n, k; cin >> n >> k; vector<pii> arr(n); for(auto& [a, b] : arr) cin >> a >> b; if(k==1){ int mnx=INF, mxx=-INF, mny=INF, mxy=-INF; for(auto [a, b]: arr) mnx=min(mnx, a), mxx=max(mxx, a), mny=min(mny, b), mxy=max(mxy, b); cout << mnx << " " << mny << " " << max({mxx-mnx, mxy-mny, 1}) << "\n"; } } int32_t main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int tt=1; //~ cin >> tt; while(tt--) solve(); return 0; }

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

izvanzemaljci.cpp: In function 'void solve()':
izvanzemaljci.cpp:32:64: error: no matching function for call to 'max(<brace-enclosed initializer list>)'
   32 |   cout << mnx << " " << mny << " " << max({mxx-mnx, mxy-mny, 1}) << "\n";
      |                                                                ^
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 izvanzemaljci.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:
izvanzemaljci.cpp:32:64: note:   candidate expects 2 arguments, 1 provided
   32 |   cout << mnx << " " << mny << " " << max({mxx-mnx, mxy-mny, 1}) << "\n";
      |                                                                ^
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 izvanzemaljci.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:
izvanzemaljci.cpp:32:64: note:   candidate expects 3 arguments, 1 provided
   32 |   cout << mnx << " " << mny << " " << max({mxx-mnx, mxy-mny, 1}) << "\n";
      |                                                                ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from izvanzemaljci.cpp:1:
/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:
izvanzemaljci.cpp:32:64: note:   deduced conflicting types for parameter '_Tp' ('long long int' and 'int')
   32 |   cout << mnx << " " << mny << " " << max({mxx-mnx, mxy-mny, 1}) << "\n";
      |                                                                ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from izvanzemaljci.cpp:1:
/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:
izvanzemaljci.cpp:32:64: note:   deduced conflicting types for parameter '_Tp' ('long long int' and 'int')
   32 |   cout << mnx << " " << mny << " " << max({mxx-mnx, mxy-mny, 1}) << "\n";
      |                                                                ^