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>
#define ll long long
#define pb push_back
using namespace std;
ll N, K;
vector<pair<ll, ll>> a;
vector<ll> b;
int main()
{
cin >> N >> K;
for (int i = 0; i < N; i++)
{
ll x, y;
cin >> x >> y;
a.pb({x, y});
}
for (int i = 0; i < K; i++)
{
ll temp;
cin >> temp;
b.pb(temp);
}
for (int i = 0; i < N; i++)
{
for (int j = 0; j < K; j++)
{
if (a[i].first <= b[j])
{
swap(a[i].first, a[i].second);
}
}
}
ll sum = 0;
for (int i = 0; i < N; i++)
{
sum += a[i].first;
}
cout << sum;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |