Submission #920610

# Submission time Handle Problem Language Result Execution time Memory
920610 2024-02-02T19:03:24 Z imarn Self Study (JOI22_ho_t2) C++14
0 / 100
174 ms 9808 KB
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define f first
#define s second
#define pb push_back
#define all(x) x.begin(),x.end()
#define vi vector<int>
#define vvi vector<vi>
#define vp vector<pii>
using namespace std;
const int N=4e5+5;
int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
    ll n,M;cin>>n>>M;
    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=1,r=1e18;
    while(l<r){
        ll m=(l+r+1)>>1;
        ll cnt=0;
        for(int i=0;i<n;i++){
            if(b[i]>=a[i])cnt+=ceil((double)m/b[i]);
            else {
                ll tt=ceil((double)m/a[i]);
                if(tt<=M)cnt+=tt;
                else {
                    cnt+=M+ceil((double)(m-M*a[i])/b[i]);
                }
            }
        }if(cnt<=M*n)l=m;
        else r=m-1;
    }cout<<l;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 452 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 1 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 604 KB Output is correct
11 Correct 172 ms 9560 KB Output is correct
12 Correct 174 ms 9808 KB Output is correct
13 Correct 127 ms 8076 KB Output is correct
14 Incorrect 126 ms 8196 KB Output isn't correct
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 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 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 70 ms 5224 KB Output is correct
10 Correct 47 ms 3692 KB Output is correct
11 Correct 34 ms 2884 KB Output is correct
12 Correct 28 ms 2528 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 352 KB Output is correct
15 Correct 1 ms 504 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 452 KB Output is correct
18 Incorrect 2 ms 348 KB Output isn't correct
19 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 452 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 1 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 604 KB Output is correct
11 Correct 172 ms 9560 KB Output is correct
12 Correct 174 ms 9808 KB Output is correct
13 Correct 127 ms 8076 KB Output is correct
14 Incorrect 126 ms 8196 KB Output isn't correct
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 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 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 70 ms 5224 KB Output is correct
10 Correct 47 ms 3692 KB Output is correct
11 Correct 34 ms 2884 KB Output is correct
12 Correct 28 ms 2528 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 352 KB Output is correct
15 Correct 1 ms 504 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 452 KB Output is correct
18 Incorrect 2 ms 348 KB Output isn't correct
19 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 452 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 1 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 604 KB Output is correct
11 Correct 172 ms 9560 KB Output is correct
12 Correct 174 ms 9808 KB Output is correct
13 Correct 127 ms 8076 KB Output is correct
14 Incorrect 126 ms 8196 KB Output isn't correct
15 Halted 0 ms 0 KB -