답안 #648145

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
648145 2022-10-05T14:00:24 Z alanl Self Study (JOI22_ho_t2) C++14
100 / 100
241 ms 11448 KB
#include <bits/stdc++.h>
#define pb push_back
#define f first
#define s second
#define rep(X, a,b) for(int X=a;X<b;++X)
#define ALL(a) (a).begin(), (a).end()
#define SZ(a) (int)(a).size()
#define NL "\n"
using namespace std;
typedef pair<long long,long long> pll;
typedef pair<int,int> pii;
typedef long long ll;
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << "," << p.second << ')'; }
template<typename A> ostream& operator<<(ostream &os, const vector<A> &p){
	for(const auto &a:p)
		os << a << " ";
	os << "\n";
	return os;
}

ll n, m;
ll a[300010], b[300010];

int check(ll x){
	ll day=0;
	rep(i,0,n){
		if(max(a[i], b[i])*m>=x) day+=(x+max(a[i], b[i])-1)/max(a[i], b[i]);
		else day+=m+(x-max(a[i], b[i])*m+b[i]-1)/b[i];
		if(day>n*m) return 0;
	}
	return 1;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>n>>m;
	rep(i,0,n) cin>>a[i];
	rep(i,0,n) cin>>b[i];
	ll l=0, r=1ll<<60;
	while(l<r-1){
		ll mid=(l+r)>>1;
		if(check(mid)) l=mid;
		else r=mid;
	}
	cout<<l<<NL;
}
# 결과 실행 시간 메모리 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 340 KB Output is correct
6 Correct 1 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 1 ms 212 KB Output is correct
10 Correct 2 ms 340 KB Output is correct
11 Correct 103 ms 4948 KB Output is correct
12 Correct 102 ms 5000 KB Output is correct
13 Correct 80 ms 4984 KB Output is correct
14 Correct 68 ms 4928 KB Output is correct
15 Correct 1 ms 228 KB Output is correct
16 Correct 36 ms 6156 KB Output is correct
17 Correct 113 ms 11380 KB Output is correct
18 Correct 99 ms 10804 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 228 KB Output is correct
2 Correct 36 ms 6156 KB Output is correct
3 Correct 113 ms 11380 KB Output is correct
4 Correct 99 ms 10804 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 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 61 ms 2660 KB Output is correct
14 Correct 32 ms 1876 KB Output is correct
15 Correct 24 ms 1508 KB Output is correct
16 Correct 20 ms 1276 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 3 ms 468 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 340 KB Output is correct
6 Correct 1 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 1 ms 212 KB Output is correct
10 Correct 2 ms 340 KB Output is correct
11 Correct 103 ms 4948 KB Output is correct
12 Correct 102 ms 5000 KB Output is correct
13 Correct 80 ms 4984 KB Output is correct
14 Correct 68 ms 4928 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 61 ms 2660 KB Output is correct
24 Correct 32 ms 1876 KB Output is correct
25 Correct 24 ms 1508 KB Output is correct
26 Correct 20 ms 1276 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 0 ms 212 KB Output is correct
29 Correct 0 ms 212 KB Output is correct
30 Correct 1 ms 212 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 3 ms 468 KB Output is correct
34 Correct 1 ms 228 KB Output is correct
35 Correct 36 ms 6156 KB Output is correct
36 Correct 113 ms 11380 KB Output is correct
37 Correct 99 ms 10804 KB Output is correct
38 Correct 1 ms 328 KB Output is correct
39 Correct 1 ms 340 KB Output is correct
40 Correct 1 ms 212 KB Output is correct
41 Correct 0 ms 328 KB Output is correct
42 Correct 1 ms 328 KB Output is correct
43 Correct 1 ms 340 KB Output is correct
44 Correct 1 ms 212 KB Output is correct
45 Correct 3 ms 468 KB Output is correct
46 Correct 6 ms 596 KB Output is correct
47 Correct 1 ms 340 KB Output is correct
48 Correct 19 ms 2004 KB Output is correct
49 Correct 1 ms 212 KB Output is correct
50 Correct 1 ms 340 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 212 KB Output is correct
55 Correct 55 ms 5572 KB Output is correct
56 Correct 32 ms 3156 KB Output is correct
57 Correct 26 ms 3156 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 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 61 ms 2660 KB Output is correct
10 Correct 32 ms 1876 KB Output is correct
11 Correct 24 ms 1508 KB Output is correct
12 Correct 20 ms 1276 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 3 ms 468 KB Output is correct
20 Correct 1 ms 228 KB Output is correct
21 Correct 36 ms 6156 KB Output is correct
22 Correct 113 ms 11380 KB Output is correct
23 Correct 99 ms 10804 KB Output is correct
24 Correct 32 ms 1932 KB Output is correct
25 Correct 74 ms 4940 KB Output is correct
26 Correct 14 ms 1360 KB Output is correct
27 Correct 99 ms 10840 KB Output is correct
28 Correct 108 ms 10748 KB Output is correct
29 Correct 130 ms 10800 KB Output is correct
30 Correct 129 ms 10896 KB Output is correct
31 Correct 217 ms 10848 KB Output is correct
32 Correct 118 ms 6172 KB Output is correct
33 Correct 219 ms 11448 KB Output is correct
34 Correct 114 ms 6172 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 340 KB Output is correct
6 Correct 1 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 1 ms 212 KB Output is correct
10 Correct 2 ms 340 KB Output is correct
11 Correct 103 ms 4948 KB Output is correct
12 Correct 102 ms 5000 KB Output is correct
13 Correct 80 ms 4984 KB Output is correct
14 Correct 68 ms 4928 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 61 ms 2660 KB Output is correct
24 Correct 32 ms 1876 KB Output is correct
25 Correct 24 ms 1508 KB Output is correct
26 Correct 20 ms 1276 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 0 ms 212 KB Output is correct
29 Correct 0 ms 212 KB Output is correct
30 Correct 1 ms 212 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 3 ms 468 KB Output is correct
34 Correct 1 ms 328 KB Output is correct
35 Correct 1 ms 340 KB Output is correct
36 Correct 1 ms 212 KB Output is correct
37 Correct 0 ms 328 KB Output is correct
38 Correct 1 ms 328 KB Output is correct
39 Correct 1 ms 340 KB Output is correct
40 Correct 1 ms 212 KB Output is correct
41 Correct 3 ms 468 KB Output is correct
42 Correct 6 ms 596 KB Output is correct
43 Correct 1 ms 340 KB Output is correct
44 Correct 19 ms 2004 KB Output is correct
45 Correct 1 ms 212 KB Output is correct
46 Correct 1 ms 340 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 212 KB Output is correct
51 Correct 55 ms 5572 KB Output is correct
52 Correct 32 ms 3156 KB Output is correct
53 Correct 26 ms 3156 KB Output is correct
54 Correct 32 ms 1932 KB Output is correct
55 Correct 74 ms 4940 KB Output is correct
56 Correct 14 ms 1360 KB Output is correct
57 Correct 99 ms 10840 KB Output is correct
58 Correct 108 ms 10748 KB Output is correct
59 Correct 130 ms 10800 KB Output is correct
60 Correct 129 ms 10896 KB Output is correct
61 Correct 217 ms 10848 KB Output is correct
62 Correct 118 ms 6172 KB Output is correct
63 Correct 219 ms 11448 KB Output is correct
64 Correct 114 ms 6172 KB Output is correct
65 Correct 1 ms 228 KB Output is correct
66 Correct 36 ms 6156 KB Output is correct
67 Correct 113 ms 11380 KB Output is correct
68 Correct 99 ms 10804 KB Output is correct
69 Correct 23 ms 1352 KB Output is correct
70 Correct 7 ms 616 KB Output is correct
71 Correct 1 ms 212 KB Output is correct
72 Correct 35 ms 1852 KB Output is correct
73 Correct 7 ms 580 KB Output is correct
74 Correct 1 ms 340 KB Output is correct
75 Correct 105 ms 10728 KB Output is correct
76 Correct 124 ms 10852 KB Output is correct
77 Correct 152 ms 10700 KB Output is correct
78 Correct 163 ms 10732 KB Output is correct
79 Correct 231 ms 10828 KB Output is correct
80 Correct 241 ms 10700 KB Output is correct
81 Correct 179 ms 8892 KB Output is correct
82 Correct 195 ms 8772 KB Output is correct