結果
問題 |
No.568 じゃんじゃん 落とす 委員会
|
ユーザー |
![]() |
提出日時 | 2025-05-17 16:50:23 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,310 bytes |
コンパイル時間 | 1,836 ms |
コンパイル使用メモリ | 88,004 KB |
実行使用メモリ | 21,696 KB |
最終ジャッジ日時 | 2025-05-17 16:50:33 |
合計ジャッジ時間 | 6,957 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | TLE * 1 -- * 25 |
ソースコード
#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; friend bool operator <(Data p1,Data p2){ if(p1.X!=p2.X)return p1.X>p2.X; if(p1.A!=p2.A)return p1.A>p2.A; return p1.B>p2.B; } }a[MAXN]; int n,m,ans=LLONG_MAX,p2=0,p3=0; bool P(int x,int y) { int cnt2=p2,cur=0; if(cnt2>=m)return true; for(int i=p2+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=p3,now=0; for(int i=p3+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); int mxa=-1,mxb=-1; for(int i=1;i<=n;++i) { scanf("%lld%lld%lld",&a[i].X,&a[i].A,&a[i].B); mxa=max(mxa,a[i].A);mxb=max(mxb,a[i].B); } sort(a+1,a+n+1); for(int i=n;i>=1;--i) { if(p2*p3!=0)break; if(a[i].X>=2&&p2==0)p2=i; if(a[i].X>=3&&p3==0)p3=i; } for(int i=0;i<=mxa+1;++i) { int l=0,r=mxb+1,res=0; while(l<=r) { int mid=l+(r-l)/2; if(P(i,mid)) { res=mid; l=mid+1; } else r=mid-1; } ans=min(ans,sol(i,res)); } printf("%lld",ans); return 0; }