답안 #973537

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
973537 2024-05-02T06:54:27 Z berr Self Study (JOI22_ho_t2) C++17
0 / 100
271 ms 5148 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
 
 
signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
 
    int n, m; cin >> n>> m;
    vector<int> a(n), b(n);

    for(auto &i: a) cin >> i;
    for(auto &i: b) cin >> i;

    auto check=[&](int x){
        int bos=0;
        for(int i=0; i<n; i++){
            if(a[i]<=b[i]){
                bos+=m;
                bos-=(x+b[i]-1)/b[i];
            }
            else{
                if(m*a[i]>=x){
                    bos+=m-(x+a[i]-1)/a[i];
                }
                else{
                    bos-=(x-m*a[i]+b[i]-1)/b[i];
                }
            }
        }

        return(bos>=0LL);
    };
    int s=0;
    for(int i=59; i>=0; i--){
        int tmp = s+(1LL<<i);
       // cout<<tmp<<"\n";
        if(check(tmp)) s=tmp;
    }

    cout<<s;
}
# 결과 실행 시간 메모리 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 0 ms 348 KB Output is correct
7 Correct 1 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 2 ms 348 KB Output is correct
11 Correct 149 ms 4956 KB Output is correct
12 Correct 148 ms 5148 KB Output is correct
13 Correct 132 ms 5136 KB Output is correct
14 Incorrect 271 ms 5140 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 600 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 348 KB Output is correct
7 Correct 0 ms 420 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 73 ms 2652 KB Output is correct
10 Correct 49 ms 1884 KB Output is correct
11 Correct 36 ms 1628 KB Output is correct
12 Correct 29 ms 1388 KB Output is correct
13 Correct 1 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 348 KB Output is correct
17 Correct 1 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 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 0 ms 348 KB Output is correct
7 Correct 1 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 2 ms 348 KB Output is correct
11 Correct 149 ms 4956 KB Output is correct
12 Correct 148 ms 5148 KB Output is correct
13 Correct 132 ms 5136 KB Output is correct
14 Incorrect 271 ms 5140 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 600 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 348 KB Output is correct
7 Correct 0 ms 420 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 73 ms 2652 KB Output is correct
10 Correct 49 ms 1884 KB Output is correct
11 Correct 36 ms 1628 KB Output is correct
12 Correct 29 ms 1388 KB Output is correct
13 Correct 1 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 348 KB Output is correct
17 Correct 1 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 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 0 ms 348 KB Output is correct
7 Correct 1 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 2 ms 348 KB Output is correct
11 Correct 149 ms 4956 KB Output is correct
12 Correct 148 ms 5148 KB Output is correct
13 Correct 132 ms 5136 KB Output is correct
14 Incorrect 271 ms 5140 KB Output isn't correct
15 Halted 0 ms 0 KB -