답안 #921156

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
921156 2024-02-03T11:14:27 Z AnasAAF Self Study (JOI22_ho_t2) C++14
0 / 100
90 ms 5156 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 = 1e9;
    while(l<r){
        ll mid = (l+r)/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<0){
            r=mid;
        }
        else l = mid+1;
    }
    cout<<l-1<<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 344 KB Output is correct
5 Correct 1 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 2 ms 348 KB Output is correct
11 Correct 83 ms 5140 KB Output is correct
12 Correct 90 ms 5156 KB Output is correct
13 Incorrect 69 ms 4952 KB Output isn't correct
14 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 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 344 KB Output is correct
5 Correct 1 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 2 ms 348 KB Output is correct
11 Correct 83 ms 5140 KB Output is correct
12 Correct 90 ms 5156 KB Output is correct
13 Incorrect 69 ms 4952 KB Output isn't correct
14 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 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 344 KB Output is correct
5 Correct 1 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 2 ms 348 KB Output is correct
11 Correct 83 ms 5140 KB Output is correct
12 Correct 90 ms 5156 KB Output is correct
13 Incorrect 69 ms 4952 KB Output isn't correct
14 Halted 0 ms 0 KB -