답안 #634019

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
634019 2022-08-23T16:56:41 Z Astrayt Self Study (JOI22_ho_t2) C++14
100 / 100
245 ms 11400 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();
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 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 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 2 ms 340 KB Output is correct
11 Correct 82 ms 5068 KB Output is correct
12 Correct 73 ms 5012 KB Output is correct
13 Correct 84 ms 5008 KB Output is correct
14 Correct 78 ms 5024 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 28 ms 4948 KB Output is correct
17 Correct 94 ms 5012 KB Output is correct
18 Correct 73 ms 4948 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 28 ms 4948 KB Output is correct
3 Correct 94 ms 5012 KB Output is correct
4 Correct 73 ms 4948 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 0 ms 212 KB Output is correct
9 Correct 0 ms 212 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 52 ms 2728 KB Output is correct
14 Correct 32 ms 1876 KB Output is correct
15 Correct 24 ms 1544 KB Output is correct
16 Correct 21 ms 1304 KB Output is correct
17 Correct 0 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 0 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 3 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 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 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 2 ms 340 KB Output is correct
11 Correct 82 ms 5068 KB Output is correct
12 Correct 73 ms 5012 KB Output is correct
13 Correct 84 ms 5008 KB Output is correct
14 Correct 78 ms 5024 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 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 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 52 ms 2728 KB Output is correct
24 Correct 32 ms 1876 KB Output is correct
25 Correct 24 ms 1544 KB Output is correct
26 Correct 21 ms 1304 KB Output is correct
27 Correct 0 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 0 ms 212 KB Output is correct
31 Correct 0 ms 212 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 3 ms 340 KB Output is correct
34 Correct 0 ms 212 KB Output is correct
35 Correct 28 ms 4948 KB Output is correct
36 Correct 94 ms 5012 KB Output is correct
37 Correct 73 ms 4948 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 1 ms 212 KB Output is correct
42 Correct 1 ms 320 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 468 KB Output is correct
46 Correct 4 ms 560 KB Output is correct
47 Correct 1 ms 340 KB Output is correct
48 Correct 20 ms 1220 KB Output is correct
49 Correct 1 ms 212 KB Output is correct
50 Correct 1 ms 324 KB Output is correct
51 Correct 3 ms 468 KB Output is correct
52 Correct 1 ms 212 KB Output is correct
53 Correct 1 ms 212 KB Output is correct
54 Correct 1 ms 340 KB Output is correct
55 Correct 55 ms 2772 KB Output is correct
56 Correct 33 ms 2124 KB Output is correct
57 Correct 27 ms 2000 KB Output is correct
# 결과 실행 시간 메모리 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 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 0 ms 212 KB Output is correct
9 Correct 52 ms 2728 KB Output is correct
10 Correct 32 ms 1876 KB Output is correct
11 Correct 24 ms 1544 KB Output is correct
12 Correct 21 ms 1304 KB Output is correct
13 Correct 0 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 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 3 ms 340 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 28 ms 4948 KB Output is correct
22 Correct 94 ms 5012 KB Output is correct
23 Correct 73 ms 4948 KB Output is correct
24 Correct 29 ms 980 KB Output is correct
25 Correct 71 ms 2544 KB Output is correct
26 Correct 13 ms 852 KB Output is correct
27 Correct 109 ms 5136 KB Output is correct
28 Correct 102 ms 5076 KB Output is correct
29 Correct 101 ms 5136 KB Output is correct
30 Correct 123 ms 5136 KB Output is correct
31 Correct 200 ms 5136 KB Output is correct
32 Correct 125 ms 5076 KB Output is correct
33 Correct 245 ms 11400 KB Output is correct
34 Correct 103 ms 6220 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 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 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 2 ms 340 KB Output is correct
11 Correct 82 ms 5068 KB Output is correct
12 Correct 73 ms 5012 KB Output is correct
13 Correct 84 ms 5008 KB Output is correct
14 Correct 78 ms 5024 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 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 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 52 ms 2728 KB Output is correct
24 Correct 32 ms 1876 KB Output is correct
25 Correct 24 ms 1544 KB Output is correct
26 Correct 21 ms 1304 KB Output is correct
27 Correct 0 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 0 ms 212 KB Output is correct
31 Correct 0 ms 212 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 3 ms 340 KB Output is correct
34 Correct 1 ms 212 KB Output is correct
35 Correct 1 ms 320 KB Output is correct
36 Correct 1 ms 212 KB Output is correct
37 Correct 1 ms 212 KB Output is correct
38 Correct 1 ms 320 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 468 KB Output is correct
42 Correct 4 ms 560 KB Output is correct
43 Correct 1 ms 340 KB Output is correct
44 Correct 20 ms 1220 KB Output is correct
45 Correct 1 ms 212 KB Output is correct
46 Correct 1 ms 324 KB Output is correct
47 Correct 3 ms 468 KB Output is correct
48 Correct 1 ms 212 KB Output is correct
49 Correct 1 ms 212 KB Output is correct
50 Correct 1 ms 340 KB Output is correct
51 Correct 55 ms 2772 KB Output is correct
52 Correct 33 ms 2124 KB Output is correct
53 Correct 27 ms 2000 KB Output is correct
54 Correct 29 ms 980 KB Output is correct
55 Correct 71 ms 2544 KB Output is correct
56 Correct 13 ms 852 KB Output is correct
57 Correct 109 ms 5136 KB Output is correct
58 Correct 102 ms 5076 KB Output is correct
59 Correct 101 ms 5136 KB Output is correct
60 Correct 123 ms 5136 KB Output is correct
61 Correct 200 ms 5136 KB Output is correct
62 Correct 125 ms 5076 KB Output is correct
63 Correct 245 ms 11400 KB Output is correct
64 Correct 103 ms 6220 KB Output is correct
65 Correct 0 ms 212 KB Output is correct
66 Correct 28 ms 4948 KB Output is correct
67 Correct 94 ms 5012 KB Output is correct
68 Correct 73 ms 4948 KB Output is correct
69 Correct 22 ms 1364 KB Output is correct
70 Correct 7 ms 588 KB Output is correct
71 Correct 0 ms 212 KB Output is correct
72 Correct 32 ms 1764 KB Output is correct
73 Correct 7 ms 592 KB Output is correct
74 Correct 1 ms 348 KB Output is correct
75 Correct 106 ms 10808 KB Output is correct
76 Correct 121 ms 10752 KB Output is correct
77 Correct 130 ms 10812 KB Output is correct
78 Correct 171 ms 10804 KB Output is correct
79 Correct 214 ms 10700 KB Output is correct
80 Correct 223 ms 10804 KB Output is correct
81 Correct 226 ms 8844 KB Output is correct
82 Correct 229 ms 8828 KB Output is correct