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.
|
|
|
|
// 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;
|
|
|
|
|
}
|