QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#193876#7522. Sequence Shiftucup-team896#Compile Error//C++141.1kb2023-09-30 17:59:332023-09-30 17:59:35

Judging History

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

  • [2023-09-30 17:59:35]
  • 评测
  • [2023-09-30 17:59:33]
  • 提交

answer

#pragma GCC optimize(2, 3, "Ofast")
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=1e6+7;
int n,q,a[N],b[N*2],c[N],d[N*2];
int ans[N],lim,maxn[N];
vector<int>e;
void del(int id){
	for(int i=1;i<=710;i++)
		if(maxn[i]==id){
			for(int j=i;j<710;j++)
				maxn[i]=maxn[i+1];
		}
	return; 
}void add(int vl,int id){
	for(int i=1;i<=710;i++)
		if(vl>b[maxn[i]]){
			for(int j=710;j>i;j--)
				maxn[j]=maxn[j-1];
			maxn[i]=id;
			return;
		}
	return;
}
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);cin>>n>>q;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		c[i]=a[i];
	}sort(c+1,c+n+1);
	lim=c[max(1,n-N*400/n)];
	for(int i=1;i<=n;i++)
		cin>>b[i];
	for(int i=1;i<=n;i++)
		if(a[i]>=lim)e.push_back(i);
	int ans=0;
	for(int i=1;i<=n;i++){
		ans=max(ans,a[i]+b[i]);
		add(b[i],i);
	}
	cout<<ans<<"\n";
	for(int i=1;i<=q;i++){
		del(i);
		cin>>b[n+i];
		b[n+i]^=ans;ans=0;
		add(b[n+i],n+i);
		for(auto v:e)ans=max(ans,a[v]+b[v+i]);
		for(int j=1;j<=710;j++)if(maxn[j]>=i+1&&maxn[j]<=i+n)
			ans=max(ans,b[maxn[j]]+a[maxn[j]-i]);
		cout<<ans<<"\n";
	}return 0;
}

详细

answer.code: In function ‘int main()’:
answer.code:33:18: error: no matching function for call to ‘max(int, long long int)’
   33 |         lim=c[max(1,n-N*400/n)];
      |               ~~~^~~~~~~~~~~~~
In file included from /usr/include/c++/11/bits/char_traits.h:39,
                 from /usr/include/c++/11/ios:40,
                 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 answer.code:2:
/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:
answer.code:33:18: note:   deduced conflicting types for parameter ‘const _Tp’ (‘int’ and ‘long long int’)
   33 |         lim=c[max(1,n-N*400/n)];
      |               ~~~^~~~~~~~~~~~~
In file included from /usr/include/c++/11/bits/char_traits.h:39,
                 from /usr/include/c++/11/ios:40,
                 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 answer.code:2:
/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:
answer.code:33:18: note:   deduced conflicting types for parameter ‘const _Tp’ (‘int’ and ‘long long int’)
   33 |         lim=c[max(1,n-N*400/n)];
      |               ~~~^~~~~~~~~~~~~
In file included from /usr/include/c++/11/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from answer.code:2:
/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:
answer.code:33:18: note:   mismatched types ‘std::initializer_list<_Tp>’ and ‘int’
   33 |         lim=c[max(1,n-N*400/n)];
      |               ~~~^~~~~~~~~~~~~
In file included from /usr/include/c++/11/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from answer.code:2:
/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:
answer.code:33:18: note:   mismatched types ‘std::initializer_list<_Tp>’ and ‘int’
   33 |         lim=c[max(1,n-N*400/n)];
      |               ~~~^~~~~~~~~~~~~