답안 #1018713

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1018713 2024-07-10T08:50:03 Z vjudge1 Self Study (JOI22_ho_t2) C++17
0 / 100
1 ms 604 KB
#include <bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
using namespace std;
int f(int n){
	int cnt=0;
	for(int i=1;i*i<=n;i++){
		if(n%i==0){
			cnt++;
			if(n!=i*i){
				cnt++;
			}
		}
	}
	return cnt;
}
int find(int x,vector<int>a){
	int l=0,r=2e9+123;
	while(1<r-l){
		int mid=(r+l)/2;
		int s=0;
		for(int i=0;i<a.size();i++){
			if(mid>a[i]){
				s+=mid-a[i];
			}
		}
		if(s>x){
			r=mid;
		}else{
			l=mid;
		}
	}
	if(r==l){
		return l;
	}else{
		int s=0;
		for(int i=0;i<a.size();i++){
			if(r>a[i]){
				s+=r-a[i];
			}
		}
		if(s>x){
			return l;
		}else{
			return r;
		}
	}
}
//int l = *max_element(v.begin(), v.end()), r = 1e18;
//    while(l < r){
//        int m = ((l + r) >> 1), c = 0, cur = 0;
//        for(int i = 0; i < n; i++){
//            if(cur + v[i] > m){
//                c++; cur = 0;
//            } cur += v[i];
//        } c++;
//        if(c > k) l = m + 1;
//        else r = m;
//    } cout << l;
signed main(){
	ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    int n,m;
    cin>>n>>m;
    vector<int>a(n),b(n);
    for(int i=0;i<n;i++){
    	cin>>a[i];
	}
	for(int i=0;i<n;i++){
		cin>>b[i];
	}
	cout<<a[0]*m;
//	multiset<pair<int,int>>ml;
//	while(m--){
//		for(int i=0;i<n;i++){
//			if(ml.begin.first)
//		}
//	}
    return 0;	
}	

Compilation message

Main.cpp: In function 'int find(int, std::vector<int>)':
Main.cpp:23:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |   for(int i=0;i<a.size();i++){
      |               ~^~~~~~~~~
Main.cpp:38:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |   for(int i=0;i<a.size();i++){
      |               ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 604 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 604 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -