답안 #921168

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
921168 2024-02-03T11:39:49 Z AnasAAF Self Study (JOI22_ho_t2) C++14
0 / 100
165 ms 5136 KB
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define ld long double

int main(){
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    ll n, m;cin>>n>>m;
    vector<ll>a(n), b(n);
    for(int i=0;i<n;i++)cin>>a[i];
    for(int i=0;i<n;i++)cin>>b[i];

    ll l(0), r = 2e18;
    while(l<r){
        ll mid = (l+r+1)/2;
        //cout<<mid<<" "<<l<<" "<<r<<endl;
        ll ext(0);
        for(int i=0;i<n;i++){
             ext += max((ll)(m - ceil((ld)mid/max(a[i], b[i]))), 0ll);
        }

        for(int i=0;i<n;i++){
            if(m*max(a[i], b[i])>=mid)continue;
            ll sm = ceil((ld)(mid - m*max(a[i], b[i]))/b[i]);
            ext-=sm;
        }

        if(ext<0ll)r=mid-1;
        else l = mid;
    }
    cout<<l<<endl;

    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 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 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 145 ms 5136 KB Output is correct
12 Correct 141 ms 4956 KB Output is correct
13 Correct 165 ms 4956 KB Output is correct
14 Incorrect 151 ms 4956 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 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 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 80 ms 2652 KB Output is correct
10 Correct 51 ms 1880 KB Output is correct
11 Correct 36 ms 1628 KB Output is correct
12 Correct 30 ms 1408 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 3 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 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 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 145 ms 5136 KB Output is correct
12 Correct 141 ms 4956 KB Output is correct
13 Correct 165 ms 4956 KB Output is correct
14 Incorrect 151 ms 4956 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 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 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 80 ms 2652 KB Output is correct
10 Correct 51 ms 1880 KB Output is correct
11 Correct 36 ms 1628 KB Output is correct
12 Correct 30 ms 1408 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 3 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 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 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 145 ms 5136 KB Output is correct
12 Correct 141 ms 4956 KB Output is correct
13 Correct 165 ms 4956 KB Output is correct
14 Incorrect 151 ms 4956 KB Output isn't correct
15 Halted 0 ms 0 KB -