# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
528057 | 2022-02-19T05:14:04 Z | amukkalir | Self Study (JOI22_ho_t2) | C++17 | 297 ms | 9604 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define prn printf #define scn scanf const int nax = 3e5; ll n, m; ll a[nax+5], b[nax+5]; unsigned long long updiv(ll a, ll b) { ll ret = a/b; if(ret*b < a) ret++; return ret; } bool ok (ll x) { unsigned long long cnt = 0; for(int i=0; i<n; i++) { ll rem = x; ll cur = 0; if(a[i] > b[i]) { cur += min((unsigned long long)m,updiv(rem, a[i])); rem -= cur*a[i]; } if(rem>0) cur += updiv(rem, b[i]); cnt += (unsigned long long) cur; if(cnt > n*m) return false; } return cnt <= n*m; } signed main () { scn("%d%d", &n,&m); for(int i=0; i<n; i++) scn("%lld", &a[i]); for(int i=0; i<n; i++) scn("%lld", &b[i]); ll ans = 0; ll lo = 0, hi = 1e18; while(lo <= hi) { ll mid = (lo+hi)>>1; if(ok(mid)) { ans = mid; lo = mid+1; } else hi = mid-1; } prn("%lld", ans); } /* dari 3e5 slot buat setiap mapel mau study berapa kali */
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 300 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
6 | Correct | 0 ms | 204 KB | Output is correct |
7 | Correct | 0 ms | 204 KB | Output is correct |
8 | Correct | 0 ms | 204 KB | Output is correct |
9 | Correct | 1 ms | 204 KB | Output is correct |
10 | Correct | 3 ms | 460 KB | Output is correct |
11 | Correct | 134 ms | 6252 KB | Output is correct |
12 | Correct | 114 ms | 6272 KB | Output is correct |
13 | Correct | 98 ms | 6376 KB | Output is correct |
14 | Correct | 105 ms | 6288 KB | Output is correct |
15 | Correct | 1 ms | 204 KB | Output is correct |
16 | Correct | 73 ms | 4900 KB | Output is correct |
17 | Correct | 97 ms | 4964 KB | Output is correct |
18 | Correct | 101 ms | 4968 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 73 ms | 4900 KB | Output is correct |
3 | Correct | 97 ms | 4964 KB | Output is correct |
4 | Correct | 101 ms | 4968 KB | Output is correct |
5 | Correct | 0 ms | 204 KB | Output is correct |
6 | Correct | 1 ms | 204 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 1 ms | 204 KB | Output is correct |
9 | Correct | 1 ms | 204 KB | Output is correct |
10 | Correct | 0 ms | 204 KB | Output is correct |
11 | Correct | 0 ms | 204 KB | Output is correct |
12 | Correct | 1 ms | 204 KB | Output is correct |
13 | Correct | 64 ms | 2576 KB | Output is correct |
14 | Correct | 39 ms | 1740 KB | Output is correct |
15 | Correct | 31 ms | 1388 KB | Output is correct |
16 | Correct | 22 ms | 1148 KB | Output is correct |
17 | Correct | 1 ms | 204 KB | Output is correct |
18 | Correct | 0 ms | 204 KB | Output is correct |
19 | Correct | 0 ms | 204 KB | Output is correct |
20 | Correct | 0 ms | 204 KB | Output is correct |
21 | Correct | 0 ms | 204 KB | Output is correct |
22 | Correct | 1 ms | 332 KB | Output is correct |
23 | Correct | 2 ms | 332 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 300 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
6 | Correct | 0 ms | 204 KB | Output is correct |
7 | Correct | 0 ms | 204 KB | Output is correct |
8 | Correct | 0 ms | 204 KB | Output is correct |
9 | Correct | 1 ms | 204 KB | Output is correct |
10 | Correct | 3 ms | 460 KB | Output is correct |
11 | Correct | 134 ms | 6252 KB | Output is correct |
12 | Correct | 114 ms | 6272 KB | Output is correct |
13 | Correct | 98 ms | 6376 KB | Output is correct |
14 | Correct | 105 ms | 6288 KB | Output is correct |
15 | Correct | 0 ms | 204 KB | Output is correct |
16 | Correct | 1 ms | 204 KB | Output is correct |
17 | Correct | 1 ms | 204 KB | Output is correct |
18 | Correct | 1 ms | 204 KB | Output is correct |
19 | Correct | 1 ms | 204 KB | Output is correct |
20 | Correct | 0 ms | 204 KB | Output is correct |
21 | Correct | 0 ms | 204 KB | Output is correct |
22 | Correct | 1 ms | 204 KB | Output is correct |
23 | Correct | 64 ms | 2576 KB | Output is correct |
24 | Correct | 39 ms | 1740 KB | Output is correct |
25 | Correct | 31 ms | 1388 KB | Output is correct |
26 | Correct | 22 ms | 1148 KB | Output is correct |
27 | Correct | 1 ms | 204 KB | Output is correct |
28 | Correct | 0 ms | 204 KB | Output is correct |
29 | Correct | 0 ms | 204 KB | Output is correct |
30 | Correct | 0 ms | 204 KB | Output is correct |
31 | Correct | 0 ms | 204 KB | Output is correct |
32 | Correct | 1 ms | 332 KB | Output is correct |
33 | Correct | 2 ms | 332 KB | Output is correct |
34 | Correct | 1 ms | 204 KB | Output is correct |
35 | Correct | 73 ms | 4900 KB | Output is correct |
36 | Correct | 97 ms | 4964 KB | Output is correct |
37 | Correct | 101 ms | 4968 KB | Output is correct |
38 | Correct | 0 ms | 204 KB | Output is correct |
39 | Correct | 1 ms | 204 KB | Output is correct |
40 | Correct | 1 ms | 256 KB | Output is correct |
41 | Correct | 0 ms | 204 KB | Output is correct |
42 | Correct | 1 ms | 204 KB | Output is correct |
43 | Correct | 1 ms | 204 KB | Output is correct |
44 | Correct | 0 ms | 204 KB | Output is correct |
45 | Correct | 4 ms | 436 KB | Output is correct |
46 | Correct | 5 ms | 436 KB | Output is correct |
47 | Correct | 1 ms | 204 KB | Output is correct |
48 | Correct | 22 ms | 1604 KB | Output is correct |
49 | Correct | 1 ms | 204 KB | Output is correct |
50 | Correct | 1 ms | 204 KB | Output is correct |
51 | Correct | 4 ms | 320 KB | Output is correct |
52 | Correct | 1 ms | 204 KB | Output is correct |
53 | Correct | 2 ms | 204 KB | Output is correct |
54 | Correct | 1 ms | 300 KB | Output is correct |
55 | Correct | 64 ms | 4308 KB | Output is correct |
56 | Correct | 48 ms | 2420 KB | Output is correct |
57 | Correct | 31 ms | 2484 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
6 | Correct | 0 ms | 204 KB | Output is correct |
7 | Correct | 0 ms | 204 KB | Output is correct |
8 | Correct | 1 ms | 204 KB | Output is correct |
9 | Correct | 64 ms | 2576 KB | Output is correct |
10 | Correct | 39 ms | 1740 KB | Output is correct |
11 | Correct | 31 ms | 1388 KB | Output is correct |
12 | Correct | 22 ms | 1148 KB | Output is correct |
13 | Correct | 1 ms | 204 KB | Output is correct |
14 | Correct | 0 ms | 204 KB | Output is correct |
15 | Correct | 0 ms | 204 KB | Output is correct |
16 | Correct | 0 ms | 204 KB | Output is correct |
17 | Correct | 0 ms | 204 KB | Output is correct |
18 | Correct | 1 ms | 332 KB | Output is correct |
19 | Correct | 2 ms | 332 KB | Output is correct |
20 | Correct | 1 ms | 204 KB | Output is correct |
21 | Correct | 73 ms | 4900 KB | Output is correct |
22 | Correct | 97 ms | 4964 KB | Output is correct |
23 | Correct | 101 ms | 4968 KB | Output is correct |
24 | Correct | 31 ms | 1008 KB | Output is correct |
25 | Correct | 88 ms | 2300 KB | Output is correct |
26 | Correct | 13 ms | 796 KB | Output is correct |
27 | Correct | 116 ms | 4980 KB | Output is correct |
28 | Correct | 107 ms | 4884 KB | Output is correct |
29 | Correct | 106 ms | 4904 KB | Output is correct |
30 | Correct | 135 ms | 4940 KB | Output is correct |
31 | Correct | 210 ms | 4968 KB | Output is correct |
32 | Correct | 159 ms | 5060 KB | Output is correct |
33 | Correct | 244 ms | 5012 KB | Output is correct |
34 | Correct | 135 ms | 4968 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 300 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
6 | Correct | 0 ms | 204 KB | Output is correct |
7 | Correct | 0 ms | 204 KB | Output is correct |
8 | Correct | 0 ms | 204 KB | Output is correct |
9 | Correct | 1 ms | 204 KB | Output is correct |
10 | Correct | 3 ms | 460 KB | Output is correct |
11 | Correct | 134 ms | 6252 KB | Output is correct |
12 | Correct | 114 ms | 6272 KB | Output is correct |
13 | Correct | 98 ms | 6376 KB | Output is correct |
14 | Correct | 105 ms | 6288 KB | Output is correct |
15 | Correct | 0 ms | 204 KB | Output is correct |
16 | Correct | 1 ms | 204 KB | Output is correct |
17 | Correct | 1 ms | 204 KB | Output is correct |
18 | Correct | 1 ms | 204 KB | Output is correct |
19 | Correct | 1 ms | 204 KB | Output is correct |
20 | Correct | 0 ms | 204 KB | Output is correct |
21 | Correct | 0 ms | 204 KB | Output is correct |
22 | Correct | 1 ms | 204 KB | Output is correct |
23 | Correct | 64 ms | 2576 KB | Output is correct |
24 | Correct | 39 ms | 1740 KB | Output is correct |
25 | Correct | 31 ms | 1388 KB | Output is correct |
26 | Correct | 22 ms | 1148 KB | Output is correct |
27 | Correct | 1 ms | 204 KB | Output is correct |
28 | Correct | 0 ms | 204 KB | Output is correct |
29 | Correct | 0 ms | 204 KB | Output is correct |
30 | Correct | 0 ms | 204 KB | Output is correct |
31 | Correct | 0 ms | 204 KB | Output is correct |
32 | Correct | 1 ms | 332 KB | Output is correct |
33 | Correct | 2 ms | 332 KB | Output is correct |
34 | Correct | 0 ms | 204 KB | Output is correct |
35 | Correct | 1 ms | 204 KB | Output is correct |
36 | Correct | 1 ms | 256 KB | Output is correct |
37 | Correct | 0 ms | 204 KB | Output is correct |
38 | Correct | 1 ms | 204 KB | Output is correct |
39 | Correct | 1 ms | 204 KB | Output is correct |
40 | Correct | 0 ms | 204 KB | Output is correct |
41 | Correct | 4 ms | 436 KB | Output is correct |
42 | Correct | 5 ms | 436 KB | Output is correct |
43 | Correct | 1 ms | 204 KB | Output is correct |
44 | Correct | 22 ms | 1604 KB | Output is correct |
45 | Correct | 1 ms | 204 KB | Output is correct |
46 | Correct | 1 ms | 204 KB | Output is correct |
47 | Correct | 4 ms | 320 KB | Output is correct |
48 | Correct | 1 ms | 204 KB | Output is correct |
49 | Correct | 2 ms | 204 KB | Output is correct |
50 | Correct | 1 ms | 300 KB | Output is correct |
51 | Correct | 64 ms | 4308 KB | Output is correct |
52 | Correct | 48 ms | 2420 KB | Output is correct |
53 | Correct | 31 ms | 2484 KB | Output is correct |
54 | Correct | 31 ms | 1008 KB | Output is correct |
55 | Correct | 88 ms | 2300 KB | Output is correct |
56 | Correct | 13 ms | 796 KB | Output is correct |
57 | Correct | 116 ms | 4980 KB | Output is correct |
58 | Correct | 107 ms | 4884 KB | Output is correct |
59 | Correct | 106 ms | 4904 KB | Output is correct |
60 | Correct | 135 ms | 4940 KB | Output is correct |
61 | Correct | 210 ms | 4968 KB | Output is correct |
62 | Correct | 159 ms | 5060 KB | Output is correct |
63 | Correct | 244 ms | 5012 KB | Output is correct |
64 | Correct | 135 ms | 4968 KB | Output is correct |
65 | Correct | 1 ms | 204 KB | Output is correct |
66 | Correct | 73 ms | 4900 KB | Output is correct |
67 | Correct | 97 ms | 4964 KB | Output is correct |
68 | Correct | 101 ms | 4968 KB | Output is correct |
69 | Correct | 25 ms | 948 KB | Output is correct |
70 | Correct | 6 ms | 428 KB | Output is correct |
71 | Correct | 0 ms | 204 KB | Output is correct |
72 | Correct | 42 ms | 1224 KB | Output is correct |
73 | Correct | 10 ms | 436 KB | Output is correct |
74 | Correct | 1 ms | 332 KB | Output is correct |
75 | Correct | 124 ms | 6916 KB | Output is correct |
76 | Correct | 144 ms | 6752 KB | Output is correct |
77 | Correct | 161 ms | 6212 KB | Output is correct |
78 | Correct | 180 ms | 5188 KB | Output is correct |
79 | Correct | 236 ms | 6712 KB | Output is correct |
80 | Correct | 297 ms | 9604 KB | Output is correct |
81 | Correct | 236 ms | 6488 KB | Output is correct |
82 | Correct | 252 ms | 6744 KB | Output is correct |