답안 #1077714

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1077714 2024-08-27T08:40:59 Z Acanikolic Self Study (JOI22_ho_t2) C++14
0 / 100
132 ms 7516 KB
#include <bits/stdc++.h>  

#define int long long 

#define pb push_back
 
#define F first
 
#define S second
 
using namespace std;
 
const int N = 1e5 + 10;
 
const int mod = 1e9 + 7;
 
const int inf = 1e9;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 	
 	int n,m;
 	cin >> n >> m;
 	vector<int>a(n + 1),b(n + 1),c(n + 1);
 	for(int i = 1; i <= n; i++) cin >> a[i];
 	for(int i = 1; i <= n; i++) cin >> b[i];
 	for(int i = 1; i <= n; i++) c[i] = max(a[i],b[i]);
 	int l = 1,r = 1e16,ans = 0;
 	while(l <= r) {
 		int mid = (l + r) / 2,rest = 0;
 		for(int i = 1; i <= n; i++) {
 			if(b[i] >= a[i]) {
 				int need = (mid + b[i] - 1) / b[i];
 				rest += m - need;
 				continue;
 			}
 			int c = min(m,(mid + a[i] - 1) / a[i]);
 			int k = mid - a[i] * c;
 			if(k >= 1) {
 				rest -= (k + b[i] - 1) / b[i];
 			}else {
 				rest += m - c;
 			}
 		}
		if(rest >= 0) {
			ans = mid;
			l = mid + 1;
		}else {
			r = mid - 1;
		}
 	}
 	cout << ans;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 2 ms 348 KB Output is correct
11 Correct 132 ms 7260 KB Output is correct
12 Correct 120 ms 7516 KB Output is correct
13 Correct 71 ms 7260 KB Output is correct
14 Incorrect 115 ms 7260 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 45 ms 3932 KB Output is correct
10 Correct 30 ms 2652 KB Output is correct
11 Correct 19 ms 2140 KB Output is correct
12 Correct 16 ms 1888 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Incorrect 1 ms 348 KB Output isn't correct
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 2 ms 348 KB Output is correct
11 Correct 132 ms 7260 KB Output is correct
12 Correct 120 ms 7516 KB Output is correct
13 Correct 71 ms 7260 KB Output is correct
14 Incorrect 115 ms 7260 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 45 ms 3932 KB Output is correct
10 Correct 30 ms 2652 KB Output is correct
11 Correct 19 ms 2140 KB Output is correct
12 Correct 16 ms 1888 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Incorrect 1 ms 348 KB Output isn't correct
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 2 ms 348 KB Output is correct
11 Correct 132 ms 7260 KB Output is correct
12 Correct 120 ms 7516 KB Output is correct
13 Correct 71 ms 7260 KB Output is correct
14 Incorrect 115 ms 7260 KB Output isn't correct
15 Halted 0 ms 0 KB -