답안 #634018

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
634018 2022-08-23T16:53:04 Z Astrayt Self Study (JOI22_ho_t2) C++14
62 / 100
210 ms 10888 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) 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 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 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 75 ms 4948 KB Output is correct
12 Correct 69 ms 4948 KB Output is correct
13 Correct 69 ms 4948 KB Output is correct
14 Correct 71 ms 5028 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 30 ms 5568 KB Output is correct
17 Correct 94 ms 5572 KB Output is correct
18 Correct 74 ms 5772 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 30 ms 5568 KB Output is correct
3 Correct 94 ms 5572 KB Output is correct
4 Correct 74 ms 5772 KB Output is correct
5 Correct 1 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 316 KB Output is correct
9 Correct 1 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 1 ms 316 KB Output is correct
13 Correct 49 ms 3028 KB Output is correct
14 Correct 34 ms 2260 KB Output is correct
15 Correct 25 ms 1876 KB Output is correct
16 Correct 21 ms 1620 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 320 KB Output is correct
19 Correct 1 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 2 ms 340 KB Output is correct
23 Correct 3 ms 496 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 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 75 ms 4948 KB Output is correct
12 Correct 69 ms 4948 KB Output is correct
13 Correct 69 ms 4948 KB Output is correct
14 Correct 71 ms 5028 KB Output is correct
15 Correct 1 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 316 KB Output is correct
19 Correct 1 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 316 KB Output is correct
23 Correct 49 ms 3028 KB Output is correct
24 Correct 34 ms 2260 KB Output is correct
25 Correct 25 ms 1876 KB Output is correct
26 Correct 21 ms 1620 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 1 ms 320 KB Output is correct
29 Correct 1 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 2 ms 340 KB Output is correct
33 Correct 3 ms 496 KB Output is correct
34 Correct 1 ms 212 KB Output is correct
35 Correct 30 ms 5568 KB Output is correct
36 Correct 94 ms 5572 KB Output is correct
37 Correct 74 ms 5772 KB Output is correct
38 Correct 0 ms 212 KB Output is correct
39 Correct 1 ms 212 KB Output is correct
40 Correct 0 ms 212 KB Output is correct
41 Correct 0 ms 212 KB Output is correct
42 Correct 1 ms 324 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 456 KB Output is correct
46 Correct 3 ms 596 KB Output is correct
47 Correct 1 ms 340 KB Output is correct
48 Correct 18 ms 2024 KB Output is correct
49 Correct 0 ms 316 KB Output is correct
50 Correct 1 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 51 ms 5460 KB Output is correct
56 Correct 45 ms 3040 KB Output is correct
57 Correct 33 ms 3028 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 316 KB Output is correct
5 Correct 1 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 316 KB Output is correct
9 Correct 49 ms 3028 KB Output is correct
10 Correct 34 ms 2260 KB Output is correct
11 Correct 25 ms 1876 KB Output is correct
12 Correct 21 ms 1620 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 320 KB Output is correct
15 Correct 1 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 2 ms 340 KB Output is correct
19 Correct 3 ms 496 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 30 ms 5568 KB Output is correct
22 Correct 94 ms 5572 KB Output is correct
23 Correct 74 ms 5772 KB Output is correct
24 Correct 31 ms 1604 KB Output is correct
25 Correct 75 ms 5016 KB Output is correct
26 Correct 14 ms 1364 KB Output is correct
27 Correct 97 ms 10812 KB Output is correct
28 Correct 106 ms 10816 KB Output is correct
29 Correct 114 ms 10756 KB Output is correct
30 Correct 137 ms 10888 KB Output is correct
31 Correct 210 ms 10804 KB Output is correct
32 Incorrect 197 ms 6188 KB Output isn't correct
33 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 75 ms 4948 KB Output is correct
12 Correct 69 ms 4948 KB Output is correct
13 Correct 69 ms 4948 KB Output is correct
14 Correct 71 ms 5028 KB Output is correct
15 Correct 1 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 316 KB Output is correct
19 Correct 1 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 316 KB Output is correct
23 Correct 49 ms 3028 KB Output is correct
24 Correct 34 ms 2260 KB Output is correct
25 Correct 25 ms 1876 KB Output is correct
26 Correct 21 ms 1620 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 1 ms 320 KB Output is correct
29 Correct 1 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 2 ms 340 KB Output is correct
33 Correct 3 ms 496 KB Output is correct
34 Correct 0 ms 212 KB Output is correct
35 Correct 1 ms 212 KB Output is correct
36 Correct 0 ms 212 KB Output is correct
37 Correct 0 ms 212 KB Output is correct
38 Correct 1 ms 324 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 456 KB Output is correct
42 Correct 3 ms 596 KB Output is correct
43 Correct 1 ms 340 KB Output is correct
44 Correct 18 ms 2024 KB Output is correct
45 Correct 0 ms 316 KB Output is correct
46 Correct 1 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 51 ms 5460 KB Output is correct
52 Correct 45 ms 3040 KB Output is correct
53 Correct 33 ms 3028 KB Output is correct
54 Correct 31 ms 1604 KB Output is correct
55 Correct 75 ms 5016 KB Output is correct
56 Correct 14 ms 1364 KB Output is correct
57 Correct 97 ms 10812 KB Output is correct
58 Correct 106 ms 10816 KB Output is correct
59 Correct 114 ms 10756 KB Output is correct
60 Correct 137 ms 10888 KB Output is correct
61 Correct 210 ms 10804 KB Output is correct
62 Incorrect 197 ms 6188 KB Output isn't correct
63 Halted 0 ms 0 KB -