Submission #619718

#TimeUsernameProblemLanguageResultExecution timeMemory
619718Ahmadsm2005운세 보기 2 (JOI14_fortune_telling2)C++17
4 / 100
3060 ms2388 KiB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define int long long
using namespace std;
using namespace __gnu_pbds;
typedef tree<
int,
null_type,
less_equal<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
int N,K,A[200000],B[200000],KK[200000];
int RMQ(int L,int R){
    int MX = -1;
    for(int i = L ; i <= R; i += 1)MX = max(MX,KK[i]);
    return MX;
}
int SIM(int x){
    for(int i = 0; i < K; i += 1)if(KK[i] >= A[x])swap(A[x],B[x]);
    return A[x];
}
int32_t main()
{
    cin.tie(0),iostream::sync_with_stdio(0);
    ordered_set X;
    cin>>N>>K;
    for(int i = 0; i < N; i += 1){
        cin>>A[i]>>B[i];
    }
    int CNT = 0;
    for(int i = 0; i < K; i += 1)cin>>KK[i];
    for(int i = 0; i < N; i += 1){
        CNT += SIM(i);
    }
    cout<<CNT;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...