답안 #534354

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
534354 2022-03-08T05:59:30 Z PikaQ Self Study (JOI22_ho_t2) C++17
62 / 100
184 ms 5012 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)9e18 + (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 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 1 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 148 ms 4996 KB Output is correct
12 Correct 179 ms 5000 KB Output is correct
13 Correct 174 ms 4940 KB Output is correct
14 Correct 149 ms 4996 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 152 ms 5004 KB Output is correct
17 Correct 184 ms 5004 KB Output is correct
18 Correct 160 ms 4940 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 152 ms 5004 KB Output is correct
3 Correct 184 ms 5004 KB Output is correct
4 Correct 160 ms 4940 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 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 0 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 107 ms 2636 KB Output is correct
14 Correct 55 ms 1800 KB Output is correct
15 Correct 37 ms 1484 KB Output is correct
16 Correct 31 ms 1228 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 3 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 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 1 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 148 ms 4996 KB Output is correct
12 Correct 179 ms 5000 KB Output is correct
13 Correct 174 ms 4940 KB Output is correct
14 Correct 149 ms 4996 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 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 0 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 0 ms 204 KB Output is correct
23 Correct 107 ms 2636 KB Output is correct
24 Correct 55 ms 1800 KB Output is correct
25 Correct 37 ms 1484 KB Output is correct
26 Correct 31 ms 1228 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 3 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 152 ms 5004 KB Output is correct
36 Correct 184 ms 5004 KB Output is correct
37 Correct 160 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 0 ms 204 KB Output is correct
41 Correct 1 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 5 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 29 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 0 ms 204 KB Output is correct
53 Correct 1 ms 204 KB Output is correct
54 Correct 1 ms 204 KB Output is correct
55 Correct 113 ms 2624 KB Output is correct
56 Correct 53 ms 1884 KB Output is correct
57 Correct 52 ms 1868 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 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 1 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 107 ms 2636 KB Output is correct
10 Correct 55 ms 1800 KB Output is correct
11 Correct 37 ms 1484 KB Output is correct
12 Correct 31 ms 1228 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 3 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 152 ms 5004 KB Output is correct
22 Correct 184 ms 5004 KB Output is correct
23 Correct 160 ms 4940 KB Output is correct
24 Correct 20 ms 972 KB Output is correct
25 Correct 66 ms 2408 KB Output is correct
26 Correct 17 ms 716 KB Output is correct
27 Correct 179 ms 4940 KB Output is correct
28 Correct 171 ms 5000 KB Output is correct
29 Correct 159 ms 5012 KB Output is correct
30 Correct 173 ms 4940 KB Output is correct
31 Incorrect 131 ms 4940 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 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 1 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 148 ms 4996 KB Output is correct
12 Correct 179 ms 5000 KB Output is correct
13 Correct 174 ms 4940 KB Output is correct
14 Correct 149 ms 4996 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 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 0 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 0 ms 204 KB Output is correct
23 Correct 107 ms 2636 KB Output is correct
24 Correct 55 ms 1800 KB Output is correct
25 Correct 37 ms 1484 KB Output is correct
26 Correct 31 ms 1228 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 3 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 0 ms 204 KB Output is correct
37 Correct 1 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 5 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 29 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 0 ms 204 KB Output is correct
49 Correct 1 ms 204 KB Output is correct
50 Correct 1 ms 204 KB Output is correct
51 Correct 113 ms 2624 KB Output is correct
52 Correct 53 ms 1884 KB Output is correct
53 Correct 52 ms 1868 KB Output is correct
54 Correct 20 ms 972 KB Output is correct
55 Correct 66 ms 2408 KB Output is correct
56 Correct 17 ms 716 KB Output is correct
57 Correct 179 ms 4940 KB Output is correct
58 Correct 171 ms 5000 KB Output is correct
59 Correct 159 ms 5012 KB Output is correct
60 Correct 173 ms 4940 KB Output is correct
61 Incorrect 131 ms 4940 KB Output isn't correct
62 Halted 0 ms 0 KB -