답안 #534084

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
534084 2022-03-08T00:41:52 Z PixelCat Self Study (JOI22_ho_t2) C++14
62 / 100
386 ms 6068 KB
#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define Forr(i,a,b) for(int i=a;i>=b;i--)
#define F first
#define S second
#define sz(x) ((int)x.size())
#define all(x) x.begin(),x.end()
#define eb emplace_back
#define INF (ll)(9e18)
#define int LL
using namespace std;
using LL=long long;
using pii=pair<int,int>;

const int MAXN=300030;
int a[MAXN];
int b[MAXN];

bool check(__int128_t n,__int128_t m,__int128_t tar){
    __int128_t s=0,d=0;
    For(i,1,n){
        __int128_t t=tar;
        __int128_t r=min(m,(t+a[i]-1)/a[i]);
        t-=r*a[i];
        if(t>0){
            d+=(t+b[i]-1)/b[i];
        }else{
            s+=m-r;
        }
    }
    return s>=d;
}

int32_t main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    // OAO
    int n,m; cin>>n>>m;
    For(i,1,n) cin>>a[i];
    For(i,1,n){
        cin>>b[i];
        a[i]=max(a[i],b[i]);
    }
    int hi=1e18+10;
    int lo=0;
    while(hi-lo>1){
        int mi=(hi+lo)/2;
        if(check(n,m,mi)) lo=mi;
        else hi=mi;
    }
    cout<<lo<<"\n";
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 0 ms 204 KB Output is correct
10 Correct 4 ms 332 KB Output is correct
11 Correct 252 ms 5060 KB Output is correct
12 Correct 262 ms 4988 KB Output is correct
13 Correct 241 ms 4992 KB Output is correct
14 Correct 301 ms 5060 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 386 ms 4992 KB Output is correct
17 Correct 264 ms 4932 KB Output is correct
18 Correct 239 ms 4956 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 386 ms 4992 KB Output is correct
3 Correct 264 ms 4932 KB Output is correct
4 Correct 239 ms 4956 KB Output is correct
5 Correct 0 ms 216 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 122 ms 2656 KB Output is correct
14 Correct 90 ms 1872 KB Output is correct
15 Correct 61 ms 1484 KB Output is correct
16 Correct 50 ms 1136 KB Output is correct
17 Correct 1 ms 332 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 0 ms 204 KB Output is correct
20 Correct 0 ms 204 KB Output is correct
21 Correct 0 ms 204 KB Output is correct
22 Correct 6 ms 400 KB Output is correct
23 Correct 5 ms 416 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 0 ms 204 KB Output is correct
10 Correct 4 ms 332 KB Output is correct
11 Correct 252 ms 5060 KB Output is correct
12 Correct 262 ms 4988 KB Output is correct
13 Correct 241 ms 4992 KB Output is correct
14 Correct 301 ms 5060 KB Output is correct
15 Correct 0 ms 216 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 0 ms 204 KB Output is correct
21 Correct 0 ms 204 KB Output is correct
22 Correct 0 ms 204 KB Output is correct
23 Correct 122 ms 2656 KB Output is correct
24 Correct 90 ms 1872 KB Output is correct
25 Correct 61 ms 1484 KB Output is correct
26 Correct 50 ms 1136 KB Output is correct
27 Correct 1 ms 332 KB Output is correct
28 Correct 0 ms 204 KB Output is correct
29 Correct 0 ms 204 KB Output is correct
30 Correct 0 ms 204 KB Output is correct
31 Correct 0 ms 204 KB Output is correct
32 Correct 6 ms 400 KB Output is correct
33 Correct 5 ms 416 KB Output is correct
34 Correct 1 ms 204 KB Output is correct
35 Correct 386 ms 4992 KB Output is correct
36 Correct 264 ms 4932 KB Output is correct
37 Correct 239 ms 4956 KB Output is correct
38 Correct 1 ms 316 KB Output is correct
39 Correct 1 ms 204 KB Output is correct
40 Correct 1 ms 204 KB Output is correct
41 Correct 1 ms 332 KB Output is correct
42 Correct 0 ms 204 KB Output is correct
43 Correct 0 ms 332 KB Output is correct
44 Correct 1 ms 204 KB Output is correct
45 Correct 5 ms 460 KB Output is correct
46 Correct 8 ms 584 KB Output is correct
47 Correct 1 ms 332 KB Output is correct
48 Correct 50 ms 1996 KB Output is correct
49 Correct 1 ms 332 KB Output is correct
50 Correct 1 ms 332 KB Output is correct
51 Correct 4 ms 428 KB Output is correct
52 Correct 1 ms 332 KB Output is correct
53 Correct 1 ms 204 KB Output is correct
54 Correct 1 ms 204 KB Output is correct
55 Correct 125 ms 3608 KB Output is correct
56 Correct 81 ms 2712 KB Output is correct
57 Correct 99 ms 2832 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 216 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 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 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 122 ms 2656 KB Output is correct
10 Correct 90 ms 1872 KB Output is correct
11 Correct 61 ms 1484 KB Output is correct
12 Correct 50 ms 1136 KB Output is correct
13 Correct 1 ms 332 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 Correct 6 ms 400 KB Output is correct
19 Correct 5 ms 416 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 386 ms 4992 KB Output is correct
22 Correct 264 ms 4932 KB Output is correct
23 Correct 239 ms 4956 KB Output is correct
24 Correct 41 ms 1868 KB Output is correct
25 Correct 117 ms 3372 KB Output is correct
26 Correct 27 ms 1356 KB Output is correct
27 Correct 243 ms 5952 KB Output is correct
28 Correct 255 ms 5828 KB Output is correct
29 Correct 244 ms 6068 KB Output is correct
30 Correct 257 ms 5952 KB Output is correct
31 Correct 239 ms 5948 KB Output is correct
32 Correct 368 ms 5956 KB Output is correct
33 Incorrect 245 ms 5952 KB Output isn't correct
34 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 0 ms 204 KB Output is correct
10 Correct 4 ms 332 KB Output is correct
11 Correct 252 ms 5060 KB Output is correct
12 Correct 262 ms 4988 KB Output is correct
13 Correct 241 ms 4992 KB Output is correct
14 Correct 301 ms 5060 KB Output is correct
15 Correct 0 ms 216 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 0 ms 204 KB Output is correct
21 Correct 0 ms 204 KB Output is correct
22 Correct 0 ms 204 KB Output is correct
23 Correct 122 ms 2656 KB Output is correct
24 Correct 90 ms 1872 KB Output is correct
25 Correct 61 ms 1484 KB Output is correct
26 Correct 50 ms 1136 KB Output is correct
27 Correct 1 ms 332 KB Output is correct
28 Correct 0 ms 204 KB Output is correct
29 Correct 0 ms 204 KB Output is correct
30 Correct 0 ms 204 KB Output is correct
31 Correct 0 ms 204 KB Output is correct
32 Correct 6 ms 400 KB Output is correct
33 Correct 5 ms 416 KB Output is correct
34 Correct 1 ms 316 KB Output is correct
35 Correct 1 ms 204 KB Output is correct
36 Correct 1 ms 204 KB Output is correct
37 Correct 1 ms 332 KB Output is correct
38 Correct 0 ms 204 KB Output is correct
39 Correct 0 ms 332 KB Output is correct
40 Correct 1 ms 204 KB Output is correct
41 Correct 5 ms 460 KB Output is correct
42 Correct 8 ms 584 KB Output is correct
43 Correct 1 ms 332 KB Output is correct
44 Correct 50 ms 1996 KB Output is correct
45 Correct 1 ms 332 KB Output is correct
46 Correct 1 ms 332 KB Output is correct
47 Correct 4 ms 428 KB Output is correct
48 Correct 1 ms 332 KB Output is correct
49 Correct 1 ms 204 KB Output is correct
50 Correct 1 ms 204 KB Output is correct
51 Correct 125 ms 3608 KB Output is correct
52 Correct 81 ms 2712 KB Output is correct
53 Correct 99 ms 2832 KB Output is correct
54 Correct 41 ms 1868 KB Output is correct
55 Correct 117 ms 3372 KB Output is correct
56 Correct 27 ms 1356 KB Output is correct
57 Correct 243 ms 5952 KB Output is correct
58 Correct 255 ms 5828 KB Output is correct
59 Correct 244 ms 6068 KB Output is correct
60 Correct 257 ms 5952 KB Output is correct
61 Correct 239 ms 5948 KB Output is correct
62 Correct 368 ms 5956 KB Output is correct
63 Incorrect 245 ms 5952 KB Output isn't correct
64 Halted 0 ms 0 KB -