QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#218858#6433. Klee in Solitary ConfinementkokomiisbestWA 1ms3492kbC++14605b2023-10-18 19:23:052023-10-18 19:23:05

Judging History

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

  • [2023-10-18 19:23:05]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3492kb
  • [2023-10-18 19:23:05]
  • 提交

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[1];
    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[4]<<ump1[4]<<endl;
    cout<<max1;
}

詳細信息

Test #1:

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

input:

5 2
2 2 4 4 4

output:

5

result:

ok 1 number(s): "5"

Test #2:

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

input:

7 1
3 2 3 2 2 2 3

output:

6

result:

ok 1 number(s): "6"

Test #3:

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

input:

7 1
2 3 2 3 2 3 3

output:

5

result:

ok 1 number(s): "5"

Test #4:

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

input:

9 -100
-1 -2 1 2 -1 -2 1 -2 1

output:

3

result:

ok 1 number(s): "3"

Test #5:

score: -100
Wrong Answer
time: 1ms
memory: 3452kb

input:

200 121649
0 527189 -1000000 -306471 -998939 527189 -1000000 -1000000 0 527189 0 527189 0 527189 -306471 -998939 -306471 -306471 -306471 0 0 527189 527189 1000000 527189 -1000000 1000000 648838 -1000000 -998939 -998939 -998939 0 1000000 -1000000 -998939 527189 1000000 648838 -1000000 1000000 648838 ...

output:

32

result:

wrong answer 1st numbers differ - expected: '37', found: '32'