You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
1.4 KiB

2 years ago
// https://www.jisuanke.com/problem/T3697
#include <bits/stdc++.h>
using namespace std;
const int N = 1010;
int a[N], b[N], c[N];
/*
5 5 0 1
1 2 3 4 5
1 2 3 4 5
n=5
m=5 5
k=0
p=1
a[i]
b[i]
5
*/
struct Node {
int id;
int value;
const bool operator<(const Node &b) const {
return value > b.value;
}
} d[N];
int dl;
int main() {
// 必须符合计蒜客的输入输出要求,否则不能完成提交!
freopen("song.in", "r", stdin);
freopen("song.out", "w", stdout);
// n首歌m:喜欢歌的长度a[i]<m,k不喜欢歌的数量,p:满意值第p大
int n, m, k, p;
cin >> n >> m >> k >> p;
for (int i = 1; i <= n; i++) cin >> a[i]; // 歌的长度
for (int i = 1; i <= n; i++) cin >> b[i]; // 满意值
// 超过长度m限制不喜欢
for (int i = 1; i <= n; i++)
if (a[i] > m) c[i] = 1;
// 特殊指定的不喜欢
for (int i = 1; i <= k; i++) {
int x;
cin >> x;
c[x] = 1; // 不喜欢,当桶用
}
for (int i = 1; i <= n; i++)
if (!c[i]) d[dl++] = {i, b[i]};
sort(d, d + dl);
if (d[p - 1].value)
printf("%d\n", d[p - 1].id);
else
puts("aaaaaaaaa");
return 0;
}