求调
查看原帖
求调
919410
Pollococido楼主2024/7/10 09:34

老是和答案差1

#include <bits/stdc++.h>
using namespace std;
int f1[110], p1[110], f2[110], p2[110];
int n, m, r;
bool used[110];
int main() {
    cin >> n >> m >> r;
    for (int i = 1; i <= n; i++) cin >> f1[i];
    for (int i = 1; i <= n; i++) cin >> p1[i];
    for (int i = 1; i <= n; i++) cin >> f2[i];
    for (int i = 1; i <= n; i++) cin >> p2[i];
    int pos = 0;
    int minn = 0x3f3f3f3f;
    int x;
    for (int i = 1; i <= n; i++) {
        minn = 0x3f3f3f3f;
        cin >> x;
        int pos = 0;//当前 > p2[x]的牌的最小值
        for (int j = 1; j <= n; j++) {
            //cout << "j = " << j << ": " << f1[x] << ' ' << f2[j] << ' ' << p1[x] << ' ' << p2[j] << endl;
            if (f1[x] == f2[j] && p1[x] < p2[j]) {
                if (p2[j] < minn) minn = p2[j], pos = j;
            }
        }
        if (pos != 0) used[pos] = true;
    }
    int res = 0;
    for (int i = 1; i <= n; i++) {
        if (used[i] == false) res++;
    }
    cout << res << endl;
    return 0;
}
2024/7/10 09:34
加载中...