Submission #634207

# Submission time Handle Problem Language Result Execution time Memory
634207 2022-08-24T05:31:31 Z Astrayt Self Study (JOI22_ho_t2) C++17
100 / 100
240 ms 11392 KB
//君の手を握ってしまったら
//孤独を知らないこの街には
//もう二度と帰ってくることはできないのでしょう
//君が手を差し伸べた 光で影が生まれる
//歌って聞かせて この話の続き
//連れて行って見たことない星まで
//さユリ - 花の塔
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
#define starburst ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pii pair<int,int>
#define pb push_back
#define ff first
#define ss second
//#define N 100005
 
void solve(){
    int N, M; cin >> N >> M;
    vector<int> A(N), B(N);
    for(auto &x:A) cin >> x;
    for(auto &x:B) cin >> x;
    for(int i = 0; i < N; ++i) A[i] = max(A[i], B[i]);
    int l = 0, r = 1e18 + 5;
    while(r != l){
        int s = 0, mid = 1 + (l + r) / 2;
        for(int i = 0, t; i < N; ++i){
            t = mid;
            if(t > M * A[i]) t -= A[i] * M, s += M;
            else {
                s += t / A[i];
                if(t % A[i]) s++;
                continue;
            }
            int k = t / B[i];
            if(t % B[i]) k++;
            if(k > N * (M - 1)) {
                s = N * M + 1; break;
            }
            s += k;
            if(s > N * M) break;
        }
        if(s <= N * M) l = mid;
        else r = mid - 1;
    }
    cout << l << '\n';
}
 
