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;
#define ar array
signed main(){
ios::sync_with_stdio(0); cin.tie(0);
int n, k; cin>>n>>k;
vector<ar<int, 2>> a(n);
for(int i=0;i<n;i++) cin>>a[i][0]>>a[i][1];
vector<int> t(n);
for(int i=0;i<k;i++){
int x; cin>>x;
for(int j=0;j<n;j++){
if(a[j][t[j]] <= x) t[j] ^= 1;
}
}
long long res = 0;
for(int i=0;i<n;i++) res += a[i][t[i]];
cout<<res<<"\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... |