QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#661226#5149. Best Carry PlayerTytytony#WA 0ms5796kbC++23476b2024-10-20 15:21:542024-10-20 15:21:59

Judging History

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

  • [2024-10-20 15:21:59]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:5796kb
  • [2024-10-20 15:21:54]
  • 提交

answer

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#define N 500010
using namespace std;

int n,a[N],Map[N],cnt;

int main(){
	int T; cin>>T;
	while(T--){
		cin>>n;
		cnt=0;
		for(int i=1;i<=n+1;i++){
			Map[i]=0;
		}
		for(int i=0;i<n;i++){
			cin>>a[i];
			if(Map[a[i]+1]==1){
				Map[a[i]+1]=0;
				Map[a[i]]=1;
			}
			else{
				cnt++;
				Map[a[i]]=1;
			}
		}
		cout<<cnt<<endl;
	} 
	return 0;

}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2
3
9 99 999
1
12345

output:

3
1

result:

wrong answer 1st numbers differ - expected: '5', found: '3'