답안 #937892

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
937892 2024-03-04T16:10:13 Z Litusiano Self Study (JOI22_ho_t2) C++14
0 / 100
210 ms 7472 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
 
vector<pair<int,int>> v;
int n,m;
bool check(int mid){
	vector<int> need(n,0);
	int left = 0;
	for(int i = 0; i<n; i++){
		int z = max(v[i].first, v[i].second);
		int k = (mid+z-1)/z;
		need[i] = max(0ll,mid-(m * z));
		left+=max(0ll,m-k);
	}
	for(int i = 0; i<n; i++){
		if(need[i] <= 0) continue;
      	int z = max(v[i].first, v[i].second);
		left -= max(0ll,(need[i] +z - 1)/z);	
	}
	return left>=0;
}
 
signed main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin>>n>>m;
	v.resize(n);
	for(auto& x : v) cin>>x.first; //a
	for(auto& x : v) cin>>x.second; //b
	int l = 1; int r = LLONG_MAX;
	while(r > l+1){
		int mid = (l+r)/2;
		if(check(mid)) l = mid;
		else r = mid;
	}
	cout<<l<<endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 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 0 ms 348 KB Output is correct
10 Correct 3 ms 344 KB Output is correct
11 Correct 201 ms 7464 KB Output is correct
12 Correct 202 ms 7468 KB Output is correct
13 Correct 210 ms 7468 KB Output is correct
14 Correct 206 ms 7472 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Incorrect 54 ms 7472 KB Output isn't correct
17 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 54 ms 7472 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 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 0 ms 348 KB Output is correct
10 Correct 3 ms 344 KB Output is correct
11 Correct 201 ms 7464 KB Output is correct
12 Correct 202 ms 7468 KB Output is correct
13 Correct 210 ms 7468 KB Output is correct
14 Correct 206 ms 7472 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Incorrect 54 ms 7472 KB Output isn't correct
17 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 54 ms 7472 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 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 0 ms 348 KB Output is correct
10 Correct 3 ms 344 KB Output is correct
11 Correct 201 ms 7464 KB Output is correct
12 Correct 202 ms 7468 KB Output is correct
13 Correct 210 ms 7468 KB Output is correct
14 Correct 206 ms 7472 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Incorrect 54 ms 7472 KB Output isn't correct
17 Halted 0 ms 0 KB -