Submission #937795

# Submission time Handle Problem Language Result Execution time Memory
937795 2024-03-04T13:16:46 Z Andrey Self Study (JOI22_ho_t2) C++14
0 / 100
283 ms 16296 KB
#include <bits/stdc++.h>
using namespace std;

vector<long long> haha(0);
vector<long long> bruh(0);
long long n,m;

bool check(long long a) {
    long long br = 0;
    for(long long i = 0; i < n; i++) {
        if(haha[i] <= bruh[i]) {
            br+=(a-1)/bruh[i]+1;
        }
        else {
            if(a > haha[i]*m) {
                br+=m;
                br+=(a-1-haha[i]*m)/bruh[i]+1;
            }
            else {
                br+=(a-1)/haha[i]+1;
            }
        }
    }
    if(br > n*m) {
        return false;
    }
    else {
        return true;
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin >> n >> m;
    long long a;
    for(long long i = 0; i < n; i++) {
        cin >> a;
        haha.push_back(a);
    }
    for(long long i = 0; i < n; i++) {
        cin >> a;
        bruh.push_back(a);
    }
    long long l = 0,r = 1e18;
    while(l < r) {
        long long mid = (l+r+1)/2;
        if(check(mid)) {
            l = mid;
        }
        else {
            r = mid-1;
        }
    }
    cout << l;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 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 456 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 3 ms 604 KB Output is correct
11 Correct 152 ms 16296 KB Output is correct
12 Correct 152 ms 15332 KB Output is correct
13 Correct 149 ms 14288 KB Output is correct
14 Incorrect 283 ms 13232 KB Output isn't correct
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 608 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 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 0 ms 456 KB Output is correct
7 Correct 0 ms 456 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 76 ms 7456 KB Output is correct
10 Correct 51 ms 4324 KB Output is correct
11 Correct 38 ms 3796 KB Output is correct
12 Correct 30 ms 2780 KB Output is correct
13 Correct 1 ms 460 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 5 ms 616 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 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 456 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 3 ms 604 KB Output is correct
11 Correct 152 ms 16296 KB Output is correct
12 Correct 152 ms 15332 KB Output is correct
13 Correct 149 ms 14288 KB Output is correct
14 Incorrect 283 ms 13232 KB Output isn't correct
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 608 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 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 0 ms 456 KB Output is correct
7 Correct 0 ms 456 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 76 ms 7456 KB Output is correct
10 Correct 51 ms 4324 KB Output is correct
11 Correct 38 ms 3796 KB Output is correct
12 Correct 30 ms 2780 KB Output is correct
13 Correct 1 ms 460 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 5 ms 616 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 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 456 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 3 ms 604 KB Output is correct
11 Correct 152 ms 16296 KB Output is correct
12 Correct 152 ms 15332 KB Output is correct
13 Correct 149 ms 14288 KB Output is correct
14 Incorrect 283 ms 13232 KB Output isn't correct
15 Halted 0 ms 0 KB -