154752025-02-19 20:07:11antiDarabolás (50 pont)cpp17Wrong answer 5/5092ms1936 KiB
#include <iostream>
#include <algorithm>

using namespace std;

struct vagas{
    bool viz;
    int ar;
};

bool comp(vagas a, vagas b){
    if(a.ar != b.ar){
        return a.ar > b.ar;
    }else{
        return a.viz;
    }
}

int main()
{
    int n, m;
    cin >> m >> n;
    vagas T[(n + m - 2)];
    for(int i=0; i<m-1; i++){
        cin >> T[i].ar;
        T[i].viz = true;
    }
    for(int i=m-1; i<n+m-2; i++){
        cin >> T[i].ar;
        T[i].viz = false;
    }
    sort(T, T+n+m-2, comp);
    int V=1, F=1, ossz=0;
    for(int i=0; i<n+m-2; i++){
        if(T[i].viz){
            ossz += T[i].ar * V;
            F++;
        }
        else{
            ossz += T[i].ar * F;
            V++;
        }
    }
    cout << ossz;
}
SubtaskSumTestVerdictTimeMemory
base5/50
1Accepted0/01ms316 KiB
2Wrong answer0/054ms1192 KiB
3Wrong answer0/11ms508 KiB
4Wrong answer0/13ms508 KiB
5Wrong answer0/12ms316 KiB
6Wrong answer0/12ms508 KiB
7Accepted1/11ms316 KiB
8Wrong answer0/11ms316 KiB
9Wrong answer0/13ms316 KiB
10Wrong answer0/11ms316 KiB
11Wrong answer0/13ms404 KiB
12Wrong answer0/11ms316 KiB
13Accepted1/11ms316 KiB
14Accepted1/11ms316 KiB
15Accepted1/12ms316 KiB
16Accepted1/12ms316 KiB
17Wrong answer0/12ms316 KiB
18Wrong answer0/12ms508 KiB
19Wrong answer0/22ms316 KiB
20Wrong answer0/22ms508 KiB
21Wrong answer0/34ms316 KiB
22Wrong answer0/38ms552 KiB
23Wrong answer0/424ms588 KiB
24Wrong answer0/425ms812 KiB
25Wrong answer0/446ms1252 KiB
26Wrong answer0/452ms1128 KiB
27Wrong answer0/490ms1936 KiB
28Wrong answer0/492ms1844 KiB