QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#506583#6429. Let's Play CurlingUmokCompile Error//C++201.1kb2024-08-05 19:51:562024-08-05 19:51:57

Judging History

你现在查看的是最新测评结果

  • [2024-08-05 19:51:57]
  • 评测
  • [2024-08-05 19:51:56]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define int long long
#define lb(x) (x & (-x))
#define endl '\n'
#define INF LONG_LONG_MAX
#define eps 1e-7
typedef pair<int, int> PII;
const int N = 2e2 + 5;

void solve()
{
    int n, m;
    cin >> n >> m;
    vector<int> ar(n + 2), br(m + 2);
    for (int i = 1; i <= n; i++)
        cin >> ar[i];
    for (int i = 1; i <= m; i++)
        cin >> br[i];
    ar[0] = br[0] = 0;
    ar[n + 1] = br[m + 1] = INF;
    sort(ar.begin(), ar.end());
    sort(br.begin(), br.end());
    int ans = -1;

    for (int i = 2; i <= m; i++)
    {
        auto l = upper_bound(ar.begin(), ar.end(), br[i - 1]) - ar.begin();
        auto r = lower_bound(ar.begin(), ar.end(), br[i]) - ar.begin();
        r--;
        if (l >= n || l > r)
            continue;

        ans = max(ans, r - l + 1);
    }
    if (ans == -1)
        cout << "Impossible" << endl;
    else
        cout << ans << endl;
}
signed main()
{
    // IOS;
    int tcase;
    cin >> tcase;
    while (tcase--)
        solve();
    return 0;
}

詳細信息

answer.code: In function ‘void solve()’:
answer.code:35:18: error: no matching function for call to ‘max(long long int&, long int)’
   35 |         ans = max(ans, r - l + 1);
      |               ~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/13/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51,
                 from answer.code:1:
/usr/include/c++/13/bits/stl_algobase.h:257:5: note: candidate: ‘template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)’
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/13/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
answer.code:35:18: note:   deduced conflicting types for parameter ‘const _Tp’ (‘long long int’ and ‘long int’)
   35 |         ans = max(ans, r - l + 1);
      |               ~~~^~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algobase.h:303:5: note: candidate: ‘template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)’
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/13/bits/stl_algobase.h:303:5: note:   template argument deduction/substitution failed:
answer.code:35:18: note:   deduced conflicting types for parameter ‘const _Tp’ (‘long long int’ and ‘long int’)
   35 |         ans = max(ans, r - l + 1);
      |               ~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/13/algorithm:61:
/usr/include/c++/13/bits/stl_algo.h:5795:5: note: candidate: ‘template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)’
 5795 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/13/bits/stl_algo.h:5795:5: note:   template argument deduction/substitution failed:
answer.code:35:18: note:   mismatched types ‘std::initializer_list<_Tp>’ and ‘long long int’
   35 |         ans = max(ans, r - l + 1);
      |               ~~~^~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algo.h:5805:5: note: candidate: ‘template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)’
 5805 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/13/bits/stl_algo.h:5805:5: note:   template argument deduction/substitution failed:
answer.code:35:18: note:   mismatched types ‘std::initializer_list<_Tp>’ and ‘long long int’
   35 |         ans = max(ans, r - l + 1);
      |               ~~~^~~~~~~~~~~~~~~~