Submission #1018761

# Submission time Handle Problem Language Result Execution time Memory
1018761 2024-07-10T09:31:21 Z vjudge1 Self Study (JOI22_ho_t2) C++17
25 / 100
123 ms 13932 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
vector<pair<int, int>> v;
int n, m;
bool check(int MID){
    vector<int> cur(n, 0);
    int result = 0;
    for(int i = 0; i < n && result <= n * m; i++){
        int z = max(v[i].ff, v[i].ss);
        int k = (MID + z - 1) / z;
        if(k >= m){
            result += m; cur[i] = MID - m * z;
            result += (cur[i] + v[i].ss - 1) / v[i].ss;
        } else result += k;
    } return result <= n * m;
}
signed main(){
    cin >> n >> m;
    v.assign(n, {0, 0});
    for(auto &to : v) cin >> to.ff;
    for(auto &to : v) cin >> to.ss;
    int l = 0; int r = 1e18 + 6;
    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 Incorrect 1 ms 348 KB Output isn't correct
5 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 344 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 43 ms 6852 KB Output is correct
10 Correct 24 ms 4700 KB Output is correct
11 Correct 17 ms 3676 KB Output is correct
12 Correct 15 ms 2944 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 1 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 2 ms 604 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 29 ms 8528 KB Output is correct
22 Correct 90 ms 13904 KB Output is correct
23 Correct 100 ms 13276 KB Output is correct
# 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 Incorrect 1 ms 348 KB Output isn't correct
5 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 344 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 43 ms 6852 KB Output is correct
10 Correct 24 ms 4700 KB Output is correct
11 Correct 17 ms 3676 KB Output is correct
12 Correct 15 ms 2944 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 1 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 2 ms 604 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 29 ms 8528 KB Output is correct
22 Correct 90 ms 13904 KB Output is correct
23 Correct 100 ms 13276 KB Output is correct
24 Correct 20 ms 2392 KB Output is correct
25 Correct 42 ms 6208 KB Output is correct
26 Correct 12 ms 1636 KB Output is correct
27 Correct 94 ms 13140 KB Output is correct
28 Correct 103 ms 13400 KB Output is correct
29 Correct 80 ms 13072 KB Output is correct
30 Correct 83 ms 13076 KB Output is correct
31 Correct 87 ms 13188 KB Output is correct
32 Correct 63 ms 8540 KB Output is correct
33 Incorrect 123 ms 13932 KB Output isn't correct
34 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 Incorrect 1 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -