Submission #921144

# Submission time Handle Problem Language Result Execution time Memory
921144 2024-02-03T11:03:09 Z AnasAAF Self Study (JOI22_ho_t2) C++14
0 / 100
250 ms 8216 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 = 1e17;
    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(m - ((mid+(max(a[i], b[i])-1))/(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;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 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 0 ms 348 KB Output is correct
9 Correct 0 ms 456 KB Output is correct
10 Correct 3 ms 600 KB Output is correct
11 Correct 193 ms 8216 KB Output is correct
12 Correct 175 ms 8020 KB Output is correct
13 Correct 195 ms 7192 KB Output is correct
14 Incorrect 250 ms 7188 KB Output isn't correct
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 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 95 ms 4588 KB Output is correct
10 Correct 61 ms 3164 KB Output is correct
11 Correct 47 ms 2648 KB Output is correct
12 Correct 48 ms 2140 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 1 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Incorrect 5 ms 348 KB Output isn't correct
19 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 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 0 ms 348 KB Output is correct
9 Correct 0 ms 456 KB Output is correct
10 Correct 3 ms 600 KB Output is correct
11 Correct 193 ms 8216 KB Output is correct
12 Correct 175 ms 8020 KB Output is correct
13 Correct 195 ms 7192 KB Output is correct
14 Incorrect 250 ms 7188 KB Output isn't correct
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 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 95 ms 4588 KB Output is correct
10 Correct 61 ms 3164 KB Output is correct
11 Correct 47 ms 2648 KB Output is correct
12 Correct 48 ms 2140 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 1 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Incorrect 5 ms 348 KB Output isn't correct
19 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 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 0 ms 348 KB Output is correct
9 Correct 0 ms 456 KB Output is correct
10 Correct 3 ms 600 KB Output is correct
11 Correct 193 ms 8216 KB Output is correct
12 Correct 175 ms 8020 KB Output is correct
13 Correct 195 ms 7192 KB Output is correct
14 Incorrect 250 ms 7188 KB Output isn't correct
15 Halted 0 ms 0 KB -