답안 #839820

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
839820 2023-08-30T17:32:41 Z allin27x A Plus B (IOI23_aplusb) C++17
0 / 100
1000 ms 212 KB
#include <bits/stdc++.h>
using namespace std;
#define vi vector<int>

bool check(int s, vi& a, vi& b){
	int n = a.size();
	int prs = 0;
	int j = n-1;
	for (int i=0; i<n; i++){
		for (; j>=0 && b[j]+a[i]>s; j--) ;
		prs += j+1;
	}
	return prs>=n;
}

vi smallest_sums(int n, vi a, vi b){
	int l = 0, r = 2e9+7;
	while (l<r){
		int m = (l+r)/2;
		if (check(m, a, b)) r = m;
		else l = m+1;
	}
	vi ans(n,0);
	int ind = 0;
	for (int i=0; i<n; i++){
		for (int j=0; j<n && a[i]+b[j]<l; j++) ans[ind++] = a[i] + b[j];
	}
	while (ind < n) ans[ind++] = l;
	sort(ans.begin(), ans.end());
	return ans;
}

# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Execution timed out 1079 ms 212 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Execution timed out 1079 ms 212 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Execution timed out 1079 ms 212 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Execution timed out 1079 ms 212 KB Time limit exceeded
5 Halted 0 ms 0 KB -