Submission #410851

#TimeUsernameProblemLanguageResultExecution timeMemory
410851iliccmarkoFortune Telling 2 (JOI14_fortune_telling2)C++14
4 / 100
3035 ms1416 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define endl "\n" #define INF 1000000000 #define LINF 10000000000000000LL #define pb push_back #define all(x) x.begin(), x.end() #define len(s) (int)s.size() #define test_case { int t; cin>>t; while(t--)solve(); } #define single_case solve(); #define line cerr<<"----------"<<endl; #define ios { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cerr.tie(NULL); } #define mod 1000000007LL const int N = 2e5 + 50; int a[N], b[N], n; int main() { ios cin>>n; int k; cin>>k; for(int i = 0;i<n;i++) cin>>a[i]>>b[i]; while(k--) { int x; cin>>x; for(int i = 0;i<n;i++) if(a[i]<=x) swap(a[i], b[i]); } ll ans = 0; for(int i = 0;i<n;++i) ans += (ll)a[i]; cout<<ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...