这个为什么才42分,求大佬指点

#include<bits/stdc++.h>
using namespace std;
#define int long long
int n,m,x;
map<int,int>ma;
signed main()
{
	cin>>n>>m;
	for(int i=0;i<n;i++)
	{
		cin>>x;
		ma[x]++;
	}
	int t=1,cnt=0;
	while(ma.count(t)!=0)
	{
		if(t==1)
		cnt+=ma[1];
		else
		{
			cnt+=min(ma[t],ma[t-1]);
		}
		t++;
	}
	cout<<cnt<<endl;
	return 0;
}

全部评论
6 4 1 2 2 2 3 3  轻松hack
2 回复 分享
发布于 2024-08-05 09:08 天津
你需要更新ma[t]的数,从而让经验值更大的一定要小于前面连续最小的
点赞 回复 分享
发布于 2024-08-05 16:53 福建

相关推荐

醉蟀:你不干有的是人干
点赞 评论 收藏
分享
半解316:内容充实,细节需要修改一下。 1,整体压缩为一页。所有内容顶格。 2,项目描述删除,直接写个人工作量 修改完之后还需要建议,可以私聊
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务