이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |