Submission #534347

#TimeUsernameProblemLanguageResultExecution timeMemory
534347PikaQSelf Study (JOI22_ho_t2)C++17
0 / 100
1 ms312 KiB
#include<bits/stdc++.h> #define forn(i,n) for(int i = 0;i < (n);i++) #define Forn(i,n) for(int i = 1;i <= (n);i++) #define all(p) p.begin(),p.end() #define pb push_back #define F first #define S second #define rz resize #define sz(x) x.size() #define int long long #define vi vector<int> #define pii pair<int,int> using namespace std; const int INF = 5000009; int n,m; void solve(){ cin >> n >> m; vi a(n),b(n); forn(i,n) cin >> a[i]; forn(i,n) cin >> b[i]; forn(i,n){ if(b[i] > a[i]) a[i] = max(b[i],a[i]); } int lo = 0,hi = 2e18; while(lo != hi-1){ int mid = (lo+hi)/2; int res = 0; forn(i,n){ if(a[i] * m < mid){ res -= ceil(((double)mid - a[i] * m) / b[i]); continue; } int c = ceil(mid/a[i]); res += (m-c); } if(res >= 0) lo = mid; else hi = mid; } cout << lo << '\n'; } signed main(){ cin.tie(NULL); cout.tie(NULL); ios_base::sync_with_stdio(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...