結果
| 問題 | No.3422 Sazanka's hobby |
| コンテスト | |
| ユーザー |
ZeriToki
|
| 提出日時 | 2026-01-11 13:50:48 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 319 ms / 2,000 ms |
| コード長 | 886 bytes |
| 記録 | |
| コンパイル時間 | 3,318 ms |
| コンパイル使用メモリ | 343,100 KB |
| 実行使用メモリ | 27,552 KB |
| 最終ジャッジ日時 | 2026-01-11 13:50:55 |
| 合計ジャッジ時間 | 6,595 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 13 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long mod=998244353;
const long long mod2=469762049;
int main(){
cin.tie(0)->sync_with_stdio(0);
cout.tie(0);
int N;
ll M;
cin>>N>>M;
ll a[N+1],b[N+1];
for(int i=1;i<=N;i++) cin>>a[i]>>b[i];
vector<ll>border;
for(int i=1;i<=N;i++){
int k=M-a[i];
k/=b[i];
k++;
border.push_back(k);
}
sort(border.begin(),border.end());
int l=1,r=N+1;
while(l!=r){
int m=(l+r)/2;
bool ok=1;
int day=0;
//cout<<m<<" ";
for(int i=0;i<N;i++){
if(i%m==0) day++;
if(border[i]<day) ok=0;
//cout<<border[i]<<":"<<day<<" ";
}
//cout<<endl;
if(ok) r=m;
else l=m+1;
}
cout<<l<<"\n";
}
ZeriToki