# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
991160 |
2024-06-01T13:28:49 Z |
Otalp |
Self Study (JOI22_ho_t2) |
C++14 |
|
229 ms |
10780 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 l=0, r=1e18;
while(l < r){
ll mid=(l+r)/2;
if(check(mid)) l = mid + 1;
else r = mid;
}
cout<<r - 1;
}
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 |
0 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 |
1 ms |
2396 KB |
Output is correct |
9 |
Correct |
1 ms |
2396 KB |
Output is correct |
10 |
Correct |
3 ms |
2396 KB |
Output is correct |
11 |
Correct |
229 ms |
10772 KB |
Output is correct |
12 |
Correct |
219 ms |
10780 KB |
Output is correct |
13 |
Correct |
138 ms |
8784 KB |
Output is correct |
14 |
Incorrect |
148 ms |
8788 KB |
Output isn't correct |
15 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
1 ms |
2396 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
0 ms |
2396 KB |
Output is correct |
5 |
Correct |
0 ms |
2396 KB |
Output is correct |
6 |
Correct |
1 ms |
2488 KB |
Output is correct |
7 |
Correct |
1 ms |
2396 KB |
Output is correct |
8 |
Correct |
0 ms |
2396 KB |
Output is correct |
9 |
Correct |
93 ms |
7504 KB |
Output is correct |
10 |
Correct |
70 ms |
6580 KB |
Output is correct |
11 |
Correct |
45 ms |
6144 KB |
Output is correct |
12 |
Correct |
37 ms |
5712 KB |
Output is correct |
13 |
Correct |
1 ms |
2392 KB |
Output is correct |
14 |
Correct |
1 ms |
2392 KB |
Output is correct |
15 |
Correct |
0 ms |
2392 KB |
Output is correct |
16 |
Correct |
0 ms |
2396 KB |
Output is correct |
17 |
Correct |
0 ms |
2492 KB |
Output is correct |
18 |
Incorrect |
2 ms |
2396 KB |
Output isn't correct |
19 |
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 |
0 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 |
1 ms |
2396 KB |
Output is correct |
9 |
Correct |
1 ms |
2396 KB |
Output is correct |
10 |
Correct |
3 ms |
2396 KB |
Output is correct |
11 |
Correct |
229 ms |
10772 KB |
Output is correct |
12 |
Correct |
219 ms |
10780 KB |
Output is correct |
13 |
Correct |
138 ms |
8784 KB |
Output is correct |
14 |
Incorrect |
148 ms |
8788 KB |
Output isn't correct |
15 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
1 ms |
2396 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
0 ms |
2396 KB |
Output is correct |
5 |
Correct |
0 ms |
2396 KB |
Output is correct |
6 |
Correct |
1 ms |
2488 KB |
Output is correct |
7 |
Correct |
1 ms |
2396 KB |
Output is correct |
8 |
Correct |
0 ms |
2396 KB |
Output is correct |
9 |
Correct |
93 ms |
7504 KB |
Output is correct |
10 |
Correct |
70 ms |
6580 KB |
Output is correct |
11 |
Correct |
45 ms |
6144 KB |
Output is correct |
12 |
Correct |
37 ms |
5712 KB |
Output is correct |
13 |
Correct |
1 ms |
2392 KB |
Output is correct |
14 |
Correct |
1 ms |
2392 KB |
Output is correct |
15 |
Correct |
0 ms |
2392 KB |
Output is correct |
16 |
Correct |
0 ms |
2396 KB |
Output is correct |
17 |
Correct |
0 ms |
2492 KB |
Output is correct |
18 |
Incorrect |
2 ms |
2396 KB |
Output isn't correct |
19 |
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 |
0 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 |
1 ms |
2396 KB |
Output is correct |
9 |
Correct |
1 ms |
2396 KB |
Output is correct |
10 |
Correct |
3 ms |
2396 KB |
Output is correct |
11 |
Correct |
229 ms |
10772 KB |
Output is correct |
12 |
Correct |
219 ms |
10780 KB |
Output is correct |
13 |
Correct |
138 ms |
8784 KB |
Output is correct |
14 |
Incorrect |
148 ms |
8788 KB |
Output isn't correct |
15 |
Halted |
0 ms |
0 KB |
- |