# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
941130 |
2024-03-08T07:43:25 Z |
Pring |
Self Study (JOI22_ho_t2) |
C++17 |
|
210 ms |
11576 KB |
#include <bits/stdc++.h>
using namespace std;
#ifdef MIKU
const string dbmc = "\033[1;38;2;57;197;187m", dbrs = "\033[0m";
#define debug(x...) cout << dbmc << "[" << #x << "]: ", dout(x)
void dout() { cout << dbrs << endl; }
template <typename T, typename ...U>
void dout(T t, U ...u) { cout << t << (sizeof...(u) ? ", " : ""); dout(u...); }
#else
#define debug(...) 39
#endif
#define int long long
#define fs first
#define sc second
#define mp make_pair
#define FOR(i, j, k) for (int i = j, Z = k; i < Z; i++)
typedef pair<int, int> pii;
const int MXN = 300005, INF = 3.9e18;
int n, m, a[MXN], b[MXN];
int DC(int a, int b) {
return (a - 1) / b + 1;
}
bool check(int x) {
int now = m * n;
FOR(i, 0, n) {
if (a[i] > b[i]) {
if (a[i] * m >= x) now -= DC(x, a[i]);
else now -= (m + DC(x - a[i] * m, b[i]));
} else {
now -= DC(x, b[i]);
}
if (now < 0) return false;
}
return true;
}
int miku() {
cin >> n >> m;
FOR(i, 0, n) cin >> a[i];
FOR(i, 0, n) cin >> b[i];
int l = 0, r = INF;
while (l + 1 < r) {
int mid = (l + r) >> 1;
(check(mid) ? l : r) = mid;
}
return l;
}
int32_t main() {
cin.tie(0) -> sync_with_stdio(false);
cin.exceptions(cin.failbit);
cout << miku() << '\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
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 |
1 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 |
1 ms |
2396 KB |
Output is correct |
10 |
Correct |
2 ms |
2396 KB |
Output is correct |
11 |
Correct |
95 ms |
4956 KB |
Output is correct |
12 |
Correct |
89 ms |
5136 KB |
Output is correct |
13 |
Correct |
64 ms |
4952 KB |
Output is correct |
14 |
Correct |
52 ms |
4948 KB |
Output is correct |
15 |
Correct |
1 ms |
2396 KB |
Output is correct |
16 |
Correct |
25 ms |
4984 KB |
Output is correct |
17 |
Correct |
74 ms |
4948 KB |
Output is correct |
18 |
Correct |
80 ms |
4944 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
25 ms |
4984 KB |
Output is correct |
3 |
Correct |
74 ms |
4948 KB |
Output is correct |
4 |
Correct |
80 ms |
4944 KB |
Output is correct |
5 |
Correct |
1 ms |
2392 KB |
Output is correct |
6 |
Correct |
1 ms |
2396 KB |
Output is correct |
7 |
Correct |
1 ms |
2392 KB |
Output is correct |
8 |
Correct |
1 ms |
2396 KB |
Output is correct |
9 |
Correct |
1 ms |
2392 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 |
42 ms |
4700 KB |
Output is correct |
14 |
Correct |
28 ms |
4700 KB |
Output is correct |
15 |
Correct |
21 ms |
4696 KB |
Output is correct |
16 |
Correct |
17 ms |
4700 KB |
Output is correct |
17 |
Correct |
1 ms |
2392 KB |
Output is correct |
18 |
Correct |
1 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 |
3 ms |
2652 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
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 |
1 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 |
1 ms |
2396 KB |
Output is correct |
10 |
Correct |
2 ms |
2396 KB |
Output is correct |
11 |
Correct |
95 ms |
4956 KB |
Output is correct |
12 |
Correct |
89 ms |
5136 KB |
Output is correct |
13 |
Correct |
64 ms |
4952 KB |
Output is correct |
14 |
Correct |
52 ms |
4948 KB |
Output is correct |
15 |
Correct |
1 ms |
2392 KB |
Output is correct |
16 |
Correct |
1 ms |
2396 KB |
Output is correct |
17 |
Correct |
1 ms |
2392 KB |
Output is correct |
18 |
Correct |
1 ms |
2396 KB |
Output is correct |
19 |
Correct |
1 ms |
2392 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 |
42 ms |
4700 KB |
Output is correct |
24 |
Correct |
28 ms |
4700 KB |
Output is correct |
25 |
Correct |
21 ms |
4696 KB |
Output is correct |
26 |
Correct |
17 ms |
4700 KB |
Output is correct |
27 |
Correct |
1 ms |
2392 KB |
Output is correct |
28 |
Correct |
1 ms |
2396 KB |
Output is correct |
29 |
Correct |
1 ms |
2396 KB |
Output is correct |
30 |
Correct |
1 ms |
2396 KB |
Output is correct |
31 |
Correct |
1 ms |
2396 KB |
Output is correct |
32 |
Correct |
1 ms |
2396 KB |
Output is correct |
33 |
Correct |
3 ms |
2652 KB |
Output is correct |
34 |
Correct |
1 ms |
2396 KB |
Output is correct |
35 |
Correct |
25 ms |
4984 KB |
Output is correct |
36 |
Correct |
74 ms |
4948 KB |
Output is correct |
37 |
Correct |
80 ms |
4944 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 |
1 ms |
2396 KB |
Output is correct |
44 |
Correct |
1 ms |
2396 KB |
Output is correct |
45 |
Correct |
2 ms |
2648 KB |
Output is correct |
46 |
Correct |
3 ms |
2648 KB |
Output is correct |
47 |
Correct |
1 ms |
2392 KB |
Output is correct |
48 |
Correct |
18 ms |
5724 KB |
Output is correct |
49 |
Correct |
1 ms |
2396 KB |
Output is correct |
50 |
Correct |
1 ms |
2396 KB |
Output is correct |
51 |
Correct |
2 ms |
2392 KB |
Output is correct |
52 |
Correct |
1 ms |
2396 KB |
Output is correct |
53 |
Correct |
1 ms |
2396 KB |
Output is correct |
54 |
Correct |
1 ms |
2396 KB |
Output is correct |
55 |
Correct |
48 ms |
7752 KB |
Output is correct |
56 |
Correct |
26 ms |
5976 KB |
Output is correct |
57 |
Correct |
22 ms |
5976 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2392 KB |
Output is correct |
2 |
Correct |
1 ms |
2396 KB |
Output is correct |
3 |
Correct |
1 ms |
2392 KB |
Output is correct |
4 |
Correct |
1 ms |
2396 KB |
Output is correct |
5 |
Correct |
1 ms |
2392 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 |
42 ms |
4700 KB |
Output is correct |
10 |
Correct |
28 ms |
4700 KB |
Output is correct |
11 |
Correct |
21 ms |
4696 KB |
Output is correct |
12 |
Correct |
17 ms |
4700 KB |
Output is correct |
13 |
Correct |
1 ms |
2392 KB |
Output is correct |
14 |
Correct |
1 ms |
2396 KB |
Output is correct |
15 |
Correct |
1 ms |
2396 KB |
Output is correct |
16 |
Correct |
1 ms |
2396 KB |
Output is correct |
17 |
Correct |
1 ms |
2396 KB |
Output is correct |
18 |
Correct |
1 ms |
2396 KB |
Output is correct |
19 |
Correct |
3 ms |
2652 KB |
Output is correct |
20 |
Correct |
1 ms |
2396 KB |
Output is correct |
21 |
Correct |
25 ms |
4984 KB |
Output is correct |
22 |
Correct |
74 ms |
4948 KB |
Output is correct |
23 |
Correct |
80 ms |
4944 KB |
Output is correct |
24 |
Correct |
26 ms |
5468 KB |
Output is correct |
25 |
Correct |
61 ms |
7260 KB |
Output is correct |
26 |
Correct |
11 ms |
5212 KB |
Output is correct |
27 |
Correct |
82 ms |
10796 KB |
Output is correct |
28 |
Correct |
83 ms |
11044 KB |
Output is correct |
29 |
Correct |
90 ms |
10744 KB |
Output is correct |
30 |
Correct |
108 ms |
10744 KB |
Output is correct |
31 |
Correct |
180 ms |
10744 KB |
Output is correct |
32 |
Correct |
103 ms |
6236 KB |
Output is correct |
33 |
Correct |
210 ms |
11576 KB |
Output is correct |
34 |
Correct |
104 ms |
6236 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
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 |
1 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 |
1 ms |
2396 KB |
Output is correct |
10 |
Correct |
2 ms |
2396 KB |
Output is correct |
11 |
Correct |
95 ms |
4956 KB |
Output is correct |
12 |
Correct |
89 ms |
5136 KB |
Output is correct |
13 |
Correct |
64 ms |
4952 KB |
Output is correct |
14 |
Correct |
52 ms |
4948 KB |
Output is correct |
15 |
Correct |
1 ms |
2392 KB |
Output is correct |
16 |
Correct |
1 ms |
2396 KB |
Output is correct |
17 |
Correct |
1 ms |
2392 KB |
Output is correct |
18 |
Correct |
1 ms |
2396 KB |
Output is correct |
19 |
Correct |
1 ms |
2392 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 |
42 ms |
4700 KB |
Output is correct |
24 |
Correct |
28 ms |
4700 KB |
Output is correct |
25 |
Correct |
21 ms |
4696 KB |
Output is correct |
26 |
Correct |
17 ms |
4700 KB |
Output is correct |
27 |
Correct |
1 ms |
2392 KB |
Output is correct |
28 |
Correct |
1 ms |
2396 KB |
Output is correct |
29 |
Correct |
1 ms |
2396 KB |
Output is correct |
30 |
Correct |
1 ms |
2396 KB |
Output is correct |
31 |
Correct |
1 ms |
2396 KB |
Output is correct |
32 |
Correct |
1 ms |
2396 KB |
Output is correct |
33 |
Correct |
3 ms |
2652 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 |
1 ms |
2396 KB |
Output is correct |
40 |
Correct |
1 ms |
2396 KB |
Output is correct |
41 |
Correct |
2 ms |
2648 KB |
Output is correct |
42 |
Correct |
3 ms |
2648 KB |
Output is correct |
43 |
Correct |
1 ms |
2392 KB |
Output is correct |
44 |
Correct |
18 ms |
5724 KB |
Output is correct |
45 |
Correct |
1 ms |
2396 KB |
Output is correct |
46 |
Correct |
1 ms |
2396 KB |
Output is correct |
47 |
Correct |
2 ms |
2392 KB |
Output is correct |
48 |
Correct |
1 ms |
2396 KB |
Output is correct |
49 |
Correct |
1 ms |
2396 KB |
Output is correct |
50 |
Correct |
1 ms |
2396 KB |
Output is correct |
51 |
Correct |
48 ms |
7752 KB |
Output is correct |
52 |
Correct |
26 ms |
5976 KB |
Output is correct |
53 |
Correct |
22 ms |
5976 KB |
Output is correct |
54 |
Correct |
26 ms |
5468 KB |
Output is correct |
55 |
Correct |
61 ms |
7260 KB |
Output is correct |
56 |
Correct |
11 ms |
5212 KB |
Output is correct |
57 |
Correct |
82 ms |
10796 KB |
Output is correct |
58 |
Correct |
83 ms |
11044 KB |
Output is correct |
59 |
Correct |
90 ms |
10744 KB |
Output is correct |
60 |
Correct |
108 ms |
10744 KB |
Output is correct |
61 |
Correct |
180 ms |
10744 KB |
Output is correct |
62 |
Correct |
103 ms |
6236 KB |
Output is correct |
63 |
Correct |
210 ms |
11576 KB |
Output is correct |
64 |
Correct |
104 ms |
6236 KB |
Output is correct |
65 |
Correct |
1 ms |
2396 KB |
Output is correct |
66 |
Correct |
25 ms |
4984 KB |
Output is correct |
67 |
Correct |
74 ms |
4948 KB |
Output is correct |
68 |
Correct |
80 ms |
4944 KB |
Output is correct |
69 |
Correct |
21 ms |
5212 KB |
Output is correct |
70 |
Correct |
6 ms |
2628 KB |
Output is correct |
71 |
Correct |
1 ms |
2392 KB |
Output is correct |
72 |
Correct |
28 ms |
5464 KB |
Output is correct |
73 |
Correct |
6 ms |
2648 KB |
Output is correct |
74 |
Correct |
1 ms |
2396 KB |
Output is correct |
75 |
Correct |
99 ms |
10680 KB |
Output is correct |
76 |
Correct |
108 ms |
11088 KB |
Output is correct |
77 |
Correct |
105 ms |
10836 KB |
Output is correct |
78 |
Correct |
140 ms |
10924 KB |
Output is correct |
79 |
Correct |
187 ms |
10832 KB |
Output is correct |
80 |
Correct |
200 ms |
11248 KB |
Output is correct |
81 |
Correct |
197 ms |
8948 KB |
Output is correct |
82 |
Correct |
136 ms |
8788 KB |
Output is correct |