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;
typedef long long ll;
int main() {
int n,k; cin>>n>>k;
vector<pair<ll,ll>> c(n,pair<ll,ll>());
for (int i=0; i<n; i++) cin>>c[i].first>>c[i].second;
while (k--) {
ll t; cin>>t;
for (int i=0; i<n; i++) {
if (c[i].first<=t) {
swap(c[i].first,c[i].second);
}
}
}
ll ans=0;
for (auto i: c) ans+=i.first;
cout<<ans;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |