답안 #1018844

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1018844 2024-07-10T10:09:21 Z vjudge1 Self Study (JOI22_ho_t2) C++17
25 / 100
311 ms 9996 KB
#include <bits/stdc++.h>
#define int long long
#define Aiko ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define pb push_back
using namespace std;
const int  INF=1e18;
bool fun(int n, vector<int>a,int t,vector<int>b){
	int ans=0;
	for(int i=0;i<a.size();i++){
		if(a[i]<b[i]){
			ans+=((n+b[i]-1)/b[i]);
		}else{
			if(a[i]*t>=n){
				ans+=(n+a[i]-1)/a[i];
			}else{
				ans+=(n-a[i]*t+b[i]-1)/b[i];
				ans+=t;
			}
		}
		if(ans>t*a.size())return false;
	}
	if(ans<=t*a.size())return true;
	else return false;
}
signed main(){
	int n, k, i, j, m, mn=INF, t;cin>>n>>k;
	vector<int>a(n),b(n);
	for(i=0;i<n;i++){
		cin>>a[i];
		mn=min(mn,a[i]);
	}
	for(i=0;i<n;i++){
		cin>>b[i];
		mn=min(mn,b[i]);
	}
	int l=1, r=mn*n*k;
	while(r>l+1){
		int m=(l+r)>>1;
		if(fun(m,a,k,b))l=m;
		else r=m;
	}
	if(fun(r,a,k,b))cout<<r;
	else cout<<l;
}		

Compilation message

Main.cpp: In function 'bool fun(long long int, std::vector<long long int>, long long int, std::vector<long long int>)':
Main.cpp:9:15: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |  for(int i=0;i<a.size();i++){
      |              ~^~~~~~~~~
Main.cpp:20:9: warning: comparison of integer expressions of different signedness: 'long long int' and 'long long unsigned int' [-Wsign-compare]
   20 |   if(ans>t*a.size())return false;
      |      ~~~^~~~~~~~~~~
Main.cpp:22:8: warning: comparison of integer expressions of different signedness: 'long long int' and 'long long unsigned int' [-Wsign-compare]
   22 |  if(ans<=t*a.size())return true;
      |     ~~~^~~~~~~~~~~~
Main.cpp: In function 'int main()':
Main.cpp:26:15: warning: unused variable 'j' [-Wunused-variable]
   26 |  int n, k, i, j, m, mn=INF, t;cin>>n>>k;
      |               ^
Main.cpp:26:18: warning: unused variable 'm' [-Wunused-variable]
   26 |  int n, k, i, j, m, mn=INF, t;cin>>n>>k;
      |                  ^
Main.cpp:26:29: warning: unused variable 't' [-Wunused-variable]
   26 |  int n, k, i, j, m, mn=INF, t;cin>>n>>k;
      |                             ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 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 98 ms 5192 KB Output is correct
10 Correct 85 ms 3628 KB Output is correct
11 Correct 52 ms 2844 KB Output is correct
12 Correct 40 ms 2412 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 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 3 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 76 ms 9908 KB Output is correct
22 Correct 251 ms 9920 KB Output is correct
23 Correct 199 ms 9936 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 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 98 ms 5192 KB Output is correct
10 Correct 85 ms 3628 KB Output is correct
11 Correct 52 ms 2844 KB Output is correct
12 Correct 40 ms 2412 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 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 3 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 76 ms 9908 KB Output is correct
22 Correct 251 ms 9920 KB Output is correct
23 Correct 199 ms 9936 KB Output is correct
24 Correct 37 ms 1860 KB Output is correct
25 Correct 106 ms 4700 KB Output is correct
26 Correct 22 ms 1556 KB Output is correct
27 Correct 185 ms 9860 KB Output is correct
28 Correct 197 ms 9952 KB Output is correct
29 Correct 195 ms 9996 KB Output is correct
30 Correct 253 ms 9960 KB Output is correct
31 Correct 262 ms 9932 KB Output is correct
32 Correct 148 ms 9936 KB Output is correct
33 Incorrect 311 ms 9976 KB Output isn't correct
34 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -