Submission #211799

# Submission time Handle Problem Language Result Execution time Memory
211799 2020-03-21T10:13:15 Z MarcVana Hotel (CEOI11_hot) C++14
0 / 100
1710 ms 49836 KB
#include <iostream>
#include <algorithm>
#include <set>

#define NMAX 500005

using namespace std;

struct room
{
    int cost, capacity;
} ROOMS[NMAX], A;

multiset <room> MS;
multiset <room> :: iterator it;

struct offer
{
    int price, dimension;
} OFFERS[NMAX];

long long ANSWER;

int N, M, NO, DIF[NMAX];

bool operator < (const room& X, const room& Y)
{
    if (X.capacity!=Y.capacity)
        return X.capacity<Y.capacity;
    return X.cost<Y.cost;
}

bool cmpOF(offer A, offer B)
{
    if (A.price > B.price)
        return true;
    return false;
}

int main()
{
    cin >> N >> M >> NO;
    for (int i = 1; i <= N; ++i)
    {
        cin >> ROOMS[i].cost >> ROOMS[i].capacity;
        MS.insert(ROOMS[i]);
    }
    for (int i = 1; i <= M; ++i)
        cin >> OFFERS[i].price >> OFFERS[i].dimension;
    sort(OFFERS + 1, OFFERS + M + 1, cmpOF);
    for (int i = 1; i <= M; ++i)
    {
        A.cost = 0, A.capacity = OFFERS[i].dimension;
        it = MS.upper_bound(A);
        if (it == MS.end())
            continue;
        A = (*it);
        DIF[i] = OFFERS[i].price - A.cost;
    }
    sort(DIF + 1, DIF + M + 1);
    for (int i = M; i > M - NO; --i)
        if (DIF[i] > 0)
            ANSWER += DIF[i];
    cout << ANSWER;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 28 ms 1280 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 126 ms 4576 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 224 ms 7676 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 715 ms 21368 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1497 ms 42572 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1710 ms 49836 KB Output isn't correct
2 Halted 0 ms 0 KB -