Submission #786883

# Submission time Handle Problem Language Result Execution time Memory
786883 2023-07-18T14:13:28 Z WLZ Self Study (JOI22_ho_t2) C++17
0 / 100
279 ms 7360 KB
#include <bits/stdc++.h>
using namespace std;
 
#define int long long

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  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];
  for (int i = 0; i < n; i++) a[i] = max(a[i], b[i]);
 
  auto check = [&](long long k) {
    vector<long long> left(n, k);
    long long weeks_left = (long long) n * m;
    for (int i = 0; i < n; i++) weeks_left -= (k + a[i] - 1) / a[i];
    return weeks_left >= 0;
  };
 
  long long lo = 0, hi = (long long) 2e18;
  while (lo < hi) {
    long long mid = (lo + hi + 1) / 2;
    if (check(mid)) lo = mid;
    else hi = mid - 1;
  }
  cout << lo << '\n';
  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 3 ms 340 KB Output is correct
11 Correct 156 ms 7332 KB Output is correct
12 Correct 152 ms 7352 KB Output is correct
13 Correct 143 ms 7328 KB Output is correct
14 Correct 141 ms 7328 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Incorrect 279 ms 7360 KB Output isn't correct
17 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 279 ms 7360 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 3 ms 340 KB Output is correct
11 Correct 156 ms 7332 KB Output is correct
12 Correct 152 ms 7352 KB Output is correct
13 Correct 143 ms 7328 KB Output is correct
14 Correct 141 ms 7328 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Incorrect 279 ms 7360 KB Output isn't correct
17 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 279 ms 7360 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 3 ms 340 KB Output is correct
11 Correct 156 ms 7332 KB Output is correct
12 Correct 152 ms 7352 KB Output is correct
13 Correct 143 ms 7328 KB Output is correct
14 Correct 141 ms 7328 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Incorrect 279 ms 7360 KB Output isn't correct
17 Halted 0 ms 0 KB -