| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 1257249 | Sam_arvandi | Self Study (JOI22_ho_t2) | C++20 | 123 ms | 5136 KiB | 
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pii;
#define FOR(i, j, n) for(ll i = j; i<= n; i++)
#define ROF(i, n, j) for(ll i = n; i>= j; i--)
#define pb push_back
#define F first
#define S second
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define G(i, j) get<j-1>(i)
#define prll(x) cout << #x << ": " << x << endl;
const ll mn = 3e5 + 5;
ll a[mn], b[mn];
signed main()
{
        IOS;
        ll n, m, t = n*m;
        cin >> n >> m;
        FOR(i,1 , n) cin >> a[i];
        FOR(i,1 , n) cin >> b[i];
        ll L = 0, R = 2e18 + 10, mid;
        while (L+1 != R)
        {
                mid = (L+R)/2;
                ll ted = 0;
                FOR(i,1 , n)
                {
                        if (b[i] >= a[i])
                        {
                                if ((mid+b[i]-1)/b[i] > n*m)
                                {
                                        ted = n*m + 1;
                                        break;
                                }
                                ted += (mid+b[i]-1)/b[i];
                        }
                        else
                        {
                                if ((mid+a[i]-1)/a[i] <= m)
                                {
                                        if ((mid+a[i]-1)/a[i] > n*m)
                                        {
                                                ted = n*m + 1;
                                                break;
                                        }
                                        ted += (mid+a[i]-1)/a[i];
                                }
                                else
                                {
                                        ted += m;
                                        if ((mid-(a[i]*m)+b[i]-1)/b[i] > n*m)
                                        {
                                                ted = n*m + 1;
                                                break;
                                        }
                                        ted += (mid-(a[i]*m)+b[i]-1)/b[i];
                                }
                        }
                        if (ted > n*m) break;
                }
                if (ted > n*m) R = mid;
                else L = mid;
        }
        cout << L;
        return 0;
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
