Submission #1228792

#TimeUsernameProblemLanguageResultExecution timeMemory
1228792PlayVoltzSelf Study (JOI22_ho_t2)C++20
100 / 100
148 ms4936 KiB
#include <cstdio> #include <stdio.h> #include <stdbool.h> #include <iostream> #include <map> #include <vector> #include <climits> #include <stack> #include <string> #include <queue> #include <algorithm> #include <set> #include <unordered_set> #include <unordered_map> #include <cmath> #include <cctype> #include <bitset> #include <iomanip> #include <cstring> #include <numeric> #include <cassert> using namespace std; #define int long long #define pii pair<int, int> #define mp make_pair #define pb push_back #define fi first #define se second int32_t main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, m; cin>>n>>m; vector<pii> vect(n); for (int i=0; i<n; ++i)cin>>vect[i].fi; for (int i=0; i<n; ++i)cin>>vect[i].se, vect[i].fi=max(vect[i].fi, vect[i].se); int low=-1, high=LLONG_MAX/2; while (low+1<high){ int mid=(low+high)/2; __int128 c=0; for (int i=0; i<n; ++i)c+=min((mid+vect[i].fi-1)/vect[i].fi, m)+max(0ll, ((mid-vect[i].fi*m)+vect[i].se-1)/vect[i].se); if (c<=n*m)low=mid; else high=mid; } cout<<low; }
#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...