QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#506626#6429. Let's Play CurlingazCompile Error//C++20850b2024-08-05 20:18:192024-08-05 20:18:20

Judging History

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

  • [2024-08-05 20:18:20]
  • 评测
  • [2024-08-05 20:18:19]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
#define PII pair<int,int>
#define PIS pair<int,string>
#define fr(i,x,y) for(int i=x,p=y;i<=p;i++)
#define rp(i,x,y) for(int i=x,p=y;i>=p;i--)
const int N=1e6+10;
const int M=1e2+10;
int mod=998244353;
int a[N],b[N];
int f[M][M];
void solve(){
	int n,m;
	cin>>n>>m;
	fr(i,1,n)cin>>a[i];
	fr(i,1,m)cin>>b[i];
	sort(a+1,a+n+1);
	sort(b+1,b+m+1);
	int maxa=0;
	fr(i,0,m-1){
		if(b[i+1]==b[i])continue;
		int l=b[i],r=b[i+1];
		auto t=upper_bound(a+1,a+1+n,l);
		auto q=lower_bound(a+1,a+1+n,r);
		maxa=max(maxa,q-t);
		
	}
	if(maxa==0){
		cout<<"Impossible"<<endl;
		return;
	}
	cout<<maxa<<endl;
}
signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	int n=1;
	cin>>n;
	while(n--)
	solve();
	return 0;
}

Details

answer.code: In function ‘void solve()’:
answer.code:27:25: error: no matching function for call to ‘max(long long int&, long int)’
   27 |                 maxa=max(maxa,q-t);
      |                      ~~~^~~~~~~~~~
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:27:25: note:   deduced conflicting types for parameter ‘const _Tp’ (‘long long int’ and ‘long int’)
   27 |                 maxa=max(maxa,q-t);
      |                      ~~~^~~~~~~~~~
/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:27:25: note:   deduced conflicting types for parameter ‘const _Tp’ (‘long long int’ and ‘long int’)
   27 |                 maxa=max(maxa,q-t);
      |                      ~~~^~~~~~~~~~
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:27:25: note:   mismatched types ‘std::initializer_list<_Tp>’ and ‘long long int’
   27 |                 maxa=max(maxa,q-t);
      |                      ~~~^~~~~~~~~~
/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:27:25: note:   mismatched types ‘std::initializer_list<_Tp>’ and ‘long long int’
   27 |                 maxa=max(maxa,q-t);
      |                      ~~~^~~~~~~~~~