Submission #634017

# Submission time Handle Problem Language Result Execution time Memory
634017 2022-08-23T16:50:27 Z Astrayt Self Study (JOI22_ho_t2) C++14
0 / 100
409 ms 5264 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 = 1e15 + 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;
            }
            if(t > (N * (M - 1)) * B[i])
            s += t / B[i];
            if(t % B[i]) s++;
        }
        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 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 260 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 0 ms 212 KB Output is correct
10 Correct 3 ms 464 KB Output is correct
11 Correct 168 ms 5188 KB Output is correct
12 Correct 167 ms 5264 KB Output is correct
13 Correct 192 ms 5204 KB Output is correct
14 Incorrect 409 ms 5264 KB Output isn't correct
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 260 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 0 ms 212 KB Output is correct
10 Correct 3 ms 464 KB Output is correct
11 Correct 168 ms 5188 KB Output is correct
12 Correct 167 ms 5264 KB Output is correct
13 Correct 192 ms 5204 KB Output is correct
14 Incorrect 409 ms 5264 KB Output isn't correct
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 260 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 0 ms 212 KB Output is correct
10 Correct 3 ms 464 KB Output is correct
11 Correct 168 ms 5188 KB Output is correct
12 Correct 167 ms 5264 KB Output is correct
13 Correct 192 ms 5204 KB Output is correct
14 Incorrect 409 ms 5264 KB Output isn't correct
15 Halted 0 ms 0 KB -