Submission #1086624

# Submission time Handle Problem Language Result Execution time Memory
1086624 2024-09-11T07:15:47 Z dwuy Self Study (JOI22_ho_t2) C++14
0 / 100
133 ms 10836 KB
/**         - dwuy -

      />    フ
      |  _  _|
      /`ミ _x ノ
     /      |
    /   ヽ   ?
 / ̄|   | | |
 | ( ̄ヽ__ヽ_)_)
 \二つ

**/
#include <bits/stdc++.h>

#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL)
#define file(a) freopen(a".inp","r",stdin); freopen(a".out", "w",stdout)
#define fi first
#define se second
#define endl "\n"
#define len(s) (int)((s).size())
#define MASK(k)(1LL<<(k))
#define TASK "test"
#define int long long

using namespace std;

typedef tuple<int, int, int> tpiii;
typedef pair<double, double> pdd;
typedef pair<int, int> pii;
typedef long long ll;

const long long OO = 1e18;
const int MOD = 1e9 + 7;
const int INF = 1e9;
const int MX = 300005;

int n, m;
int a[MX];
int b[MX];

int32_t main(){
    fastIO;
    //file(TASK);

    cin >> n >> m;
    for(int i=1; i<=n; i++) cin >> a[i];
    for(int i=1; i<=n; i++) cin >> b[i];
    for(int i=1; i<=n; i++) a[i] = max(a[i], b[i]);

    int res = 0;
    for(int lo=1, hi=OO; lo<=hi;){
        int mid = (lo + hi)>>1;
        int fund = 0;
        for(int i=1; i<=n; i++){
            int d = mid/a[i] + !!(mid%a[i]);
            if(d <= m) fund += m - d;
            else{
                int f = mid - a[i]*m;
                fund -= f/b[i] + !!(f%b[i]);
            }
        }
        if(fund >= 0) res = mid, lo = mid + 1;
        else hi = mid - 1;
    }
    cout << res;

    return 0;
}




# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 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 0 ms 348 KB Output is correct
10 Correct 2 ms 628 KB Output is correct
11 Correct 105 ms 10836 KB Output is correct
12 Correct 111 ms 10832 KB Output is correct
13 Correct 106 ms 8876 KB Output is correct
14 Incorrect 133 ms 8944 KB Output isn't correct
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 468 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 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 56 ms 5536 KB Output is correct
10 Correct 38 ms 4088 KB Output is correct
11 Correct 29 ms 2908 KB Output is correct
12 Correct 22 ms 2392 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 344 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 2 ms 556 KB Output isn't correct
19 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 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 0 ms 348 KB Output is correct
10 Correct 2 ms 628 KB Output is correct
11 Correct 105 ms 10836 KB Output is correct
12 Correct 111 ms 10832 KB Output is correct
13 Correct 106 ms 8876 KB Output is correct
14 Incorrect 133 ms 8944 KB Output isn't correct
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 468 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 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 56 ms 5536 KB Output is correct
10 Correct 38 ms 4088 KB Output is correct
11 Correct 29 ms 2908 KB Output is correct
12 Correct 22 ms 2392 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 344 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 2 ms 556 KB Output isn't correct
19 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 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 0 ms 348 KB Output is correct
10 Correct 2 ms 628 KB Output is correct
11 Correct 105 ms 10836 KB Output is correct
12 Correct 111 ms 10832 KB Output is correct
13 Correct 106 ms 8876 KB Output is correct
14 Incorrect 133 ms 8944 KB Output isn't correct
15 Halted 0 ms 0 KB -