Submission #991168

# Submission time Handle Problem Language Result Execution time Memory
991168 2024-06-01T13:45:49 Z Otalp Self Study (JOI22_ho_t2) C++14
10 / 100
159 ms 11344 KB
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int ll

ll a[300100];
ll b[300100];
ll n, m;


bool check(ll x){
    ll h = 0;
    //cout<<x<<' ';
    for(int i=1; i<=n; i++){
        if(a[i] > b[i]){
            if(m * a[i] < x){
                h += m;
                h += (x - m * a[i] - 1) / b[i] + 1;
            }
            else{
                h += (x - 1) / a[i] + 1;
            }
        }
        else{
            h += (x - 1) / b[i] + 1;
        }
    }
    //cout<<h<<'\n';
    return h <= m*n;
}


void solve(){
    cin>>n>>m;
    for(int i=1; i<=n; i++){
        cin>>a[i];
    }
    for(int i=1; i<=n; i++){
        cin>>b[i];
    }
    ll ans = 1e18;
    for(int i=1; i<=n; i++) ans = min(ans, max(a[i], b[i]));
    cout<<ans;
}


signed main(){
    solve();
}

# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 0 ms 2396 KB Output is correct
9 Correct 0 ms 2396 KB Output is correct
10 Correct 3 ms 2396 KB Output is correct
11 Correct 140 ms 5088 KB Output is correct
12 Correct 133 ms 5028 KB Output is correct
13 Correct 96 ms 5108 KB Output is correct
14 Correct 106 ms 4944 KB Output is correct
15 Correct 0 ms 2396 KB Output is correct
16 Correct 47 ms 6128 KB Output is correct
17 Correct 147 ms 11344 KB Output is correct
18 Correct 159 ms 10836 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2396 KB Output is correct
2 Correct 47 ms 6128 KB Output is correct
3 Correct 147 ms 11344 KB Output is correct
4 Correct 159 ms 10836 KB Output is correct
5 Incorrect 1 ms 2396 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 0 ms 2396 KB Output is correct
9 Correct 0 ms 2396 KB Output is correct
10 Correct 3 ms 2396 KB Output is correct
11 Correct 140 ms 5088 KB Output is correct
12 Correct 133 ms 5028 KB Output is correct
13 Correct 96 ms 5108 KB Output is correct
14 Correct 106 ms 4944 KB Output is correct
15 Incorrect 1 ms 2396 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 0 ms 2396 KB Output is correct
9 Correct 0 ms 2396 KB Output is correct
10 Correct 3 ms 2396 KB Output is correct
11 Correct 140 ms 5088 KB Output is correct
12 Correct 133 ms 5028 KB Output is correct
13 Correct 96 ms 5108 KB Output is correct
14 Correct 106 ms 4944 KB Output is correct
15 Incorrect 1 ms 2396 KB Output isn't correct
16 Halted 0 ms 0 KB -