QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#193322#7522. Sequence Shiftucup-team896#WA 21ms11580kbC++14612b2023-09-30 16:54:242023-09-30 16:54:25

Judging History

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

  • [2023-09-30 16:54:25]
  • 评测
  • 测评结果:WA
  • 用时:21ms
  • 内存:11580kb
  • [2023-09-30 16:54:24]
  • 提交

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;
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-200)];
	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]);
	cout<<ans<<"\n";
	for(int i=1;i<=q;i++){
		cin>>b[n+i];
		b[n+i]^=ans;ans=0;
		for(auto v:e)ans=max(ans,a[v]+b[v+i]);
		cout<<ans<<"\n";
	}return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 9584kb

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: 9480kb

input:

1 0
103509429
823330096

output:

926839525

result:

ok single line: '926839525'

Test #3:

score: 0
Accepted
time: 1ms
memory: 9576kb

input:

1 1
576560149
691846236
1156187222

output:

1268406385
835582012

result:

ok 2 lines

Test #4:

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

input:

1 10
700282491
332230980
90825676
1630266999
644973380
262379760
2122877054
1851957134
1370195232
110993724
1319359505
1883523208

output:

1032513471
1654684398
759763732
888538827
1695749302
1163465539
1425605448
789576931
1397740634
1202288326
1638577353

result:

ok 11 lines

Test #5:

score: 0
Accepted
time: 21ms
memory: 11580kb

input:

1000 100000
438001359 929744877 710148392 323984311 727016267 323629255 495752276 309120511 312675195 717795522 937464489 624952229 444774478 829169766 707441777 609125148 25459976 849166512 716162953 882416779 189669312 135698832 632796131 592794700 569746403 231058028 389412868 824283503 801480367...

output:

1962871590
1986083253
1967509108
1973351244
1974354421
1956371849
1976394149
1995721753
1946870160
1984280254
1961237540
1955903880
1944520591
1937726835
1993563403
1927000559
1951483558
1979133252
1979156812
1941301401
1922284543
1980597785
1963663583
1946961524
1933606347
1953947075
1953071855
194...

result:

ok 100001 lines

Test #6:

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

input:

10000 10000
760845880 236665988 765352292 817854026 789863420 399953246 270535243 932350041 48814223 670950468 456660682 416165008 999681497 666880584 56581573 134567049 403285848 144814129 973325555 23519957 518449311 738687225 345716065 2309498 477743569 555951695 911860717 920761968 569179690 349...

output:

1990514380
1962245215
1992500750
1994731468
1983411218
1986646709
1979643361
1990060423
1988174297
1983373232
1995134632
1989936349
1993187026
1988927807
1971595730
1988272839
1990590966
1976493105
1987819156
1987483957
1979800700
1986611531
1973877196
1995735988
1985734454
1987573480
1988935268
199...

result:

wrong answer 2nd lines differ - expected: '1974843876', found: '1962245215'