結果
問題 |
No.568 じゃんじゃん 落とす 委員会
|
ユーザー |
![]() |
提出日時 | 2025-05-17 17:36:52 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,035 bytes |
コンパイル時間 | 1,870 ms |
コンパイル使用メモリ | 159,896 KB |
実行使用メモリ | 21,704 KB |
最終ジャッジ日時 | 2025-05-17 17:36:59 |
合計ジャッジ時間 | 6,077 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | TLE * 1 -- * 25 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define int long long int a[100005], b[100005], x[100005], cnt2 = 0, cnt3 = 0, n, m; int Sa; int ck(int X) { int c2 = 0, c3 = 0; for(int i = 1; i <= n; i++) { if((b[i] >= X)+x[i]+(a[i]>=Sa) >= 2) c2++; if((b[i] >= X)+x[i]+(a[i]>=Sa) >= 3) c3++; } if(c2 < m) return 999999999; return c3; } signed main() { ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin >> n >> m; for(int i = 1; i <= n; i++) { cin >> x[i] >> a[i] >> b[i]; } int Ans = 999999999; for(Sa = 0; Sa <= 100001; Sa++) { cnt2 = cnt3 = 0; // for(int i = 1; i <= n; i++) // { // if(x[i]+(a[i]>=Sa) >= 2) cnt2++; // if(x[i]+(a[i]>=Sa) >= 3) cnt3++; // } int l = 0, r = 100001, ans = 0; while(l < r) { int mid = (l+r)/2; int Ck = ck(mid); if(r-l == 1) { ans = min(ck(l), ck(r)); break; } //cout << Ck << ' ' << l << ' ' << r << '\n'; if(Ck == 999999999) r = mid-1; else { l = mid; ans = Ck; } } Ans = min(Ans, ans); } cout << Ans << endl; }