This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//In His Name
#include <bits/stdc++.h>
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2")
using namespace std;
#define ll long long
//#define int ll
typedef pair<int, int> pii;
#define F first
#define S second
#define pb push_back
#define bug(x) cout << "Ah shit , here we go again : " << x <<endl
#define all(x) x.begin() , x.end()
const int maxn = 40000 , MOD = 1e9 + 7;
const ll INF = 1e18 + 100;
int n , k;
pii c[maxn];
int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(0) , cout.tie(0);
cin >> n >> k;
for(int i = 0 ; i < n ; i++) cin >> c[i].F >> c[i].S;
while(k--){
int t;
cin >> t;
for(int i = 0 ; i < n ; i++) (t >= c[i].F ? swap(c[i].F , c[i].S) : swap(c[i].F , c[i].F));
}
unsigned ll ans = 0;
for(int i = 0 ; i < n ; i++) ans += c[i].F;
cout << ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |