Submission #937953

#TimeUsernameProblemLanguageResultExecution timeMemory
937953LitusianoSelf Study (JOI22_ho_t2)C++17
0 / 100
430 ms7720 KiB
#include<bits/stdc++.h> using namespace std; #define int long long #define endl "\n" vector<pair<int,int>> v; int n,m; bool check(int mid){ vector<int> need(n); int left = 0; for(int i = 0; i<n; i++){ int z = max(v[i].first, v[i].second); int z1 = z + mid -1; int k = (z1)/z; z*=m; if(k > m) need[i] = mid-(z); else left+=m-k; } for(int i = 0; i<n; i++){ int z = need[i]; z += v[i].second; z--; left -= (z)/v[i].second; } return left>=0; } signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); cin>>n>>m; v.resize(n); for(auto& x : v) cin>>x.first; for(auto& x : v) cin>>x.second; int l = 0; int r = 1e18+5; while(r > l+1){ int mid = (l+r)/2; if(check(mid)) l = mid; else r = mid; } cout<<l<<endl; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:33:2: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   33 |  for(auto& x : v) cin>>x.first; for(auto& x : v) cin>>x.second;
      |  ^~~
Main.cpp:33:33: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   33 |  for(auto& x : v) cin>>x.first; for(auto& x : v) cin>>x.second;
      |                                 ^~~
#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...