답안 #1092201

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1092201 2024-09-23T14:21:17 Z Luvidi A Plus B (IOI23_aplusb) C++17
컴파일 오류
0 ms 0 KB
std::vector<int> smallest_sums(int n, std::vector<int> a, std::vector<int> b) {
	long long l=0,r=2e9;
	while(l<r){
		long long m=(l+r)/2,cnt=0,idx=n-1;
		for(int i=0;i<n;i++){
			while(idx>=0&&a[i]+b[idx]>m)idx--;
			cnt+=idx+1;
		}
		if(cnt>=n)r=m;
		else l=m+1;
	}
	vector<int> ans;
	for(int i=0;i<n;i++){
		for(int j=0;j<n&&a[i]+b[j]<l;j++){
			ans.push_back(a[i]+b[j]);
		}
	}
	sort(ans.begin(),ans.end());
	while(ans.size()<n)ans.push_back(l);
	return ans;
}

Compilation message

aplusb.cpp:1:6: error: 'vector' in namespace 'std' does not name a template type
    1 | std::vector<int> smallest_sums(int n, std::vector<int> a, std::vector<int> b) {
      |      ^~~~~~
aplusb.cpp:1:1: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
  +++ |+#include <vector>
    1 | std::vector<int> smallest_sums(int n, std::vector<int> a, std::vector<int> b) {