This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
int n, k; cin >> n >> k;
int a[n], b[n];
for (int i = 0; i < n; i++) cin >> a[i] >> b[i];
int t[k];
for (int i = 0; i < k; i++) cin >> t[i];
for (int i = 0; i < n; i++)
for (int j = 0; j < k; j++)
if (a[i] <= t[j]) swap(a[i], b[i]);
cout << accumulate(a, a + n, 0LL) << '\n';
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |