General
 
 
# Author Problem Lang Verdict Time Memory Sent Judged  
187259810 Contestant:
zzn_nzz
1770A - 37 C++14 (GCC 6-32) Accepted 405 ms 12 KB 2022-12-30 17:42:57 2022-12-30 20:18:52
→ Source
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cstring>
#include <vector>
#include <cmath>
#include <queue>

using namespace std;
#define rep(i, a, b) for(int i = a; i <= b; ++ i)

long long T, n, m, a[105], b[105];

int main() {
	cin >> T;
	while(T --) {
		cin >> n >> m;
		rep(i, 1, n) cin >> a[i];
		rep(i, 1, m) cin >> b[i];
		rep(j, 1, m) {
			long long mx = -1e11; int flg = 0;
			rep(i, 1, n) if(b[j] - a[i] > mx) mx = b[j] - a[i], flg = i;
			a[flg] = b[j];
		}
		long long ans = 0;
		rep(i, 1, n) ans += a[i];
		cout << ans << endl;
	}
	return 0;
}
?
Time: ? ms, memory: ? KB
Verdict: ?
Input
?
Participant's output
?
Jury's answer
?
Checker comment
?
Diagnostics
?
Click to see test details