Submission #995606

# Submission time Handle Problem Language Result Execution time Memory
995606 2024-06-09T12:41:48 Z vysniak_grossmeister Self Study (JOI22_ho_t2) C++17
0 / 100
0 ms 348 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;


int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    ll n, m;
    cin >> n >> m;

    ll a[n + 1];
    for(ll i = 1; i <= n; ++i){
        cin >> a[i];
    }

    ll b[n + 1];
    for(ll i = 1; i <= n; ++i){
        cin >> b[i];
    }

    ll L = 0;
    ll R = 100000000;

    while(R - L > 1){

        ll mid = (L + R) >> 1;

        ll can = 0ll;

        ll need = 0ll;

        for(ll i = 1; i <= n; ++i){

             ll cur = (mid / max(a[i], b[i]) );

             if(mid % (max(a[i], b[i])) != 0) cur++;

             if(cur < n){

                can += (n - cur);

             }
             if(cur > n){

                need += (cur - n);

             }

        }

        if(need <= can){
            L = mid;
        }
        else{
            R = mid;
        }

    }

    cout << L - 1ll << endl;

    return 0;
    // 1000 * 1000 | 33 ?
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -