제출 #530285

#제출 시각아이디문제언어결과실행 시간메모리
530285yungyaoSelf Study (JOI22_ho_t2)C++17
0 / 100
305 ms10632 KiB
using namespace std; #include <iostream> #include <algorithm> #include <utility> #include <vector> #include <stack> #include <queue> #include <set> #include <map> typedef long long LL; typedef pair<int,int> pii; #define pb push_back #define mkp make_pair #define F first #define S second #define iter(x) x.begin(),x.end() #define REP(n) for (int __=n;__--;) #define REP0(i,n) for (int i=0;i<n;++i) #define REP1(i,n) for (int i=1;i<=n;++i) const int maxn = 3e5+10, mod = 0; const LL inf = 0; int n; LL m, a[maxn], b[maxn]; bool bs(LL t){ LL cnt = 0; REP1(i, n){ if (b[i] > a[i]) cnt += m - (t + b[i] - 1) / b[i]; else if (a[i] * m >= t) cnt += m - (t + a[i] - 1) / a[i]; else cnt -= (t - a[i] * m + b[i] - 1) / b[i]; } return cnt >= 0; } void solve(){ cin >> n >> m; REP1(i, n) cin >> a[i]; REP1(i, n) cin >> b[i]; LL LB = 0, RB = 1e18; while (LB != RB){ LL m = (LB + RB + 1) / 2; if (bs(m)) LB = m; else RB = m-1; } cout << LB; } int main(){ ios_base::sync_with_stdio(false); cin.tie(0); solve(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...