답안 #1092200

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1092200 2024-09-23T14:19:39 Z Luvidi A Plus B (IOI23_aplusb) C++17
0 / 100
1000 ms 348 KB
#include "aplusb.h"
#include <bits/stdc++.h>
using namespace std;

std::vector<int> smallest_sums(int n, std::vector<int> a, std::vector<int> b) {
	int l=0,r=2e9;
	while(l<r){
		int m=(l+r)/2;
		long long 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: In function 'std::vector<int> smallest_sums(int, std::vector<int>, std::vector<int>)':
aplusb.cpp:24:18: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   24 |  while(ans.size()<n)ans.push_back(l);
      |        ~~~~~~~~~~^~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Execution timed out 1067 ms 344 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Execution timed out 1067 ms 344 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Execution timed out 1067 ms 344 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Execution timed out 1067 ms 344 KB Time limit exceeded
5 Halted 0 ms 0 KB -