UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#152568#776. 被删除a次的题目DZR01ms1324kbC++861b2022-08-01 10:11:052022-08-01 10:11:06

answer

#include<bits/stdc++.h>
using namespace std;
struct node{
	int id,num,step;
	bool operator < (const node& rhs) const {
		return num<rhs.num;
	}
};
priority_queue<node>pq;
const int N=1e5+5;
int n,m,a[N],b[N];
int main()
{
	cin>>n>>m;
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	for(int i=1;i<=m;i++)
		scanf("%d",&b[i]);
	for(int i=1;i<=n;i++){
		node now;
		now.id=i;
		now.num=a[i];
		now.step=1;
		pq.push(now);
	}
	long long ans=0,sum=0;
	while(m--){
		node now;
		now=pq.top();
		sum+=now.num;
		pq.pop();
		if(ans==0)ans=sum;
		else ans^=sum;
		if(now.step==3)continue;
		else {
			node p;
			if(now.step==2){
				p.num=a[now.id];
				p.id=now.id;
				p.step=now.step+1;
			} 
			else if(now.step==1){
				p.num=b[now.id];
				p.id=now.id;
				p.step=now.step+1;
			} 
			pq.push(p);
		}
	}
	cout<<ans;
}

详细

小提示:点击横条可展开更详细的信息

Test #1:

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

input:

6
1 matthew hi
1 matthew hi
1 matthew hi
1 you hi
1 matthew youdidntprintnone
1 you thanks

output:

0

result:

wrong answer 1st words differ - expected: 'None', found: '0'

Test #2:

score: 0
Wrong Answer
time: 0ms
memory: 1304kb

input:

1000
1 cktdyngn xspypshurdrerjlkwxnctuolrcmaciahovqproukzgjhqfrsdx
1 poisson thanks
1 ogxbajkokd van...

output:

0

result:

wrong answer 1st words differ - expected: 'a', found: '0'

Test #3:

score: 0
Wrong Answer
time: 0ms
memory: 1300kb

input:

1000
1 c dyqqaiyuyeliwupppcvhtnwpuveoanaaxykdqnavmqxwpvzwru
1 c dyqqaiyuyeliwupppcvhtnwpuveoanaaxykd...

output:

0

result:

wrong answer 1st words differ - expected: 'ablcscp', found: '0'

Test #4:

score: 0
Wrong Answer
time: 0ms
memory: 1300kb

input:

1000
1 olswro siyqlavlnnknshqvldsmtegczpthqfciytlrlximfjrtqnnylrl
1 bba thanks
1 mddm znsescdiomrhlo...

output:

0

result:

wrong answer 1st words differ - expected: 'a', found: '0'

Test #5:

score: 0
Wrong Answer
time: 0ms
memory: 1304kb

input:

1000
1 qclshltty cloyotlcshnvqwagnibhbxxvrvmvvbovdmcahgvgazoxwrhborotulcjpcsddlfpakdj
1 pildm thanks...

output:

0

result:

wrong answer 1st words differ - expected: 'a', found: '0'

Test #6:

score: 0
Wrong Answer
time: 0ms
memory: 1324kb

input:

1000
2 10 svucl orzovok ownt pg ts jgesl eokfcnfd qisgh pallolh tkjlve
1 lfrzsos qliopbyobhhrp
1 pig...

output:

0

result:

wrong answer 1st words differ - expected: 'bfmzetuyc', found: '0'

Test #7:

score: 0
Wrong Answer
time: 0ms
memory: 1300kb

input:

1000
1 gjhg qcmcdzizgrgoszfolkhywndkhxyoubelflhbinzkdbkearyujohzcpzontzbwnzezjkcxvvspxcsbiurwwgwpnta...

output:

0

result:

wrong answer 1st words differ - expected: 'ahvhp', found: '0'

Test #8:

score: 0
Wrong Answer
time: 0ms
memory: 1300kb

input:

1000
1 jrtdffp emwblffpvlzifzgqskcwjumwwxdphswniflivopkmbfsrkqdnesfcnhwgjzzb
1 jrtdffp emwblffpvlzif...

output:

0

result:

wrong answer 1st words differ - expected: 'atjdhcb', found: '0'

Test #9:

score: 0
Wrong Answer
time: 0ms
memory: 1320kb

input:

1000
2 10 akdhlldyie qplrvig tr ukut xthhsh aa ljgwep kivyhk nrgfiniqo tl
2 10 flvvcbx aaaa vpezzq y...

output:

0

result:

wrong answer 1st words differ - expected: 'aaaaaab', found: '0'

Test #10:

score: 0
Wrong Answer
time: 0ms
memory: 1304kb

input:

1000
1 vhxpkhhct hwjrrfipjtcfrqxhelhjjgfkyyjnnihqdshacuqamytxlhjqwtpqgkdqbfpotdjgdvkojfozk
2 10 fdww...

output:

0

result:

wrong answer 1st words differ - expected: 'adcvqc', found: '0'