QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#218852 | #6433. Klee in Solitary Confinement | kokomiisbest | WA | 1ms | 3408kb | C++14 | 605b | 2023-10-18 19:20:06 | 2023-10-18 19:20:07 |
Judging History
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'