Submission #824365

# Submission time Handle Problem Language Result Execution time Memory
824365 2023-08-14T04:21:29 Z Amylopectin Self Study (JOI22_ho_t2) C++14
100 / 100
215 ms 10772 KB
#include <stdio.h>
#include <iostream>
#include <algorithm>
using namespace std;
const long long mxn = 1e6 + 10,mxi = 2e18 + 10;
long long a[mxn] = {},b[mxn] = {}; 
int main()
{
    long long i,j,n,m,cn,cm,fn,fm,cl,cr,mid,cva,csu;
    scanf("%lld %lld",&n,&m);
    for(i=0; i<n; i++)
    {
        scanf("%lld",&a[i]);
    }
    for(i=0; i<n; i++)
    {
        scanf("%lld",&b[i]);
    }
    cl = 1;
    cr = mxi;
    while(cl < cr)
    {
        mid = (cl+cr) / 2 + (cl+cr) % 2;
        csu = 0;
        for(i=0; i<n; i++)
        {
            if(a[i] > b[i])
            {
                if(m * a[i] >= mid)
                {
                    csu += (mid-1) / (a[i]) + 1;
                }
                else 
                {
                    csu += m + ((mid - 1 - m*a[i]) / b[i]) + 1;
                }
            }
            else 
            {
                csu += (mid-1) / (b[i]) + 1;
            }
            if(csu > n*m)
            {
                break;
            }
        }
        if(csu > n*m)
        {
            cr = mid-1;
        }
        else 
        {
            cl = mid;
        }
    }
    printf("%lld\n",cl);
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:9:17: warning: unused variable 'j' [-Wunused-variable]
    9 |     long long i,j,n,m,cn,cm,fn,fm,cl,cr,mid,cva,csu;
      |                 ^
Main.cpp:9:23: warning: unused variable 'cn' [-Wunused-variable]
    9 |     long long i,j,n,m,cn,cm,fn,fm,cl,cr,mid,cva,csu;
      |                       ^~
Main.cpp:9:26: warning: unused variable 'cm' [-Wunused-variable]
    9 |     long long i,j,n,m,cn,cm,fn,fm,cl,cr,mid,cva,csu;
      |                          ^~
Main.cpp:9:29: warning: unused variable 'fn' [-Wunused-variable]
    9 |     long long i,j,n,m,cn,cm,fn,fm,cl,cr,mid,cva,csu;
      |                             ^~
Main.cpp:9:32: warning: unused variable 'fm' [-Wunused-variable]
    9 |     long long i,j,n,m,cn,cm,fn,fm,cl,cr,mid,cva,csu;
      |                                ^~
Main.cpp:9:45: warning: unused variable 'cva' [-Wunused-variable]
    9 |     long long i,j,n,m,cn,cm,fn,fm,cl,cr,mid,cva,csu;
      |                                             ^~~
Main.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |     scanf("%lld %lld",&n,&m);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~
Main.cpp:13:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |         scanf("%lld",&a[i]);
      |         ~~~~~^~~~~~~~~~~~~~
Main.cpp:17:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |         scanf("%lld",&b[i]);
      |         ~~~~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 312 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 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 1 ms 340 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 3 ms 468 KB Output is correct
11 Correct 94 ms 10772 KB Output is correct
12 Correct 92 ms 10700 KB Output is correct
13 Correct 79 ms 8804 KB Output is correct
14 Correct 65 ms 8692 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 35 ms 5000 KB Output is correct
17 Correct 86 ms 4992 KB Output is correct
18 Correct 84 ms 4924 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 35 ms 5000 KB Output is correct
3 Correct 86 ms 4992 KB Output is correct
4 Correct 84 ms 4924 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 308 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 304 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 45 ms 5540 KB Output is correct
14 Correct 38 ms 3708 KB Output is correct
15 Correct 23 ms 2900 KB Output is correct
16 Correct 21 ms 2304 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 1 ms 312 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 2 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 312 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 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 1 ms 340 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 3 ms 468 KB Output is correct
11 Correct 94 ms 10772 KB Output is correct
12 Correct 92 ms 10700 KB Output is correct
13 Correct 79 ms 8804 KB Output is correct
14 Correct 65 ms 8692 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 308 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 304 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 45 ms 5540 KB Output is correct
24 Correct 38 ms 3708 KB Output is correct
25 Correct 23 ms 2900 KB Output is correct
26 Correct 21 ms 2304 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 0 ms 212 KB Output is correct
29 Correct 0 ms 212 KB Output is correct
30 Correct 0 ms 212 KB Output is correct
31 Correct 1 ms 312 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 2 ms 364 KB Output is correct
34 Correct 0 ms 212 KB Output is correct
35 Correct 35 ms 5000 KB Output is correct
36 Correct 86 ms 4992 KB Output is correct
37 Correct 84 ms 4924 KB Output is correct
38 Correct 0 ms 212 KB Output is correct
39 Correct 0 ms 292 KB Output is correct
40 Correct 0 ms 212 KB Output is correct
41 Correct 1 ms 212 KB Output is correct
42 Correct 0 ms 212 KB Output is correct
43 Correct 0 ms 212 KB Output is correct
44 Correct 0 ms 212 KB Output is correct
45 Correct 2 ms 340 KB Output is correct
46 Correct 4 ms 368 KB Output is correct
47 Correct 1 ms 212 KB Output is correct
48 Correct 19 ms 1048 KB Output is correct
49 Correct 0 ms 212 KB Output is correct
50 Correct 0 ms 212 KB Output is correct
51 Correct 3 ms 340 KB Output is correct
52 Correct 0 ms 212 KB Output is correct
53 Correct 0 ms 212 KB Output is correct
54 Correct 1 ms 212 KB Output is correct
55 Correct 62 ms 2624 KB Output is correct
56 Correct 29 ms 1860 KB Output is correct
57 Correct 23 ms 1748 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 308 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 304 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 45 ms 5540 KB Output is correct
10 Correct 38 ms 3708 KB Output is correct
11 Correct 23 ms 2900 KB Output is correct
12 Correct 21 ms 2304 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 312 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 2 ms 364 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 35 ms 5000 KB Output is correct
22 Correct 86 ms 4992 KB Output is correct
23 Correct 84 ms 4924 KB Output is correct
24 Correct 30 ms 980 KB Output is correct
25 Correct 64 ms 2396 KB Output is correct
26 Correct 11 ms 804 KB Output is correct
27 Correct 106 ms 4876 KB Output is correct
28 Correct 103 ms 4996 KB Output is correct
29 Correct 90 ms 4968 KB Output is correct
30 Correct 124 ms 4884 KB Output is correct
31 Correct 194 ms 4948 KB Output is correct
32 Correct 130 ms 4988 KB Output is correct
33 Correct 215 ms 4996 KB Output is correct
34 Correct 119 ms 4992 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 312 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 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 1 ms 340 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 3 ms 468 KB Output is correct
11 Correct 94 ms 10772 KB Output is correct
12 Correct 92 ms 10700 KB Output is correct
13 Correct 79 ms 8804 KB Output is correct
14 Correct 65 ms 8692 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 308 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 304 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 45 ms 5540 KB Output is correct
24 Correct 38 ms 3708 KB Output is correct
25 Correct 23 ms 2900 KB Output is correct
26 Correct 21 ms 2304 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 0 ms 212 KB Output is correct
29 Correct 0 ms 212 KB Output is correct
30 Correct 0 ms 212 KB Output is correct
31 Correct 1 ms 312 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 2 ms 364 KB Output is correct
34 Correct 0 ms 212 KB Output is correct
35 Correct 0 ms 292 KB Output is correct
36 Correct 0 ms 212 KB Output is correct
37 Correct 1 ms 212 KB Output is correct
38 Correct 0 ms 212 KB Output is correct
39 Correct 0 ms 212 KB Output is correct
40 Correct 0 ms 212 KB Output is correct
41 Correct 2 ms 340 KB Output is correct
42 Correct 4 ms 368 KB Output is correct
43 Correct 1 ms 212 KB Output is correct
44 Correct 19 ms 1048 KB Output is correct
45 Correct 0 ms 212 KB Output is correct
46 Correct 0 ms 212 KB Output is correct
47 Correct 3 ms 340 KB Output is correct
48 Correct 0 ms 212 KB Output is correct
49 Correct 0 ms 212 KB Output is correct
50 Correct 1 ms 212 KB Output is correct
51 Correct 62 ms 2624 KB Output is correct
52 Correct 29 ms 1860 KB Output is correct
53 Correct 23 ms 1748 KB Output is correct
54 Correct 30 ms 980 KB Output is correct
55 Correct 64 ms 2396 KB Output is correct
56 Correct 11 ms 804 KB Output is correct
57 Correct 106 ms 4876 KB Output is correct
58 Correct 103 ms 4996 KB Output is correct
59 Correct 90 ms 4968 KB Output is correct
60 Correct 124 ms 4884 KB Output is correct
61 Correct 194 ms 4948 KB Output is correct
62 Correct 130 ms 4988 KB Output is correct
63 Correct 215 ms 4996 KB Output is correct
64 Correct 119 ms 4992 KB Output is correct
65 Correct 0 ms 212 KB Output is correct
66 Correct 35 ms 5000 KB Output is correct
67 Correct 86 ms 4992 KB Output is correct
68 Correct 84 ms 4924 KB Output is correct
69 Correct 19 ms 820 KB Output is correct
70 Correct 5 ms 340 KB Output is correct
71 Correct 0 ms 212 KB Output is correct
72 Correct 30 ms 980 KB Output is correct
73 Correct 6 ms 468 KB Output is correct
74 Correct 1 ms 212 KB Output is correct
75 Correct 109 ms 4872 KB Output is correct
76 Correct 104 ms 4936 KB Output is correct
77 Correct 110 ms 4992 KB Output is correct
78 Correct 140 ms 4996 KB Output is correct
79 Correct 200 ms 4992 KB Output is correct
80 Correct 202 ms 4976 KB Output is correct
81 Correct 209 ms 4988 KB Output is correct
82 Correct 206 ms 4992 KB Output is correct