Submission #967190

# Submission time Handle Problem Language Result Execution time Memory
967190 2024-04-21T13:24:15 Z Roman70 trapezoid (balkan11_trapezoid) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#define ll long long
using namespace std;
struct trapezoid{
    ll a,b,c,d;
};
bool cmp(trapezoid &a, trapezoid &b){
    return a.a < b.a;
}
const int sz = 1e5+1;
ll dp[sz];
const int mod = 30013;
int main()
{
    int n;
    cin >> n;
    trapezoid a[n];
    for(int i = 0 ;i<n;i++){
        cin >> a[i].a >> a[i].b >> a[i].c >> a[i].d;
    }
    
    sort(a,a+n,cmp);
    int ans = 0;
    map<int,int>cnt;
    for(int i = n-1;i>=0;i--){
        dp[i] = 1;
        for(int j = i;j<n;j++){
            if(a[i].b < a[j].a && a[i].d < a[j].c) dp[i] = max(dp[i],dp[j]+1);
        }
        ans = max(ans,dp[i]);
    }
    ll ans2 = 0;
    for(int i = 0; i < n; i++){
         for(int j = i+1;j<n;j++){
            if(a[i].b < a[j].a && a[i].d < a[j].c && dp[j] == ans-1) ans2 = (ans2 + 1) % mod;
        }
    }
    cout<<ans<<" "<<ans2;
    return 0;
}

Compilation message

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