結果
| 問題 | No.568 じゃんじゃん 落とす 委員会 | 
| コンテスト | |
| ユーザー |  vjudge1 | 
| 提出日時 | 2025-05-17 17:27:57 | 
| 言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 1,140 bytes | 
| コンパイル時間 | 1,301 ms | 
| コンパイル使用メモリ | 83,328 KB | 
| 実行使用メモリ | 7,848 KB | 
| 最終ジャッジ日時 | 2025-05-17 17:28:02 | 
| 合計ジャッジ時間 | 3,842 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 10 WA * 16 | 
ソースコード
#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;
				ans=min(ans,sol(res,i));
				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));
//		cout<<i<<"  "<<res<<endl;
	}
	printf("%lld",ans);
	return 0;
}
            
            
            
        