답안 #803728

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
803728 2023-08-03T05:42:35 Z vjudge1 Self Study (JOI22_ho_t2) C++17
0 / 100
433 ms 5020 KB
#ifdef Home
#define _GLIBCXX_DEBUG
#endif // Home

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

main() {
#ifdef Home
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif // Home
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    ll n, m;
    cin >> n >> m;
    vector < ll > A(n), B(n);
    for(auto &i : A) {
        cin >> i;
    }
    for(auto &i : B) {
        cin >> i;
    }
    ll l = 0, r = 2e18, mid, a, b, c;
    for(; l + 1 < r;) {
        mid = (l + r) / 2;
        c = 0;
        for(int i = 0; i < n; ++ i) {
            a = mid;
            if(B[i] >= A[i]) {
                c += m - (a + B[i] - 1) / B[i];
            } else {
                b = min(m, (a + A[i] - 1) / A[i]);
                c += m - b;
                a = max(0ll, a - b * A[i]);
                c -= (a + B[i] - 1) / B[i];
            }
        }
        (c < 0 ? r : l) = mid;
    }
    cout << l;
} 

Compilation message

Main.cpp:12:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   12 | main() {
      | ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 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 0 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 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 4 ms 340 KB Output is correct
11 Correct 196 ms 5012 KB Output is correct
12 Correct 208 ms 5004 KB Output is correct
13 Correct 139 ms 5020 KB Output is correct
14 Incorrect 433 ms 5004 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 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 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 73 ms 2644 KB Output is correct
10 Correct 49 ms 1876 KB Output is correct
11 Correct 37 ms 1492 KB Output is correct
12 Correct 30 ms 1236 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 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 0 ms 212 KB Output is correct
2 Correct 0 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 0 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 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 4 ms 340 KB Output is correct
11 Correct 196 ms 5012 KB Output is correct
12 Correct 208 ms 5004 KB Output is correct
13 Correct 139 ms 5020 KB Output is correct
14 Incorrect 433 ms 5004 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 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 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 73 ms 2644 KB Output is correct
10 Correct 49 ms 1876 KB Output is correct
11 Correct 37 ms 1492 KB Output is correct
12 Correct 30 ms 1236 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 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 0 ms 212 KB Output is correct
2 Correct 0 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 0 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 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 4 ms 340 KB Output is correct
11 Correct 196 ms 5012 KB Output is correct
12 Correct 208 ms 5004 KB Output is correct
13 Correct 139 ms 5020 KB Output is correct
14 Incorrect 433 ms 5004 KB Output isn't correct
15 Halted 0 ms 0 KB -