Submission #1063141

#TimeUsernameProblemLanguageResultExecution timeMemory
1063141vjudge1Fortune Telling 2 (JOI14_fortune_telling2)C++17
4 / 100
3027 ms2780 KiB
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> ii;
typedef vector<ll> vll;
typedef pair<long long, long long> pll;
typedef pair<char, ll> ci;
typedef pair<string, ll> si;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
#define pb push_back
#define fi first
#define se second
#define whole(v) v.begin(), v.end()
#define rwhole(v) v.rbegin(), v.rend()
#define inf INT_MAX/2
#define fro front

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll n, k; cin >> n >> k;
    vector<ii> x(n);
    for(ll i = 0; i < n; ++i){
        cin >> x[i].fi >> x[i].se;
    }
    vector<ll> que;
    for(ll i = 0; i < k; ++i){
        ll a; cin >> a;
        que.pb(a);
    }
    for(auto e:que){
        for(ll i = 0; i < n; ++i){
            if(x[i].fi <= e){
                swap(x[i].fi, x[i].se);
            }
        }
    }
    ll cnt = 0;
    for(auto e:x){
        cnt += e.fi;
    }
    cout << cnt << endl;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...