답안 #803689

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
803689 2023-08-03T05:28:43 Z vjudge1 Self Study (JOI22_ho_t2) C++14
64 / 100
212 ms 5056 KB
#include<bits/stdc++.h>
#define fi first
#define se second
#define ll long long
using namespace std ;
const ll N = 3e5 ;
bool flag1 ;
ll n, m, l = 0, r = (1ll << 62ll), a[N + 1], b[N + 1] ;
signed main()
{
    ios_base::sync_with_stdio( 0 ) ;
    cin.tie( 0 ) ;
    cout.tie( 0 ) ;
    cin >> n >> m ;
    for(ll i = 1 ; i <= n ; i++)
        cin >> a[i] ;
    for(ll i = 1 ; i <= n ; i++)
    {
        cin >> b[i] ;
        if(a[i] != b[i])
            flag1 = 1 ;
    }
    if(m == 1)
    {
        ll mn = 1e18 ;
        for(ll i = 1 ; i <= n ; i++)
            mn = min(mn, max(a[i], b[i])) ;
        cout << mn << '\n' ;
        return 0 ;
    }
    if(!flag1)
    {
        while(l + 1 < r)
        {
            bool flag = 0 ;
            ll mid = (l + r) / 2, cnt = 0 ;
            for(ll i = 1 ; i <= n ; i++)
            {
                cnt += (mid + b[i] - 1) / b[i] ;
                if(cnt < 0 || (mid + b[i] - 1) / b[i] < 0)
                    flag = 1 ;
            }
            if(cnt > n * m || flag)
                r = mid ;
            else
                l = mid ;
        }
        cout << l ;
        return 0 ;
    }
    return 0 ;
}
# 결과 실행 시간 메모리 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 0 ms 212 KB Output is correct
5 Correct 1 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 1 ms 212 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 46 ms 4972 KB Output is correct
12 Correct 46 ms 4940 KB Output is correct
13 Correct 35 ms 4880 KB Output is correct
14 Correct 35 ms 4992 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 24 ms 4988 KB Output is correct
17 Correct 47 ms 4968 KB Output is correct
18 Correct 45 ms 4992 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 24 ms 4988 KB Output is correct
3 Correct 47 ms 4968 KB Output is correct
4 Correct 45 ms 4992 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 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 75 ms 2668 KB Output is correct
14 Correct 50 ms 1876 KB Output is correct
15 Correct 37 ms 1488 KB Output is correct
16 Correct 31 ms 1152 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 3 ms 340 KB Output is correct
23 Correct 3 ms 340 KB Output is correct
# 결과 실행 시간 메모리 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 0 ms 212 KB Output is correct
5 Correct 1 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 1 ms 212 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 46 ms 4972 KB Output is correct
12 Correct 46 ms 4940 KB Output is correct
13 Correct 35 ms 4880 KB Output is correct
14 Correct 35 ms 4992 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 75 ms 2668 KB Output is correct
24 Correct 50 ms 1876 KB Output is correct
25 Correct 37 ms 1488 KB Output is correct
26 Correct 31 ms 1152 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 0 ms 212 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 0 ms 212 KB Output is correct
31 Correct 0 ms 212 KB Output is correct
32 Correct 3 ms 340 KB Output is correct
33 Correct 3 ms 340 KB Output is correct
34 Correct 0 ms 212 KB Output is correct
35 Correct 24 ms 4988 KB Output is correct
36 Correct 47 ms 4968 KB Output is correct
37 Correct 45 ms 4992 KB Output is correct
38 Incorrect 0 ms 212 KB Output isn't correct
39 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 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 75 ms 2668 KB Output is correct
10 Correct 50 ms 1876 KB Output is correct
11 Correct 37 ms 1488 KB Output is correct
12 Correct 31 ms 1152 KB Output is correct
13 Correct 1 ms 340 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 Correct 3 ms 340 KB Output is correct
19 Correct 3 ms 340 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 24 ms 4988 KB Output is correct
22 Correct 47 ms 4968 KB Output is correct
23 Correct 45 ms 4992 KB Output is correct
24 Correct 31 ms 980 KB Output is correct
25 Correct 79 ms 2428 KB Output is correct
26 Correct 17 ms 724 KB Output is correct
27 Correct 159 ms 5056 KB Output is correct
28 Correct 150 ms 4996 KB Output is correct
29 Correct 152 ms 4996 KB Output is correct
30 Correct 161 ms 4892 KB Output is correct
31 Correct 198 ms 5004 KB Output is correct
32 Correct 208 ms 4996 KB Output is correct
33 Correct 212 ms 5000 KB Output is correct
34 Correct 209 ms 5004 KB Output is correct
# 결과 실행 시간 메모리 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 0 ms 212 KB Output is correct
5 Correct 1 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 1 ms 212 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 46 ms 4972 KB Output is correct
12 Correct 46 ms 4940 KB Output is correct
13 Correct 35 ms 4880 KB Output is correct
14 Correct 35 ms 4992 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 75 ms 2668 KB Output is correct
24 Correct 50 ms 1876 KB Output is correct
25 Correct 37 ms 1488 KB Output is correct
26 Correct 31 ms 1152 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 0 ms 212 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 0 ms 212 KB Output is correct
31 Correct 0 ms 212 KB Output is correct
32 Correct 3 ms 340 KB Output is correct
33 Correct 3 ms 340 KB Output is correct
34 Incorrect 0 ms 212 KB Output isn't correct
35 Halted 0 ms 0 KB -