Submission #1086635

#TimeUsernameProblemLanguageResultExecution timeMemory
1086635dwuySelf Study (JOI22_ho_t2)C++14
10 / 100
66 ms11344 KiB
/** - dwuy -       />  フ       |  _  _|       /`ミ _x ノ      /      |     /  ヽ   ?  / ̄|   | | |  | ( ̄ヽ__ヽ_)_)  \二つ **/ #include <bits/stdc++.h> #define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL) #define file(a) freopen(a".inp","r",stdin); freopen(a".out", "w",stdout) #define fi first #define se second #define endl "\n" #define len(s) (int)((s).size()) #define MASK(k)(1LL<<(k)) #define TASK "test" #define int long long using namespace std; typedef tuple<int, int, int> tpiii; typedef pair<double, double> pdd; typedef pair<int, int> pii; typedef long long ll; const long long OO = 1e18; const int MOD = 1e9 + 7; const int INF = 1e9; const int MX = 300005; int n, m; int a[MX]; int b[MX]; int32_t main(){ fastIO; //file(TASK); cin >> n >> m; for(int i=1; i<=n; i++) cin >> a[i]; for(int i=1; i<=n; i++) cin >> b[i]; for(int i=1; i<=n; i++) a[i] = max(a[i], b[i]); int res = 0; for(int lo=1, hi=OO; lo<=hi;){ int mid = (lo + hi)>>1; int fund = 0; for(int i=1; i<=n; i++){ int d = mid/a[i] + !!(mid%a[i]); if(d <= m) fund += m - d; else{ int f = mid - a[i]*m; fund -= f/b[i] + !!(f%b[i]); } if(m + fund < 0) break; } if(fund >= 0) res = mid, lo = mid + 1; else hi = mid - 1; } cout << res; 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...