제출 #938013

#제출 시각아이디문제언어결과실행 시간메모리
938013LitusianoSelf Study (JOI22_ho_t2)C++17
62 / 100
211 ms4956 KiB
#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){
		if(tot > n*m) break;
		int mx = max(x.first,x.second);
		int need = (mid+mx-1)/mx;
		if(need > m){
			tot+=m;
			int k = (mid-mx*m + x.second-1);
			tot+= (k)/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;
}

컴파일 시 표준 에러 (stderr) 메시지

Main.cpp: In function 'int main()':
Main.cpp:29:2: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   29 |  for(auto& x : v) cin>>x.first; for(auto& x : v) cin>>x.second;
      |  ^~~
Main.cpp:29:33: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   29 |  for(auto& x : v) cin>>x.first; for(auto& x : v) cin>>x.second;
      |                                 ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...