답안 #1018598

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1018598 2024-07-10T07:18:26 Z vicvic Self Study (JOI22_ho_t2) C++11
62 / 100
188 ms 11348 KB
#include <iostream>
#include <fstream>
#define int long long
using namespace std;
const int nmax=3e5+5;
int n, m, a[nmax], b[nmax];
bool check (int val)
{
    int days=n*m;
    for (int i=1;i<=n;i++)
    {
        if (val==23)
        {
            cout << days << "\n";
        }
        int filled=0;
        if (a[i]>b[i])
        {
            int nr_act=min (days, m);
            if (nr_act*a[i]<val)
            {
                days-=nr_act;
                filled=nr_act*a[i];
            }
            else
            {
                days-=val/a[i]+(val%a[i]!=0);
                continue;
            }
        }
        int nr_act=days;
        if (nr_act*b[i]<val-filled)
        {
            return 0;
        }
        days-=(val-filled)/b[i]+((val-filled)%b[i]!=0);
        if (days<0)
        {
            return 0;
        }
    }
    return 1;
}
int32_t main()
{
    cin >> n >> m;
    for (int i=1;i<=n;i++)
    {
        cin >> a[i];
    }
    for (int i=1;i<=n;i++)
    {
        cin >> b[i];
    }
    int st=0, dr=1e18, poz=0;
    while (st<=dr)
    {
        int mij = (st+dr) >> 1;
        if (check (mij))
        {
            st=mij+1;
            poz=mij;
        }
        else dr=mij-1;
    }
    cout << poz;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 1 ms 2392 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 0 ms 2488 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 3 ms 2396 KB Output is correct
11 Correct 179 ms 10916 KB Output is correct
12 Correct 185 ms 10908 KB Output is correct
13 Correct 115 ms 8804 KB Output is correct
14 Correct 108 ms 8788 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 59 ms 6228 KB Output is correct
17 Correct 163 ms 11348 KB Output is correct
18 Correct 188 ms 10836 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 59 ms 6228 KB Output is correct
3 Correct 163 ms 11348 KB Output is correct
4 Correct 188 ms 10836 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 0 ms 2396 KB Output is correct
8 Correct 0 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 104 ms 7504 KB Output is correct
14 Correct 51 ms 6484 KB Output is correct
15 Correct 41 ms 5908 KB Output is correct
16 Correct 36 ms 5672 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 1 ms 2488 KB Output is correct
19 Correct 1 ms 2396 KB Output is correct
20 Correct 0 ms 2396 KB Output is correct
21 Correct 0 ms 2496 KB Output is correct
22 Correct 1 ms 2396 KB Output is correct
23 Correct 3 ms 2396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 1 ms 2392 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 0 ms 2488 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 3 ms 2396 KB Output is correct
11 Correct 179 ms 10916 KB Output is correct
12 Correct 185 ms 10908 KB Output is correct
13 Correct 115 ms 8804 KB Output is correct
14 Correct 108 ms 8788 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 0 ms 2396 KB Output is correct
18 Correct 0 ms 2396 KB Output is correct
19 Correct 1 ms 2396 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
21 Correct 1 ms 2396 KB Output is correct
22 Correct 1 ms 2396 KB Output is correct
23 Correct 104 ms 7504 KB Output is correct
24 Correct 51 ms 6484 KB Output is correct
25 Correct 41 ms 5908 KB Output is correct
26 Correct 36 ms 5672 KB Output is correct
27 Correct 1 ms 2396 KB Output is correct
28 Correct 1 ms 2488 KB Output is correct
29 Correct 1 ms 2396 KB Output is correct
30 Correct 0 ms 2396 KB Output is correct
31 Correct 0 ms 2496 KB Output is correct
32 Correct 1 ms 2396 KB Output is correct
33 Correct 3 ms 2396 KB Output is correct
34 Correct 1 ms 2396 KB Output is correct
35 Correct 59 ms 6228 KB Output is correct
36 Correct 163 ms 11348 KB Output is correct
37 Correct 188 ms 10836 KB Output is correct
38 Correct 1 ms 2396 KB Output is correct
39 Correct 1 ms 2396 KB Output is correct
40 Correct 1 ms 2396 KB Output is correct
41 Correct 1 ms 2396 KB Output is correct
42 Correct 1 ms 2396 KB Output is correct
43 Correct 0 ms 2396 KB Output is correct
44 Correct 0 ms 2396 KB Output is correct
45 Correct 3 ms 2396 KB Output is correct
46 Correct 5 ms 2652 KB Output is correct
47 Correct 2 ms 2396 KB Output is correct
48 Correct 32 ms 5604 KB Output is correct
49 Correct 1 ms 2396 KB Output is correct
50 Correct 1 ms 2396 KB Output is correct
51 Correct 3 ms 2392 KB Output is correct
52 Correct 0 ms 2396 KB Output is correct
53 Correct 0 ms 2396 KB Output is correct
54 Correct 1 ms 2396 KB Output is correct
55 Correct 92 ms 7384 KB Output is correct
56 Correct 42 ms 5972 KB Output is correct
57 Correct 68 ms 5972 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 104 ms 7504 KB Output is correct
10 Correct 51 ms 6484 KB Output is correct
11 Correct 41 ms 5908 KB Output is correct
12 Correct 36 ms 5672 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
14 Correct 1 ms 2488 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 0 ms 2396 KB Output is correct
17 Correct 0 ms 2496 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 3 ms 2396 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
21 Correct 59 ms 6228 KB Output is correct
22 Correct 163 ms 11348 KB Output is correct
23 Correct 188 ms 10836 KB Output is correct
24 Incorrect 21 ms 5468 KB Output isn't correct
25 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 1 ms 2392 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 0 ms 2488 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 3 ms 2396 KB Output is correct
11 Correct 179 ms 10916 KB Output is correct
12 Correct 185 ms 10908 KB Output is correct
13 Correct 115 ms 8804 KB Output is correct
14 Correct 108 ms 8788 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 0 ms 2396 KB Output is correct
18 Correct 0 ms 2396 KB Output is correct
19 Correct 1 ms 2396 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
21 Correct 1 ms 2396 KB Output is correct
22 Correct 1 ms 2396 KB Output is correct
23 Correct 104 ms 7504 KB Output is correct
24 Correct 51 ms 6484 KB Output is correct
25 Correct 41 ms 5908 KB Output is correct
26 Correct 36 ms 5672 KB Output is correct
27 Correct 1 ms 2396 KB Output is correct
28 Correct 1 ms 2488 KB Output is correct
29 Correct 1 ms 2396 KB Output is correct
30 Correct 0 ms 2396 KB Output is correct
31 Correct 0 ms 2496 KB Output is correct
32 Correct 1 ms 2396 KB Output is correct
33 Correct 3 ms 2396 KB Output is correct
34 Correct 1 ms 2396 KB Output is correct
35 Correct 1 ms 2396 KB Output is correct
36 Correct 1 ms 2396 KB Output is correct
37 Correct 1 ms 2396 KB Output is correct
38 Correct 1 ms 2396 KB Output is correct
39 Correct 0 ms 2396 KB Output is correct
40 Correct 0 ms 2396 KB Output is correct
41 Correct 3 ms 2396 KB Output is correct
42 Correct 5 ms 2652 KB Output is correct
43 Correct 2 ms 2396 KB Output is correct
44 Correct 32 ms 5604 KB Output is correct
45 Correct 1 ms 2396 KB Output is correct
46 Correct 1 ms 2396 KB Output is correct
47 Correct 3 ms 2392 KB Output is correct
48 Correct 0 ms 2396 KB Output is correct
49 Correct 0 ms 2396 KB Output is correct
50 Correct 1 ms 2396 KB Output is correct
51 Correct 92 ms 7384 KB Output is correct
52 Correct 42 ms 5972 KB Output is correct
53 Correct 68 ms 5972 KB Output is correct
54 Incorrect 21 ms 5468 KB Output isn't correct
55 Halted 0 ms 0 KB -