답안 #937862

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
937862 2024-03-04T15:40:34 Z Litusiano Self Study (JOI22_ho_t2) C++17
0 / 100
429 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);
	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;
		if(k > m) need[i] = mid-(m * z);
		else left+=m-k;
	}
	for(int i = 0; i<n; i++){
		left -= (need[i] + v[i].second - 1)/v[i].second;	
	}
	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; for(auto& x : v) cin>>x.second;
	int l = 0; int r = 1e18;
	while(r > l+1){
		int mid = (l+r)/2;
		if(check(mid)) l = mid;
		else r = mid;
	}
	cout<<l<<endl;
}	

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:28:2: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   28 |  for(auto& x : v) cin>>x.first; for(auto& x : v) cin>>x.second;
      |  ^~~
Main.cpp:28:33: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   28 |  for(auto& x : v) cin>>x.first; for(auto& x : v) cin>>x.second;
      |                                 ^~~
# 결과 실행 시간 메모리 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 0 ms 348 KB Output is correct
10 Correct 4 ms 348 KB Output is correct
11 Correct 245 ms 7460 KB Output is correct
12 Correct 253 ms 7452 KB Output is correct
13 Correct 231 ms 7464 KB Output is correct
14 Incorrect 429 ms 7472 KB Output isn't correct
15 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 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 126 ms 3924 KB Output is correct
10 Correct 84 ms 2652 KB Output is correct
11 Correct 62 ms 2144 KB Output is correct
12 Correct 50 ms 1668 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Incorrect 8 ms 560 KB Output isn't correct
19 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 0 ms 348 KB Output is correct
10 Correct 4 ms 348 KB Output is correct
11 Correct 245 ms 7460 KB Output is correct
12 Correct 253 ms 7452 KB Output is correct
13 Correct 231 ms 7464 KB Output is correct
14 Incorrect 429 ms 7472 KB Output isn't correct
15 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 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 126 ms 3924 KB Output is correct
10 Correct 84 ms 2652 KB Output is correct
11 Correct 62 ms 2144 KB Output is correct
12 Correct 50 ms 1668 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Incorrect 8 ms 560 KB Output isn't correct
19 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 0 ms 348 KB Output is correct
10 Correct 4 ms 348 KB Output is correct
11 Correct 245 ms 7460 KB Output is correct
12 Correct 253 ms 7452 KB Output is correct
13 Correct 231 ms 7464 KB Output is correct
14 Incorrect 429 ms 7472 KB Output isn't correct
15 Halted 0 ms 0 KB -