제출 #718845

#제출 시각아이디문제언어결과실행 시간메모리
718845irmuunPalindromes (APIO14_palindrome)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; #define pb push_back #define ll long long #define ff first #define ss second #define all(s) s.begin(),s.end() int main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); string s; cin>>s; ll n=s.size(); ll ans=0; map<string,ll>m; for(ll i=0;i<n;i++){ string t=""; for(ll j=i;j<n;j++){ t+=s[j]; m[t]++; } } for(auto [x,y]:m){ ans=max(ans,x.size()*y); } cout<<ans; }

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

palindrome.cpp: In function 'int main()':
palindrome.cpp:26:31: error: no matching function for call to 'max(long long int&, long long unsigned int)'
   26 |         ans=max(ans,x.size()*y);
      |                               ^
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 palindrome.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:
palindrome.cpp:26:31: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long unsigned int')
   26 |         ans=max(ans,x.size()*y);
      |                               ^
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 palindrome.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:
palindrome.cpp:26:31: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long unsigned int')
   26 |         ans=max(ans,x.size()*y);
      |                               ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from palindrome.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:
palindrome.cpp:26:31: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   26 |         ans=max(ans,x.size()*y);
      |                               ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from palindrome.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:
palindrome.cpp:26:31: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   26 |         ans=max(ans,x.size()*y);
      |                               ^