Submission #887705

# Submission time Handle Problem Language Result Execution time Memory
887705 2023-12-15T03:24:43 Z Maite_Morale Self Study (JOI22_ho_t2) C++14
0 / 100
424 ms 12568 KB
#include<bits/stdc++.h>
#define F first
#define S second
#define MAX 500005
#define oo 1e18
#define mod 1000000007
#define fast_in ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);cout.setf(ios::fixed);cout.precision(0);
using namespace std;
typedef long long ll;
#define pll pair<ll , ll>
#define vll vector<ll>
#define vvll vector<vll>
#define vpll vector<pll>
 
ll n,k;
pll a[MAX];
ll OK(ll x){
    ll m=k*n,r=0;
    for(int i=0;i<n;i++){
        ll moves=min(k,(x+a[i].F-1)/a[i].F);
        r+=(max((ll)0,x-(a[i].F*moves))+a[i].S-1)/a[i].S;
        m-=moves;
    }
    if(r<=m)return 1;
return 0;
}
int main(){
    fast_in
    cin>>n>>k;
    for(int i=0;i<n;i++){
        cin>>a[i].F;
    }
    for(int i=0;i<n;i++){
        cin>>a[i].S;a[i].F=max(a[i].S,a[i].F);
    }
    ll p=0,f=oo;
    while(abs(p-f)!=1){
        ll m=(p+f)/2;
        if(OK(m)==1)p=m;
        else        f=m;
    }
    cout<<p;
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 0 ms 348 KB Output is correct
4 Correct 1 ms 344 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 460 KB Output is correct
8 Correct 0 ms 468 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 4 ms 604 KB Output is correct
11 Correct 237 ms 12568 KB Output is correct
12 Correct 239 ms 12568 KB Output is correct
13 Correct 228 ms 10600 KB Output is correct
14 Incorrect 424 ms 10592 KB Output isn't correct
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 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 1 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 122 ms 7620 KB Output is correct
10 Correct 82 ms 4440 KB Output is correct
11 Correct 60 ms 4128 KB Output is correct
12 Correct 49 ms 3672 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 0 ms 348 KB Output is correct
17 Correct 0 ms 460 KB Output is correct
18 Incorrect 8 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 0 ms 348 KB Output is correct
4 Correct 1 ms 344 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 460 KB Output is correct
8 Correct 0 ms 468 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 4 ms 604 KB Output is correct
11 Correct 237 ms 12568 KB Output is correct
12 Correct 239 ms 12568 KB Output is correct
13 Correct 228 ms 10600 KB Output is correct
14 Incorrect 424 ms 10592 KB Output isn't correct
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 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 1 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 122 ms 7620 KB Output is correct
10 Correct 82 ms 4440 KB Output is correct
11 Correct 60 ms 4128 KB Output is correct
12 Correct 49 ms 3672 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 0 ms 348 KB Output is correct
17 Correct 0 ms 460 KB Output is correct
18 Incorrect 8 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 0 ms 348 KB Output is correct
4 Correct 1 ms 344 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 460 KB Output is correct
8 Correct 0 ms 468 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 4 ms 604 KB Output is correct
11 Correct 237 ms 12568 KB Output is correct
12 Correct 239 ms 12568 KB Output is correct
13 Correct 228 ms 10600 KB Output is correct
14 Incorrect 424 ms 10592 KB Output isn't correct
15 Halted 0 ms 0 KB -