답안 #921152

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
921152 2024-02-03T11:10:40 Z AnasAAF Self Study (JOI22_ho_t2) C++14
0 / 100
158 ms 5396 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 = 1e18;
    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 600 KB Output is correct
2 Correct 1 ms 344 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 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 600 KB Output is correct
11 Correct 139 ms 5148 KB Output is correct
12 Correct 158 ms 4956 KB Output is correct
13 Correct 141 ms 5396 KB Output is correct
14 Incorrect 153 ms 4956 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 348 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 0 ms 344 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 348 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 115 ms 2652 KB Output is correct
10 Correct 75 ms 1880 KB Output is correct
11 Correct 36 ms 1628 KB Output is correct
12 Correct 31 ms 1416 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 600 KB Output is correct
2 Correct 1 ms 344 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 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 600 KB Output is correct
11 Correct 139 ms 5148 KB Output is correct
12 Correct 158 ms 4956 KB Output is correct
13 Correct 141 ms 5396 KB Output is correct
14 Incorrect 153 ms 4956 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 348 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 0 ms 344 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 348 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 115 ms 2652 KB Output is correct
10 Correct 75 ms 1880 KB Output is correct
11 Correct 36 ms 1628 KB Output is correct
12 Correct 31 ms 1416 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 600 KB Output is correct
2 Correct 1 ms 344 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 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 600 KB Output is correct
11 Correct 139 ms 5148 KB Output is correct
12 Correct 158 ms 4956 KB Output is correct
13 Correct 141 ms 5396 KB Output is correct
14 Incorrect 153 ms 4956 KB Output isn't correct
15 Halted 0 ms 0 KB -