結果
| 問題 | No.3422 Sazanka's hobby |
| コンテスト | |
| ユーザー |
SnowBeenDiding
|
| 提出日時 | 2026-01-11 14:41:05 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 468 ms / 2,000 ms |
| コード長 | 1,318 bytes |
| 記録 | |
| コンパイル時間 | 8,923 ms |
| コンパイル使用メモリ | 425,208 KB |
| 実行使用メモリ | 18,996 KB |
| 最終ジャッジ日時 | 2026-01-11 14:41:23 |
| 合計ジャッジ時間 | 13,063 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 13 |
ソースコード
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <atcoder/all>
#define rep(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
using namespace atcoder;
using namespace std;
typedef long long ll;
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
int n = v.size();
rep(i, 0, n) { os << v[i] << " \n"[i == n - 1]; }
return os;
}
void solve() {
int n, m;
cin >> n >> m;
vector<int> a(n), b(n), d(n);
rep(i, 0, n) {
cin >> a[i] >> b[i];
d[i] = (m - a[i]) / b[i];
}
sort(d.begin(), d.end());
auto check = [&](ll mid) {
vector<int> e(n);
int cur = -1;
rep(i, 0, n) {
if (i % mid == 0) cur++;
e[i] = cur;
}
rep(i, 0, n) if (e[i] > d[i]) return 0;
return 1;
};
auto binary = [&]() {
ll ac = n + 1, wa = 0;
while (llabs(ac - wa) > 1) {
ll mid = ac + (wa - ac) / 2;
if (check(mid)) {
ac = mid;
} else {
wa = mid;
}
}
return ac;
};
cout << binary() << endl;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t = 1;
while (t--) solve();
}
SnowBeenDiding