# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1018784 |
2024-07-10T09:45:32 Z |
vjudge1 |
Self Study (JOI22_ho_t2) |
C++17 |
|
121 ms |
10904 KB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ff first
#define ss second
#define tobit(n) bitset<20>(n) //выводит 20 элементов в битовую систему
#define all(v) (v).begin(), (v).end()
#define rtt(v, k) rotate(v.begin(), v.begin() + k, v.end()); //move k elements back
signed main(){
int n, m; cin >> n >> m;
vector<int> a(n);
vector<int> b(n);
for(auto &to : a) cin >> to;
for(auto &to : b) cin >> to;
int l = 0; int r = 1e18 + 6;
auto check = [&](int p){
int t = 0;
for(int i = 0; i < n; i++){
if(b[i] > a[i]){
int b_ = (p + b[i] - 1) / b[i];
t += b_;
} else {
if(a[i] * 1ll * m >= p){
int a_ = (p + a[i] - 1) / a[i]; t += a_;
} else {
int a_ = m;
int b_ = (p - a[i] * 1ll * a_ + b[i] - 1) / b[i]; t += a_ + b_;
}
}
} if(t <= n * 1ll * m) return true;
else return false;
}; while(r > l + 1){
int m = (l + r) / 2;
if(check(m)) l = m;
else r = m;
} cout << l;
}
// NEED TO FAST CIN && COUT //
const int fastIO = [](){
ios_base::sync_with_stdio(false);
cin.tie(nullptr); cout.tie(nullptr);
return 0;
}();
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 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 |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
460 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
2 ms |
604 KB |
Output is correct |
11 |
Correct |
121 ms |
10904 KB |
Output is correct |
12 |
Correct |
121 ms |
10776 KB |
Output is correct |
13 |
Correct |
81 ms |
8708 KB |
Output is correct |
14 |
Incorrect |
84 ms |
8708 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 |
348 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 |
41 ms |
2652 KB |
Output is correct |
10 |
Correct |
28 ms |
1884 KB |
Output is correct |
11 |
Correct |
22 ms |
1624 KB |
Output is correct |
12 |
Correct |
18 ms |
1372 KB |
Output is correct |
13 |
Correct |
1 ms |
344 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 |
348 KB |
Output is correct |
18 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
19 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 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 |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
460 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
2 ms |
604 KB |
Output is correct |
11 |
Correct |
121 ms |
10904 KB |
Output is correct |
12 |
Correct |
121 ms |
10776 KB |
Output is correct |
13 |
Correct |
81 ms |
8708 KB |
Output is correct |
14 |
Incorrect |
84 ms |
8708 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 |
348 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 |
41 ms |
2652 KB |
Output is correct |
10 |
Correct |
28 ms |
1884 KB |
Output is correct |
11 |
Correct |
22 ms |
1624 KB |
Output is correct |
12 |
Correct |
18 ms |
1372 KB |
Output is correct |
13 |
Correct |
1 ms |
344 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 |
348 KB |
Output is correct |
18 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
19 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 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 |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
460 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
2 ms |
604 KB |
Output is correct |
11 |
Correct |
121 ms |
10904 KB |
Output is correct |
12 |
Correct |
121 ms |
10776 KB |
Output is correct |
13 |
Correct |
81 ms |
8708 KB |
Output is correct |
14 |
Incorrect |
84 ms |
8708 KB |
Output isn't correct |
15 |
Halted |
0 ms |
0 KB |
- |