답안 #538661

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
538661 2022-03-17T12:02:56 Z Harry464 Self Study (JOI22_ho_t2) C++14
0 / 100
609 ms 5068 KB
#include <cmath>
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

typedef long long ll;

int main(){

    ll n, m;
    cin >> n >> m; 

    vector <ll> a(n);
    vector <ll> b(n);

    for (int i = 0; i < n; i++)
        cin >> a[i];
    for (int i = 0; i < n; i++)
        cin >> b[i];

    for (int i = 0; i < n; i++)
        a[i] = max(a[i], b[i]);

    ll l = 1, r = 3000000000000000001;
    
    ll granica = n*m;

    while (l < r){

        ll mid = (l+r)/2;

        ll potrebno = 0;

        for (int i = 0; i < n; i++){

           ll maksa =  mid/a[i];
           if (mid%a[i] != 0)
            maksa++;
           potrebno += min(maksa, m);
           ll iskor = min(maksa, m);

           ll maksb = (mid- iskor*a[i])/b[i];
           if(mid-iskor*a[i] < 0)
            continue;
           if((mid - iskor*a[i])%b[i] != 0)
            maksb++;
           potrebno += maksb;

        }

        if (potrebno <= granica)
          l = mid + 1;
        else
          r = mid;

    }

    cout << l - 1;

}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 7 ms 340 KB Output is correct
11 Correct 424 ms 4988 KB Output is correct
12 Correct 434 ms 4988 KB Output is correct
13 Correct 390 ms 5068 KB Output is correct
14 Incorrect 609 ms 4980 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 207 ms 2644 KB Output is correct
10 Correct 149 ms 1856 KB Output is correct
11 Correct 124 ms 1472 KB Output is correct
12 Correct 83 ms 1240 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Incorrect 11 ms 368 KB Output isn't correct
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 7 ms 340 KB Output is correct
11 Correct 424 ms 4988 KB Output is correct
12 Correct 434 ms 4988 KB Output is correct
13 Correct 390 ms 5068 KB Output is correct
14 Incorrect 609 ms 4980 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 207 ms 2644 KB Output is correct
10 Correct 149 ms 1856 KB Output is correct
11 Correct 124 ms 1472 KB Output is correct
12 Correct 83 ms 1240 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Incorrect 11 ms 368 KB Output isn't correct
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 7 ms 340 KB Output is correct
11 Correct 424 ms 4988 KB Output is correct
12 Correct 434 ms 4988 KB Output is correct
13 Correct 390 ms 5068 KB Output is correct
14 Incorrect 609 ms 4980 KB Output isn't correct
15 Halted 0 ms 0 KB -