QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#209967#7522. Sequence ShiftAlienCollapsarWA 1ms9832kbC++14886b2023-10-10 20:31:282023-10-10 20:31:28

Judging History

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

  • [2023-10-10 20:31:28]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:9832kb
  • [2023-10-10 20:31:28]
  • 提交

answer

#include<algorithm>
#include<cmath>
#include<cstdio>
#include<iostream>
using namespace std;
const int Maxn=1e6+10;
const int Inf=0x3f3f3f3f;
struct node{int val,id;}a[Maxn];
int b[Maxn<<1],c[Maxn];
int ans[Maxn];
int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);cout.tie(nullptr);
	int n,m;cin>>n>>m;m+=n;
	for(int i=1;i<=n;++i)cin>>c[i],a[i]={c[i],i};
	sort(a+1,a+n+1,[](node fi,node se){
		return fi.val>se.val;
	});
	int lim=max(0.,2-7/sqrt(n))*Inf;
	for(int i=1;i<=m;++i){
		cin>>b[i];
		if(i>n)b[i]^=ans[i-1];
		for(int j=1;j<=n;++j){
            if(a[j].val+b[i]<lim)break;
            int k=i-a[j].id+n;
            if(k>=n&&k<=m)
				ans[k]=max(ans[k],a[j].val+b[i]);
        }
        if(i<n)continue;
        if(!ans[i])
            for(int j=1;j<=n;j++)
				ans[i]=max(ans[i],c[j]+b[i-n+j]);
		cout<<ans[i]<<' ';
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 9832kb

input:

5 3
1 4 3 2 5
7 5 8 3 2
3
6
4

output:

11 13 16 25 

result:

wrong answer 1st lines differ - expected: '11', found: '11 13 16 25 '