답안 #860969

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
860969 2023-10-15T01:51:53 Z NeroZein Self Study (JOI22_ho_t2) C++17
0 / 100
428 ms 8592 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;
  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 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 1 ms 348 KB Output is correct
10 Correct 3 ms 344 KB Output is correct
11 Correct 180 ms 8592 KB Output is correct
12 Correct 181 ms 8532 KB Output is correct
13 Correct 132 ms 6608 KB Output is correct
14 Incorrect 428 ms 6608 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 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 1 ms 604 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 72 ms 4304 KB Output is correct
10 Correct 48 ms 3164 KB Output is correct
11 Correct 36 ms 2396 KB Output is correct
12 Correct 34 ms 1880 KB Output is correct
13 Correct 2 ms 348 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 600 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 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 1 ms 348 KB Output is correct
10 Correct 3 ms 344 KB Output is correct
11 Correct 180 ms 8592 KB Output is correct
12 Correct 181 ms 8532 KB Output is correct
13 Correct 132 ms 6608 KB Output is correct
14 Incorrect 428 ms 6608 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 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 1 ms 604 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 72 ms 4304 KB Output is correct
10 Correct 48 ms 3164 KB Output is correct
11 Correct 36 ms 2396 KB Output is correct
12 Correct 34 ms 1880 KB Output is correct
13 Correct 2 ms 348 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 600 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 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 1 ms 348 KB Output is correct
10 Correct 3 ms 344 KB Output is correct
11 Correct 180 ms 8592 KB Output is correct
12 Correct 181 ms 8532 KB Output is correct
13 Correct 132 ms 6608 KB Output is correct
14 Incorrect 428 ms 6608 KB Output isn't correct
15 Halted 0 ms 0 KB -