Submission #973848

#TimeUsernameProblemLanguageResultExecution timeMemory
973848blackslexSelf Study (JOI22_ho_t2)C++17
0 / 100
437 ms10836 KiB
#include<bits/stdc++.h> using namespace std; using ll = long long; ll n, m; int main() { scanf("%lld %lld", &n, &m); vector<ll> a(n), b(n); for (auto &e: a) scanf("%lld", &e); for (auto &e: b) scanf("%lld", &e); ll l = 1, r = 1e18; while (l <= r) { ll mid = (l + r) >> 1LL; auto ck = [&] (ll val) { ll cnt = 0; for (int i = 0; i < n; i++) { if (b[i] >= a[i]) cnt += (val - 1) / b[i] + 1; else { ll cur = (val - 1) / a[i] + 1; cur = min(cur, m); cnt += cur; ll cval = val - cur * a[i]; if (cval > 0) cnt += (cval - 1) / b[i] + 1; } } return cnt <= 1LL * n * m; }; if (ck(mid)) l = mid + 1; else r = mid - 1; } printf("%lld", r); }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |     scanf("%lld %lld", &n, &m);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~
Main.cpp:11:27: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     for (auto &e: a) scanf("%lld", &e);
      |                      ~~~~~^~~~~~~~~~~~
Main.cpp:12:27: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |     for (auto &e: b) scanf("%lld", &e);
      |                      ~~~~~^~~~~~~~~~~~
#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...