답안 #860970

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
860970 2023-10-15T01:52:33 Z NeroZein Self Study (JOI22_ho_t2) C++17
0 / 100
426 ms 5204 KB
#include "bits/stdc++.h"
using namespace std;

#ifdef Nero
#include "Deb.h"
#else
#define deb(...)
#endif

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, m;
  cin >> n >> m;
  #define int long long
  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]; 
  }
  auto ch = [&](long long mid) {
    long long days = 0; 
    for (int i = 0; i < n; ++i) {
      if (b[i] >= a[i]) {
        days += (mid + b[i] - 1) / b[i]; 
      } else {
        int t = min((long long) m, (mid + a[i] - 1) / a[i]);
        days += t;
        if (mid - a[i] * t > 0) {
          days += (mid - (long long) a[i] * t + b[i] - 1) / b[i];          
        }
      }
    }
    return days <= (long long) n * m; 
  }; 
  long long l = 0, r = 1e18;
  while (l < r) {
    long long mid = (l + r + 1) / 2;
    if (ch(mid)) l = mid;
    else r = mid - 1;
  }
  cout << l << '\n'; 
  return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 3 ms 348 KB Output is correct
11 Correct 175 ms 5140 KB Output is correct
12 Correct 177 ms 5204 KB Output is correct
13 Correct 131 ms 4952 KB Output is correct
14 Incorrect 426 ms 5144 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 71 ms 2800 KB Output is correct
10 Correct 47 ms 1880 KB Output is correct
11 Correct 36 ms 1880 KB Output is correct
12 Correct 30 ms 1372 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Incorrect 4 ms 348 KB Output isn't correct
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 3 ms 348 KB Output is correct
11 Correct 175 ms 5140 KB Output is correct
12 Correct 177 ms 5204 KB Output is correct
13 Correct 131 ms 4952 KB Output is correct
14 Incorrect 426 ms 5144 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 71 ms 2800 KB Output is correct
10 Correct 47 ms 1880 KB Output is correct
11 Correct 36 ms 1880 KB Output is correct
12 Correct 30 ms 1372 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Incorrect 4 ms 348 KB Output isn't correct
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 3 ms 348 KB Output is correct
11 Correct 175 ms 5140 KB Output is correct
12 Correct 177 ms 5204 KB Output is correct
13 Correct 131 ms 4952 KB Output is correct
14 Incorrect 426 ms 5144 KB Output isn't correct
15 Halted 0 ms 0 KB -