萌新刚学OI,求助
查看原帖
萌新刚学OI,求助
302356
PLDIS楼主2021/6/13 19:06
#include <bits/stdc++.h>
using namespace std;
struct record{
    int C, P, T;
}strec[100001];
int studentData[1001][1001];
map<int, int> finds, findsp;
int t1, t2, t3, t4, n, m, p[1001], c[1001];
int A, H, tests, luogu = 0, def = 0;
bool E = false;
bool cmp(record a, record b){
    if(a.P != b.P){
        return a.P < b.P;
    }
    else{
        return a.C < b.C;
    }
}
bool doexcel(int pr, int n, int sc){
    int x = findsp[pr], y = finds[n];
    if(studentData[x][y] >= sc){
        return false;
    }
    studentData[x][y] = sc;
    return true;
}
int main(){
    cin >> n >> m;
    for(int i = 0;i < n;i++){
        cin >> p[i];
        findsp[p[i]] = i;
    }
    for(int i = 0;i < m;i++){
        cin >> c[i];
        finds[c[i]] = i;
    }
    cin >> t1 >> t2 >> t3 >> t4 >> A >> H >> E;
    cin >> tests;
    def = t1 * n, luogu = t1 * n;
    for(int i = 0;i < tests;i++){
        cin >> strec[i].C >> strec[i].P >> strec[i].T;
    }
    sort(strec, strec + tests, cmp);
    pair<int, int> l = make_pair(strec[0].C, strec[0].P);
    int t = 0;
    for(int i = 0;i < tests;i++){
        int o = 1;
        while(l.second == strec[i].P){
            if(l != make_pair(strec[i].C, strec[i].P)) o++;
            i++, t++;
        }
        l = make_pair(strec[i].C, strec[i].P);
        def += min(t2 * t, t1 * o + (t3 * t));
        if(E){
            for(int j = i - t;j < i;j++)
                if(doexcel(strec[j].C, strec[j].P, strec[j].T)){
                    def += t4;
                }
        }
        luogu += t3 * t;
        t = 1;
    }
    luogu = int(double(luogu) * 100 / double(A));
    luogu += H;
    cout << def << endl << luogu << endl;
    if(def > luogu){
        cout << "Use Luogu!";
    }
    else{
        cout << "Forget it...";
    }
    return 0;
}

RT,00 分求助

2021/6/13 19:06
加载中...