제출 #684773

#제출 시각아이디문제언어결과실행 시간메모리
684773US3RN4M3Self Study (JOI22_ho_t2)C++17
0 / 100
582 ms4996 KiB
#include<bits/stdc++.h> using namespace std; using ll = long long; ll n, m; vector<ll> A; vector<ll> B; bool test(ll goal) { ll avail = 0; for(ll i = 0; i < n; i++) { ll used = (goal - 1)/A[i] + 1; if(used <= m) { avail += m - used; continue; } ll left = goal - A[i]*m; ll req = (left - 1)/B[i] + 1; avail -= req; } return (avail >= 0); } main() { cin >> n >> m; A.resize(n); B.resize(n); for(ll & i : A) cin >> i; for(ll & i : B) cin >> i; for(int i = 0; i < n; i++) A[i] = max(A[i], B[i]); ll ans = 0; for(ll delta = (1ll<<60); delta >= 1; delta >>= 1) { if(test(ans + delta)) ans += delta; } //ans = 1e18; //for(ll i = 0; i < n; i++) ans = min(ans, max(A[i], B[i])); cout << ans << endl; }

컴파일 시 표준 에러 (stderr) 메시지

Main.cpp:21:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   21 | main() {
      | ^~~~
#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...