Submission #555623

#TimeUsernameProblemLanguageResultExecution timeMemory
555623Jarif_RahmanFortune Telling 2 (JOI14_fortune_telling2)C++17
4 / 100
3067 ms1876 KiB
#include <bits/stdc++.h>
#define pb push_back
#define f first
#define sc second
using namespace std;
typedef long long int ll;
typedef string str;
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int n, k; cin >> n >> k;

    vector<ll> A(n), B(n);
    vector<ll> T(k);

    for(int i = 0; i < n; i++) cin >> A[i] >> B[i];
    for(int i = 0; i < k; i++) cin >> T[i];

    ll ans = 0;

    for(int i = 0; i < n; i++){
        for(int j = 0; j < k; j++){
            if(T[j] >= A[i]) swap(A[i], B[i]);
        }
        ans+=A[i];
    }

    cout << ans << "\n";
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...