Submission #1062307

#TimeUsernameProblemLanguageResultExecution timeMemory
1062307ducksaysquackSelf Study (JOI22_ho_t2)C++98
0 / 100
200 ms10836 KiB
#include <bits/stdc++.h> #define int long long using namespace std; signed main() { int n, k; cin >> n >> k; vector<int> a(n), b(n); for(int i=0;i<n;i++) cin >> a[i]; for(int i=0;i<n;i++) cin >> b[i]; int l=0, r=4e18; while(l<r) { int m = l+(r-l+1)/2, c = 0; for(int i=0;i<n;i++) { int x = (m+max(a[i],b[i])-1)/max(a[i],b[i]); if(m <= k*max(a[i],b[i])) c += (k-(m+max(a[i],b[i])-1)/max(a[i],b[i])); else c -= (m-k*max(a[i],b[i])+b[i]-1)/b[i]; } if(c >= 0) l = m; else r = m-1; } cout << l; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:12:8: warning: unused variable 'x' [-Wunused-variable]
   12 |    int x = (m+max(a[i],b[i])-1)/max(a[i],b[i]);
      |        ^
#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...