Submission #1144998

#TimeUsernameProblemLanguageResultExecution timeMemory
1144998tntTable Tennis (info1cup20_tabletennis)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") //#pragma GCC optimize("Ofast,unroll-loops,fast-math,O3") #define pb push_back #define ll long long #define int long long //#define sort(all(v)) sort(v.begin(),v.end()) int mod = 998244353; const int N = 2e5 + 10; const int inf = 1e9; int fact[200001]; ll binpow(ll a, ll b){ if(b == 0) return 1; else if(b % 2 == 1) return (a * binpow(a, b - 1)) % mod; ll p = binpow(a,b / 2); return (p * p) % mod; } signed main(){ //freopen("mootube.in", "r", stdin); //freopen("mootube.out", "w", stdout); int n,k; cin >> n >> k; int a[n + k + 1]; for(int i = 1; i <= n + k; i++) cin >> a[i]; map <int,int> mp; for(int i = 1; i <= min(n + k,n + k + 2000); i++){ for(int j = n + k; j >= max(1, n + k - 2000); j--){ if(i == j) continue; mp[a[i] + a[j]]++; if(mp[a[i] + a[j]] >= 0){ vector <pair<int,int>> ans; int l = i,r = j,sum = a[i] + a[j]; while(l < r){ if(a[l] + a[r] > sum) r--; else if(a[l] + a[r] < sum) l++; else{ ans.pb({a[l],a[r]}); l++,r--; } } if(ans.size() >= n / 2){ vector <int> v(n + 1); for(int h = 0; h < n / 2; h++){ v[h + 1] = ans[h].first,v[n - h] = ans[h].second; } for(int h = 1; h <= n; h++) cout << v[h] << " "; return 0; } } mp[a[i] + a[j]] = -1e9; } } }

Compilation message (stderr)

tabletennis.cpp: In function 'int main()':
tabletennis.cpp:30:36: error: no matching function for call to 'max(int, long long int)'
   30 |         for(int j = n + k; j >= max(1, n + k - 2000); j--){
      |                                 ~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/bits/specfun.h:45,
                 from /usr/include/c++/11/cmath:1935,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from tabletennis.cpp:1:
/usr/include/c++/11/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++/11/bits/stl_algobase.h:254:5: note:   template argument deduction/substitution failed:
tabletennis.cpp:30:36: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   30 |         for(int j = n + k; j >= max(1, n + k - 2000); j--){
      |                                 ~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/bits/specfun.h:45,
                 from /usr/include/c++/11/cmath:1935,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from tabletennis.cpp:1:
/usr/include/c++/11/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++/11/bits/stl_algobase.h:300:5: note:   template argument deduction/substitution failed:
tabletennis.cpp:30:36: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   30 |         for(int j = n + k; j >= max(1, n + k - 2000); j--){
      |                                 ~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/string:52,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from tabletennis.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:3461:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)'
 3461 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/11/bits/stl_algo.h:3461:5: note:   template argument deduction/substitution failed:
tabletennis.cpp:30:36: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   30 |         for(int j = n + k; j >= max(1, n + k - 2000); j--){
      |                                 ~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/string:52,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from tabletennis.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:3467:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)'
 3467 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/11/bits/stl_algo.h:3467:5: note:   template argument deduction/substitution failed:
tabletennis.cpp:30:36: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   30 |         for(int j = n + k; j >= max(1, n + k - 2000); j--){
      |                                 ~~~^~~~~~~~~~~~~~~~~