답안 #534161

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
534161 2022-03-08T01:44:22 Z LittleOrange Self Study (JOI22_ho_t2) C++17
0 / 100
325 ms 4940 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,m;
vector<pair<ll,ll> > dat;
bool isok(ll target){ // ans>=target;
    ll time = 0;
    for (int i = 0;i<n;i++){
        ll a = m;
        ll t = target - a*dat[i].first;
        if (t<=-dat[i].first){
            a -= (-t)/dat[i].first;
            t = target - a*dat[i].first;
        }else if (t>0){
            a += t/dat[i].second;
            t -= t/dat[i].second*dat[i].second;
            if (t>0){
                a++;
            }
        }
        time += a;
    }
    return time<=n*m;
}
ll check(ll l, ll r){
    if (l >= r) return l;
    ll mid = (r+l+1)/2;
    if (isok(mid)){
        return check(mid,r);
    }else{
        return check(l,mid-1);
    }
}
int main(){
    ios::sync_with_stdio(0);cin.tie(0);
    cin >> n >> m;
    dat.resize(n);
    for (int i = 0;i<n;i++){
        cin >> dat[i].first;
    }
    for (int i = 0;i<n;i++){
        cin >> dat[i].second;
        dat[i].first = max(dat[i].first, dat[i].second);
    }
    cout << check(1,5e18) << "\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 3 ms 332 KB Output is correct
11 Correct 143 ms 4940 KB Output is correct
12 Correct 142 ms 4940 KB Output is correct
13 Correct 139 ms 4940 KB Output is correct
14 Incorrect 325 ms 4940 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 87 ms 2664 KB Output is correct
10 Correct 61 ms 1868 KB Output is correct
11 Correct 47 ms 1484 KB Output is correct
12 Correct 38 ms 1268 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Incorrect 6 ms 332 KB Output isn't correct
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 3 ms 332 KB Output is correct
11 Correct 143 ms 4940 KB Output is correct
12 Correct 142 ms 4940 KB Output is correct
13 Correct 139 ms 4940 KB Output is correct
14 Incorrect 325 ms 4940 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 87 ms 2664 KB Output is correct
10 Correct 61 ms 1868 KB Output is correct
11 Correct 47 ms 1484 KB Output is correct
12 Correct 38 ms 1268 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Incorrect 6 ms 332 KB Output isn't correct
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 3 ms 332 KB Output is correct
11 Correct 143 ms 4940 KB Output is correct
12 Correct 142 ms 4940 KB Output is correct
13 Correct 139 ms 4940 KB Output is correct
14 Incorrect 325 ms 4940 KB Output isn't correct
15 Halted 0 ms 0 KB -