QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#218852#6433. Klee in Solitary ConfinementkokomiisbestWA 1ms3408kbC++14605b2023-10-18 19:20:062023-10-18 19:20:07

Judging History

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

  • [2023-10-18 19:20:07]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3408kb
  • [2023-10-18 19:20:06]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int n,k;
const int N = 1e6+10;
int a[N];
int main(){
    cin>>n>>k;
    unordered_map<int,int> ump,ump1;
    for(int i=1;i<=n;i++){
        int x;
        cin>>x;
        a[i]=x;
        ump[x]++;
        
    }
    int cf=a[0];
    int cnt=1;
    for(int i=2;i<=n;i++){
    	if(a[i]==a[i-1]){
    		cnt++;
		}else{
				ump1[cf+k]=max(ump1[cf+k],cnt);
				cf=a[i];
				cnt=1;
			}
	}
    int max1=0;
    for(auto x:ump){
        max1=max(max1,x.second+ump1[x.first]);
    }
//    cout<<ump[3]<<ump1[3]<<endl;
    cout<<max1;
}

详细

Test #1:

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

input:

5 2
2 2 4 4 4

output:

4

result:

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