답안 #534352

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
534352 2022-03-08T05:59:02 Z PikaQ Self Study (JOI22_ho_t2) C++17
62 / 100
179 ms 5060 KB
#include<bits/stdc++.h>
#define forn(i,n) for(int i = 0;i < (n);i++)
#define Forn(i,n) for(int i = 1;i <= (n);i++)
#define all(p) p.begin(),p.end()
#define pb push_back
#define F first
#define S second
#define rz resize
#define sz(x) x.size()
#define int long long
#define vi vector<int>
#define pii pair<int,int>
using namespace std;
const int INF = 5000009;
int n,m; 

void solve(){
	cin >> n >> m;
	vi a(n),b(n);
	forn(i,n) cin >> a[i];
	forn(i,n) cin >> b[i];
	forn(i,n){
		if(b[i] > a[i]) a[i] = max(b[i],a[i]);
	}
	int lo = 0,hi = (int)2e18 + (int)10;
	while(lo != hi-1){
		int mid = (lo+hi)/2;
		int res = 0;
		forn(i,n){
			if(a[i] * m < mid){
				res -= ceil(((double)mid - a[i] * m) / b[i]);
				continue;
			}
			int c = ceil((double)mid/a[i]);
			res += (m-c);
		}
		if(res >= 0) lo = mid;
		else hi = mid;
	}
	cout << lo << '\n';
}
 
