結果

問題 No.568 じゃんじゃん 落とす 委員会
ユーザー vjudge1
提出日時 2025-05-17 17:15:51
言語 C++17(gcc12)
(gcc 12.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,077 bytes
コンパイル時間 1,671 ms
コンパイル使用メモリ 83,356 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-05-17 17:15:55
合計ジャッジ時間 4,008 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10 WA * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<algorithm>
#include<iostream>
#include<climits>
#include<cstdio>
#define int long long
using namespace std;
const int MAXN=100010;
struct Data{
	int X,A,B;
}a[MAXN];
int n,m,ans=LLONG_MAX;
bool P(int x,int y)
{
	int cnt2=0,cur=0;
	for(int i=1;i<=n;++i)
	{
		cur=a[i].X;
		cur+=(a[i].A>=x);
		cur+=(a[i].B>=y);
		cnt2+=(cur>=2);
	}
	return cnt2>=m;
}
int sol(int x,int y)
{
	int res=0,now=0;
	for(int i=1;i<=n;++i)
	{
		now=a[i].X;
		now+=(a[i].A>=x);
		now+=(a[i].B>=y);
		res+=(now>=3);
	}
	return res;
}
signed main()
{
//	freopen("difficulty.in","r",stdin);
//	freopen("difficulty.out","w",stdout);
	scanf("%lld%lld",&n,&m);
	for(int i=1;i<=n;++i)
	{
		scanf("%lld%lld%lld",&a[i].X,&a[i].A,&a[i].B);
	}
	int L=0,R=100001,curm=-1,res=-1;
	while(L<=R)
	{
		int i=L+(R-L)/2;
		int l=0,r=100001;
		res=-1;
		while(l<=r)
		{
			int mid=l+(r-l)/2;
			if(P(i,mid))
			{
				res=mid;
				l=mid+1;
			}
			else 
			{
				r=mid-1;
			}
		}
		if(res!=-1)
		{
			curm=i;
			L=i+1;
		}
		else R=i-1;
		if(curm!=-1)ans=min(ans,sol(curm,res));
	}
	printf("%lld",ans);
	return 0;
}
0