Submission #921146

# Submission time Handle Problem Language Result Execution time Memory
921146 2024-02-03T11:04:36 Z AnasAAF Self Study (JOI22_ho_t2) C++14
0 / 100
278 ms 5140 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 = 3e18;
    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 0 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 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 0 ms 348 KB Output is correct
10 Correct 3 ms 348 KB Output is correct
11 Correct 192 ms 4956 KB Output is correct
12 Correct 194 ms 5140 KB Output is correct
13 Correct 188 ms 4956 KB Output is correct
14 Incorrect 278 ms 4952 KB Output isn't correct
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 1 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 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 101 ms 2652 KB Output is correct
10 Correct 72 ms 1880 KB Output is correct
11 Correct 49 ms 1628 KB Output is correct
12 Correct 42 ms 1368 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 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 6 ms 348 KB Output isn't correct
19 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 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 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 0 ms 348 KB Output is correct
10 Correct 3 ms 348 KB Output is correct
11 Correct 192 ms 4956 KB Output is correct
12 Correct 194 ms 5140 KB Output is correct
13 Correct 188 ms 4956 KB Output is correct
14 Incorrect 278 ms 4952 KB Output isn't correct
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 1 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 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 101 ms 2652 KB Output is correct
10 Correct 72 ms 1880 KB Output is correct
11 Correct 49 ms 1628 KB Output is correct
12 Correct 42 ms 1368 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 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 6 ms 348 KB Output isn't correct
19 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 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 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 0 ms 348 KB Output is correct
10 Correct 3 ms 348 KB Output is correct
11 Correct 192 ms 4956 KB Output is correct
12 Correct 194 ms 5140 KB Output is correct
13 Correct 188 ms 4956 KB Output is correct
14 Incorrect 278 ms 4952 KB Output isn't correct
15 Halted 0 ms 0 KB -