signed main(){
    starburst
    int t = 1; //cin >> t;
    while(t--) solve();
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 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 1 ms 212 KB Output is correct
6 Correct 0 ms 212 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 2 ms 460 KB Output is correct
11 Correct 80 ms 10756 KB Output is correct
12 Correct 78 ms 10752 KB Output is correct
13 Correct 75 ms 8824 KB Output is correct
14 Correct 76 ms 8716 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 41 ms 6160 KB Output is correct
17 Correct 110 ms 11340 KB Output is correct
18 Correct 72 ms 10760 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 41 ms 6160 KB Output is correct
3 Correct 110 ms 11340 KB Output is correct
4 Correct 72 ms 10760 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 1 ms 324 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 324 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 50 ms 5472 KB Output is correct
14 Correct 33 ms 3784 KB Output is correct
15 Correct 24 ms 2896 KB Output is correct
16 Correct 21 ms 2412 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 3 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 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 1 ms 212 KB Output is correct
6 Correct 0 ms 212 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 2 ms 460 KB Output is correct
11 Correct 80 ms 10756 KB Output is correct
12 Correct 78 ms 10752 KB Output is correct
13 Correct 75 ms 8824 KB Output is correct
14 Correct 76 ms 8716 KB Output is correct
15 Correct 0 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 1 ms 324 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 324 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 50 ms 5472 KB Output is correct
24 Correct 33 ms 3784 KB Output is correct
25 Correct 24 ms 2896 KB Output is correct
26 Correct 21 ms 2412 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
29 Correct 0 ms 212 KB Output is correct
30 Correct 1 ms 212 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 3 ms 468 KB Output is correct
34 Correct 0 ms 212 KB Output is correct
35 Correct 41 ms 6160 KB Output is correct
36 Correct 110 ms 11340 KB Output is correct
37 Correct 72 ms 10760 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 0 ms 324 KB Output is correct
42 Correct 1 ms 212 KB Output is correct
43 Correct 1 ms 320 KB Output is correct
44 Correct 1 ms 212 KB Output is correct
45 Correct 2 ms 468 KB Output is correct
46 Correct 4 ms 596 KB Output is correct
47 Correct 1 ms 340 KB Output is correct
48 Correct 17 ms 2004 KB Output is correct
49 Correct 0 ms 212 KB Output is correct
50 Correct 0 ms 212 KB Output is correct
51 Correct 2 ms 468 KB Output is correct
52 Correct 0 ms 212 KB Output is correct
53 Correct 1 ms 212 KB Output is correct
54 Correct 1 ms 212 KB Output is correct
55 Correct 49 ms 5456 KB Output is correct
56 Correct 32 ms 3156 KB Output is correct
57 Correct 26 ms 3156 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 324 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 324 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 50 ms 5472 KB Output is correct
10 Correct 33 ms 3784 KB Output is correct
11 Correct 24 ms 2896 KB Output is correct
12 Correct 21 ms 2412 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 0 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 1 ms 340 KB Output is correct
19 Correct 3 ms 468 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 41 ms 6160 KB Output is correct
22 Correct 110 ms 11340 KB Output is correct
23 Correct 72 ms 10760 KB Output is correct
24 Correct 30 ms 2060 KB Output is correct
25 Correct 71 ms 4964 KB Output is correct
26 Correct 12 ms 1364 KB Output is correct
27 Correct 99 ms 10752 KB Output is correct
28 Correct 101 ms 10752 KB Output is correct
29 Correct 100 ms 10816 KB Output is correct
30 Correct 124 ms 10700 KB Output is correct
31 Correct 200 ms 10768 KB Output is correct
32 Correct 104 ms 6164 KB Output is correct
33 Correct 240 ms 11392 KB Output is correct
34 Correct 98 ms 6168 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 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 1 ms 212 KB Output is correct
6 Correct 0 ms 212 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 2 ms 460 KB Output is correct
11 Correct 80 ms 10756 KB Output is correct
12 Correct 78 ms 10752 KB Output is correct
13 Correct 75 ms 8824 KB Output is correct
14 Correct 76 ms 8716 KB Output is correct
15 Correct 0 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 1 ms 324 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 324 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 50 ms 5472 KB Output is correct
24 Correct 33 ms 3784 KB Output is correct
25 Correct 24 ms 2896 KB Output is correct
26 Correct 21 ms 2412 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
29 Correct 0 ms 212 KB Output is correct
30 Correct 1 ms 212 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 3 ms 468 KB Output is correct
34 Correct 0 ms 212 KB Output is correct
35 Correct 0 ms 212 KB Output is correct
36 Correct 0 ms 212 KB Output is correct
37 Correct 0 ms 324 KB Output is correct
38 Correct 1 ms 212 KB Output is correct
39 Correct 1 ms 320 KB Output is correct
40 Correct 1 ms 212 KB Output is correct
41 Correct 2 ms 468 KB Output is correct
42 Correct 4 ms 596 KB Output is correct
43 Correct 1 ms 340 KB Output is correct
44 Correct 17 ms 2004 KB Output is correct
45 Correct 0 ms 212 KB Output is correct
46 Correct 0 ms 212 KB Output is correct
47 Correct 2 ms 468 KB Output is correct
48 Correct 0 ms 212 KB Output is correct
49 Correct 1 ms 212 KB Output is correct
50 Correct 1 ms 212 KB Output is correct
51 Correct 49 ms 5456 KB Output is correct
52 Correct 32 ms 3156 KB Output is correct
53 Correct 26 ms 3156 KB Output is correct
54 Correct 30 ms 2060 KB Output is correct
55 Correct 71 ms 4964 KB Output is correct
56 Correct 12 ms 1364 KB Output is correct
57 Correct 99 ms 10752 KB Output is correct
58 Correct 101 ms 10752 KB Output is correct
59 Correct 100 ms 10816 KB Output is correct
60 Correct 124 ms 10700 KB Output is correct
61 Correct 200 ms 10768 KB Output is correct
62 Correct 104 ms 6164 KB Output is correct
63 Correct 240 ms 11392 KB Output is correct
64 Correct 98 ms 6168 KB Output is correct
65 Correct 0 ms 212 KB Output is correct
66 Correct 41 ms 6160 KB Output is correct
67 Correct 110 ms 11340 KB Output is correct
68 Correct 72 ms 10760 KB Output is correct
69 Correct 21 ms 1360 KB Output is correct
70 Correct 6 ms 556 KB Output is correct
71 Correct 1 ms 212 KB Output is correct
72 Correct 31 ms 1736 KB Output is correct
73 Correct 7 ms 596 KB Output is correct
74 Correct 1 ms 340 KB Output is correct
75 Correct 101 ms 10828 KB Output is correct
76 Correct 114 ms 10892 KB Output is correct
77 Correct 120 ms 10764 KB Output is correct
78 Correct 159 ms 10696 KB Output is correct
79 Correct 216 ms 10804 KB Output is correct
80 Correct 213 ms 10700 KB Output is correct
81 Correct 223 ms 8816 KB Output is correct
82 Correct 216 ms 8832 KB Output is correct