Good Bye 2022: 2023 is NEAR 1770A. Koxia and Whiteboards Solution
Problem Link: https://codeforces.com/contest/1770/problem/A
Solution in C++:
- /// La ilaha illellahu muhammadur rasulullah
- ///******Bismillahir-Rahmanir-Rahim******///
- /// Abul Hasnat Tonmoy
- /// Department of CSE,23rd batch
- /// Islamic University,Bangladesh
- ///**********ALLAH IS ALMIGHTY************///
- #include <bits/stdc++.h>
- using namespace std;
- #define ll long long int
- int main() {
- ios_base::sync_with_stdio(0);
- cin.tie(0);
- int t;
- cin >> t;
- while (t--) {
- int n, m;
- cin >> n >> m;
- std::vector<int> v(n + m);
- for (int i = 0; i < n + m; i++) cin >> v[i];
- sort(v.begin(), v.end() - 1);
- reverse(v.begin(), v.end());
- ll s = 0;
- for (int i = 0; i < n; i++) {
- s += v[i];
- }
- cout << s << endl;
- v.clear();
- }
- }
No comments