답안 #538651

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
538651 2022-03-17T11:36:40 Z Harry464 Self Study (JOI22_ho_t2) C++14
0 / 100
483 ms 10784 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 <double> a(n);
    vector <double> 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 = 0, r = 1000000000000000000;

    while (l < r){

        ll mid = (l+r+1)/2;

        ll potrebno = 0;

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

           ll maksa = ceil(mid/a[i]);
           potrebno += min(maksa, m);

           ll maksb = ceil((mid-min(maksa, m)*a[i])/b[i]);
           potrebno += max((ll) 0, maksb);

        }

        if (potrebno > n*m)
          r = mid - 1;
        else
         l = mid;

    }

    cout << l;

}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 300 KB Output is correct
3 Correct 1 ms 300 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 296 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 300 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 10 ms 340 KB Output is correct
11 Correct 481 ms 10744 KB Output is correct
12 Correct 483 ms 10784 KB Output is correct
13 Correct 366 ms 8684 KB Output is correct
14 Incorrect 370 ms 8808 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 300 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 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 247 ms 5436 KB Output is correct
10 Correct 156 ms 3760 KB Output is correct
11 Correct 123 ms 2856 KB Output is correct
12 Correct 102 ms 2500 KB Output is correct
13 Correct 2 ms 212 KB Output is correct
14 Correct 1 ms 296 KB Output is correct
15 Correct 1 ms 304 KB Output is correct
16 Correct 2 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Incorrect 4 ms 340 KB Output isn't correct
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 300 KB Output is correct
3 Correct 1 ms 300 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 296 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 300 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 10 ms 340 KB Output is correct
11 Correct 481 ms 10744 KB Output is correct
12 Correct 483 ms 10784 KB Output is correct
13 Correct 366 ms 8684 KB Output is correct
14 Incorrect 370 ms 8808 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 300 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 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 247 ms 5436 KB Output is correct
10 Correct 156 ms 3760 KB Output is correct
11 Correct 123 ms 2856 KB Output is correct
12 Correct 102 ms 2500 KB Output is correct
13 Correct 2 ms 212 KB Output is correct
14 Correct 1 ms 296 KB Output is correct
15 Correct 1 ms 304 KB Output is correct
16 Correct 2 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Incorrect 4 ms 340 KB Output isn't correct
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 300 KB Output is correct
3 Correct 1 ms 300 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 296 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 300 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 10 ms 340 KB Output is correct
11 Correct 481 ms 10744 KB Output is correct
12 Correct 483 ms 10784 KB Output is correct
13 Correct 366 ms 8684 KB Output is correct
14 Incorrect 370 ms 8808 KB Output isn't correct
15 Halted 0 ms 0 KB -