signed main(){
	cin.tie(NULL);
	cout.tie(NULL);
	ios_base::sync_with_stdio(0);
	solve();
	return 0;
}
# 결과 실행 시간 메모리 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 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 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 0 ms 204 KB Output is correct
10 Correct 3 ms 380 KB Output is correct
11 Correct 150 ms 5004 KB Output is correct
12 Correct 138 ms 5000 KB Output is correct
13 Correct 155 ms 5004 KB Output is correct
14 Correct 157 ms 5000 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 140 ms 5060 KB Output is correct
17 Correct 179 ms 5004 KB Output is correct
18 Correct 173 ms 4940 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 140 ms 5060 KB Output is correct
3 Correct 179 ms 5004 KB Output is correct
4 Correct 173 ms 4940 KB Output is correct
5 Correct 0 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 1 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 77 ms 2652 KB Output is correct
14 Correct 48 ms 1868 KB Output is correct
15 Correct 35 ms 1484 KB Output is correct
16 Correct 30 ms 1320 KB Output is correct
17 Correct 1 ms 204 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 1 ms 204 KB Output is correct
22 Correct 4 ms 332 KB Output is correct
23 Correct 3 ms 332 KB Output is correct
# 결과 실행 시간 메모리 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 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 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 0 ms 204 KB Output is correct
10 Correct 3 ms 380 KB Output is correct
11 Correct 150 ms 5004 KB Output is correct
12 Correct 138 ms 5000 KB Output is correct
13 Correct 155 ms 5004 KB Output is correct
14 Correct 157 ms 5000 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 0 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 1 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 77 ms 2652 KB Output is correct
24 Correct 48 ms 1868 KB Output is correct
25 Correct 35 ms 1484 KB Output is correct
26 Correct 30 ms 1320 KB Output is correct
27 Correct 1 ms 204 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 1 ms 204 KB Output is correct
32 Correct 4 ms 332 KB Output is correct
33 Correct 3 ms 332 KB Output is correct
34 Correct 0 ms 204 KB Output is correct
35 Correct 140 ms 5060 KB Output is correct
36 Correct 179 ms 5004 KB Output is correct
37 Correct 173 ms 4940 KB Output is correct
38 Correct 1 ms 204 KB Output is correct
39 Correct 1 ms 204 KB Output is correct
40 Correct 1 ms 204 KB Output is correct
41 Correct 0 ms 204 KB Output is correct
42 Correct 0 ms 204 KB Output is correct
43 Correct 0 ms 204 KB Output is correct
44 Correct 0 ms 204 KB Output is correct
45 Correct 3 ms 332 KB Output is correct
46 Correct 5 ms 332 KB Output is correct
47 Correct 1 ms 204 KB Output is correct
48 Correct 24 ms 1100 KB Output is correct
49 Correct 1 ms 204 KB Output is correct
50 Correct 1 ms 204 KB Output is correct
51 Correct 3 ms 332 KB Output is correct
52 Correct 1 ms 204 KB Output is correct
53 Correct 0 ms 204 KB Output is correct
54 Correct 0 ms 204 KB Output is correct
55 Correct 84 ms 2636 KB Output is correct
56 Correct 53 ms 1988 KB Output is correct
57 Correct 50 ms 1868 KB Output is correct
# 결과 실행 시간 메모리 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 1 ms 204 KB Output is correct
9 Correct 77 ms 2652 KB Output is correct
10 Correct 48 ms 1868 KB Output is correct
11 Correct 35 ms 1484 KB Output is correct
12 Correct 30 ms 1320 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 1 ms 204 KB Output is correct
18 Correct 4 ms 332 KB Output is correct
19 Correct 3 ms 332 KB Output is correct
20 Correct 0 ms 204 KB Output is correct
21 Correct 140 ms 5060 KB Output is correct
22 Correct 179 ms 5004 KB Output is correct
23 Correct 173 ms 4940 KB Output is correct
24 Correct 19 ms 972 KB Output is correct
25 Correct 60 ms 2380 KB Output is correct
26 Correct 17 ms 716 KB Output is correct
27 Correct 153 ms 4996 KB Output is correct
28 Correct 149 ms 4940 KB Output is correct
29 Correct 144 ms 5000 KB Output is correct
30 Correct 152 ms 4940 KB Output is correct
31 Incorrect 163 ms 5000 KB Output isn't correct
32 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 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 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 0 ms 204 KB Output is correct
10 Correct 3 ms 380 KB Output is correct
11 Correct 150 ms 5004 KB Output is correct
12 Correct 138 ms 5000 KB Output is correct
13 Correct 155 ms 5004 KB Output is correct
14 Correct 157 ms 5000 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 0 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 1 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 77 ms 2652 KB Output is correct
24 Correct 48 ms 1868 KB Output is correct
25 Correct 35 ms 1484 KB Output is correct
26 Correct 30 ms 1320 KB Output is correct
27 Correct 1 ms 204 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 1 ms 204 KB Output is correct
32 Correct 4 ms 332 KB Output is correct
33 Correct 3 ms 332 KB Output is correct
34 Correct 1 ms 204 KB Output is correct
35 Correct 1 ms 204 KB Output is correct
36 Correct 1 ms 204 KB Output is correct
37 Correct 0 ms 204 KB Output is correct
38 Correct 0 ms 204 KB Output is correct
39 Correct 0 ms 204 KB Output is correct
40 Correct 0 ms 204 KB Output is correct
41 Correct 3 ms 332 KB Output is correct
42 Correct 5 ms 332 KB Output is correct
43 Correct 1 ms 204 KB Output is correct
44 Correct 24 ms 1100 KB Output is correct
45 Correct 1 ms 204 KB Output is correct
46 Correct 1 ms 204 KB Output is correct
47 Correct 3 ms 332 KB Output is correct
48 Correct 1 ms 204 KB Output is correct
49 Correct 0 ms 204 KB Output is correct
50 Correct 0 ms 204 KB Output is correct
51 Correct 84 ms 2636 KB Output is correct
52 Correct 53 ms 1988 KB Output is correct
53 Correct 50 ms 1868 KB Output is correct
54 Correct 19 ms 972 KB Output is correct
55 Correct 60 ms 2380 KB Output is correct
56 Correct 17 ms 716 KB Output is correct
57 Correct 153 ms 4996 KB Output is correct
58 Correct 149 ms 4940 KB Output is correct
59 Correct 144 ms 5000 KB Output is correct
60 Correct 152 ms 4940 KB Output is correct
61 Incorrect 163 ms 5000 KB Output isn't correct
62 Halted 0 ms 0 KB -