QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#193433#7522. Sequence Shiftucup-team896#WA 1ms9808kbC++141.0kb2023-09-30 17:09:012023-09-30 17:09:01

Judging History

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

  • [2023-09-30 17:09:01]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:9808kb
  • [2023-09-30 17:09:01]
  • 提交

answer

#include<bits/stdc++.h>
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;
vector<int>e;
int maxn[210];
void del(int id){
	for(int i=1;i<=100;i++)
		if(maxn[i]==id){
			for(int j=i;j<100;j++)
				maxn[i]=maxn[i+1];
		}
	return; 
}void add(int vl,int id){
	for(int i=1;i<=100;i++)
		if(vl>b[maxn[i]]||maxn[i]==0){
			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*620/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;
		add(b[n+i],n+i);
		for(auto v:e)ans=max(ans,a[v]+b[v+i]);
		//for(int j=1;j<=100;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;
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 9772kb

input:

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

output:

11
13
16
25

result:

ok 4 lines

Test #2:

score: 0
Accepted
time: 0ms
memory: 9800kb

input:

1 0
103509429
823330096

output:

926839525

result:

ok single line: '926839525'

Test #3:

score: -100
Wrong Answer
time: 0ms
memory: 9808kb

input:

1 1
576560149
691846236
1156187222

output:

1268406385
1268406385

result:

wrong answer 2nd lines differ - expected: '835582012', found: '1268406385'