Submission #1000796

# Submission time Handle Problem Language Result Execution time Memory
1000796 2024-06-18T08:59:22 Z Hanksburger Self Study (JOI22_ho_t2) C++17
0 / 100
124 ms 8280 KB
#include <bits/stdc++.h>
using namespace std;
long long a[300005], b[300005];
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    long long n, m, l=0, r=2e18;
    cin >> n >> m;
    for (long long i=1; i<=n; i++)
        cin >> a[i];
    for (long long i=1; i<=n; i++)
        cin >> b[i];
    while (l<r)
    {
        long long mid=(l+r+1)/2, cnt=0;
        for (long long i=1; i<=n; i++)
        {
            if (a[i]<b[i])
                cnt+=(mid-1)/b[i]+1;
            else if (mid<=a[i]*m)
                cnt+=(mid-1)/a[i]+1;
            else
                cnt+=m+(mid-a[i]*m-1)/b[i]+1;
        }
        if (cnt<=n*m)
            l=mid;
        else
            r=mid-1;
    }
    cout << l;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 1 ms 2516 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 0 ms 2396 KB Output is correct
8 Correct 0 ms 2392 KB Output is correct
9 Correct 0 ms 2396 KB Output is correct
10 Correct 2 ms 2396 KB Output is correct
11 Correct 122 ms 8012 KB Output is correct
12 Correct 124 ms 8280 KB Output is correct
13 Correct 74 ms 7088 KB Output is correct
14 Incorrect 84 ms 7108 KB Output isn't correct
15 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 2408 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 0 ms 2396 KB Output is correct
9 Correct 44 ms 6480 KB Output is correct
10 Correct 28 ms 6088 KB Output is correct
11 Correct 23 ms 5692 KB Output is correct
12 Correct 17 ms 5468 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 1 ms 2396 KB Output is correct
17 Correct 1 ms 2396 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 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 1 ms 2516 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 0 ms 2396 KB Output is correct
8 Correct 0 ms 2392 KB Output is correct
9 Correct 0 ms 2396 KB Output is correct
10 Correct 2 ms 2396 KB Output is correct
11 Correct 122 ms 8012 KB Output is correct
12 Correct 124 ms 8280 KB Output is correct
13 Correct 74 ms 7088 KB Output is correct
14 Incorrect 84 ms 7108 KB Output isn't correct
15 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 2408 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 0 ms 2396 KB Output is correct
9 Correct 44 ms 6480 KB Output is correct
10 Correct 28 ms 6088 KB Output is correct
11 Correct 23 ms 5692 KB Output is correct
12 Correct 17 ms 5468 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 1 ms 2396 KB Output is correct
17 Correct 1 ms 2396 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 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 1 ms 2516 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 0 ms 2396 KB Output is correct
8 Correct 0 ms 2392 KB Output is correct
9 Correct 0 ms 2396 KB Output is correct
10 Correct 2 ms 2396 KB Output is correct
11 Correct 122 ms 8012 KB Output is correct
12 Correct 124 ms 8280 KB Output is correct
13 Correct 74 ms 7088 KB Output is correct
14 Incorrect 84 ms 7108 KB Output isn't correct
15 Halted 0 ms 0 KB -