답안 #849140

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
849140 2023-09-14T06:56:24 Z emad234 A Plus B (IOI23_aplusb) C++17
10 / 100
1 ms 500 KB
#include <bits/stdc++.h>
#define all(v) ((v).begin(),(v).end())
#define ll long long
#define F first
#define S second
const ll mod = 1e9 + 7;
const ll mxN = 1e5 + 2;
using namespace std;
struct number{
	int val,iA,iB;
};
bool operator<(number a,number b){
	return a.val < b.val;
}

vector<int> smallest_sums(int N, vector<int> A, vector<int> B) {
	vector<int>ans;
	set<number>s;
	for(int i = 0;i < N;i++){
		s.insert({A[0] + B[i],0,i});
	}
	for(int i =0;i < N;i++){
		ans.push_back((*(s.begin())).val);
		int iA = (*(s.begin())).iA;
		int iB = (*(s.begin())).iB;
		s.erase(s.begin());
		s.insert({A[iA + 1] + B[iB],iA + 1,iB});
	}
	return ans;
}
// 
// int main() {
// 	int N;
// 	assert(1 == scanf("%d", &N));
// 	std::vector<int> A(N);
// 	for (int i = 0; i < N; ++i)
// 		assert(1 == scanf("%d", &A[i]));
// 	std::vector<int> B(N);
// 	for (int i = 0; i < N; ++i)
// 		assert(1 == scanf("%d", &B[i]));
// 
// 	fclose(stdin);
// 
// 	std::vector<int> res = smallest_sums(N, A, B);
// 
// 	int n = res.size();
// 	for (int i = 0; i < n; ++i) {
// 		if (i > 0)
// 			printf(" ");
// 		printf("%d", res[i]);
// 	}
// 	printf("\n");
// 	fclose(stdout);
// 
// 	return 0;
// }
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 500 KB Output is correct
6 Incorrect 1 ms 344 KB 1st lines differ - on the 3rd token, expected: '5', found: '6'
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 500 KB Output is correct
6 Incorrect 1 ms 344 KB 1st lines differ - on the 3rd token, expected: '5', found: '6'
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 500 KB Output is correct
6 Incorrect 1 ms 344 KB 1st lines differ - on the 3rd token, expected: '5', found: '6'
7 Halted 0 ms 0 KB -