Submission #937989

# Submission time Handle Problem Language Result Execution time Memory
937989 2024-03-04T17:27:01 Z Litusiano Self Study (JOI22_ho_t2) C++14
0 / 100
429 ms 8436 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){
	int tot = 0;
	for(auto x : v){
		int mx = max(x.first,x.second);
		int need = (mid+mx-1)/mx;
		if(need > m){
			tot+=m;
			tot+= (mid-mx*m + x.second-1)/x.second;
		}
		else tot+= need;
	}
	return tot <= n*m;
}
 
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 low = 0; int high = 1e18+5;
	while(high > low+1){
		int middle = (low+high)/2;
		if(check(middle)) low = middle;
		else high = middle;
	}
	cout<<low<<endl;
}	

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:27:2: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   27 |  for(auto& x : v) cin>>x.first; for(auto& x : v) cin>>x.second;
      |  ^~~
Main.cpp:27:33: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   27 |  for(auto& x : v) cin>>x.first; for(auto& x : v) cin>>x.second;
      |                                 ^~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 456 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 4 ms 604 KB Output is correct
11 Correct 201 ms 8244 KB Output is correct
12 Correct 224 ms 8436 KB Output is correct
13 Correct 211 ms 7252 KB Output is correct
14 Incorrect 429 ms 7192 KB Output isn't correct
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 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 1 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 104 ms 2652 KB Output is correct
10 Correct 69 ms 1884 KB Output is correct
11 Correct 51 ms 1624 KB Output is correct
12 Correct 42 ms 1372 KB Output is correct
13 Correct 1 ms 344 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 348 KB Output is correct
18 Incorrect 8 ms 348 KB Output isn't correct
19 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 456 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 4 ms 604 KB Output is correct
11 Correct 201 ms 8244 KB Output is correct
12 Correct 224 ms 8436 KB Output is correct
13 Correct 211 ms 7252 KB Output is correct
14 Incorrect 429 ms 7192 KB Output isn't correct
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 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 1 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 104 ms 2652 KB Output is correct
10 Correct 69 ms 1884 KB Output is correct
11 Correct 51 ms 1624 KB Output is correct
12 Correct 42 ms 1372 KB Output is correct
13 Correct 1 ms 344 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 348 KB Output is correct
18 Incorrect 8 ms 348 KB Output isn't correct
19 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 456 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 4 ms 604 KB Output is correct
11 Correct 201 ms 8244 KB Output is correct
12 Correct 224 ms 8436 KB Output is correct
13 Correct 211 ms 7252 KB Output is correct
14 Incorrect 429 ms 7192 KB Output isn't correct
15 Halted 0 ms 0 KB -