# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
703251 | 2023-02-26T18:24:01 Z | MilosMilutinovic | Self Study (JOI22_ho_t2) | C++14 | 312 ms | 8508 KB |
/** * author: wxhtzdy * created: 26.02.2023 19:18:55 **/ #include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, m; cin >> n >> m; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } vector<int> b(n); for (int i = 0; i < n; i++) { cin >> b[i]; if (a[i] < b[i]) { a[i] = b[i]; } } auto Solve = [&](long long x) { long long f = 0; for (int i = 0; i < n; i++) { if (m * 1LL * a[i] >= x) { long long take = (x + a[i] - 1) / a[i]; f += m - take; } } for (int i = 0; i < n; i++) { if (m * 1LL * a[i] < x) { long long need = (x - m * 1LL * a[i] + b[i] - 1) / b[i]; f -= need; } } return f >= 0; }; long long low = 0, high = 1e18, ans = 0; while (low <= high) { long long mid = low + high >> 1; if (Solve(mid)) { ans = mid; low = mid + 1; } else { high = mid - 1; } } cout << ans << '\n'; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 312 KB | Output is correct |
3 | Correct | 1 ms | 312 KB | Output is correct |
4 | Correct | 0 ms | 320 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 316 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 | 186 ms | 8508 KB | Output is correct |
12 | Correct | 196 ms | 8452 KB | Output is correct |
13 | Correct | 164 ms | 6348 KB | Output is correct |
14 | Incorrect | 312 ms | 6472 KB | Output isn't correct |
15 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | 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 | 0 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 320 KB | Output is correct |
9 | Correct | 93 ms | 4396 KB | Output is correct |
10 | Correct | 58 ms | 3020 KB | Output is correct |
11 | Correct | 44 ms | 2268 KB | Output is correct |
12 | Correct | 38 ms | 1876 KB | Output is correct |
13 | Correct | 1 ms | 212 KB | Output is correct |
14 | Correct | 1 ms | 212 KB | Output is correct |
15 | Correct | 0 ms | 212 KB | Output is correct |
16 | Correct | 1 ms | 212 KB | Output is correct |
17 | Correct | 1 ms | 212 KB | Output is correct |
18 | Incorrect | 5 ms | 340 KB | Output isn't correct |
19 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 312 KB | Output is correct |
3 | Correct | 1 ms | 312 KB | Output is correct |
4 | Correct | 0 ms | 320 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 316 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 | 186 ms | 8508 KB | Output is correct |
12 | Correct | 196 ms | 8452 KB | Output is correct |
13 | Correct | 164 ms | 6348 KB | Output is correct |
14 | Incorrect | 312 ms | 6472 KB | Output isn't correct |
15 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | 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 | 0 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 320 KB | Output is correct |
9 | Correct | 93 ms | 4396 KB | Output is correct |
10 | Correct | 58 ms | 3020 KB | Output is correct |
11 | Correct | 44 ms | 2268 KB | Output is correct |
12 | Correct | 38 ms | 1876 KB | Output is correct |
13 | Correct | 1 ms | 212 KB | Output is correct |
14 | Correct | 1 ms | 212 KB | Output is correct |
15 | Correct | 0 ms | 212 KB | Output is correct |
16 | Correct | 1 ms | 212 KB | Output is correct |
17 | Correct | 1 ms | 212 KB | Output is correct |
18 | Incorrect | 5 ms | 340 KB | Output isn't correct |
19 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 312 KB | Output is correct |
3 | Correct | 1 ms | 312 KB | Output is correct |
4 | Correct | 0 ms | 320 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 316 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 | 186 ms | 8508 KB | Output is correct |
12 | Correct | 196 ms | 8452 KB | Output is correct |
13 | Correct | 164 ms | 6348 KB | Output is correct |
14 | Incorrect | 312 ms | 6472 KB | Output isn't correct |
15 | Halted | 0 ms | 0 KB | - |