Submission #512840

# Submission time Handle Problem Language Result Execution time Memory
512840 2022-01-16T18:50:46 Z blue Hotel (CEOI11_hot) C++17
0 / 100
284 ms 17868 KB
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
using namespace std;

using ll = long long;
#define sz(x) int(x.size())

struct obj
{
    int s;
    int v;
    int t;
};

bool operator < (obj A, obj B)
{
    if(A.s != B.s) return A.s > B.s;
    else return A.t > B.t;
}



int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n, m, o;
    cin >> n >> m >> o;

    vector<obj> a(m+2*n);
    for(int i = 0; i < n; i++)
    {
        cin >> a[i].v >> a[i].s;
        a[i].t = 2; //room
    }

    for(int i = n; i < 2*n; i++)
    {
        a[i] = a[i-n];
        a[i].t = 1;
    }

    for(int j = 2*n; j < 2*n+m; j++)
    {
        cin >> a[j].v >> a[j].s;
        a[j].t = 0; //customer
    }

    sort(a.begin(), a.end());

    ll rooms_total = 0;
    // int room_count = 0;
    int spare = 0;

    // priority_queue<int> actual, fake;
    priority_queue<int> actual, fake;
    // priority_queue<int> fake;
    //
    for(obj x: a)
    {
    //     if(x.t == 2)
    //     {
    //         spare++;
    //         rooms_total += x.v;
    //
    //         // cerr << "adding empty room of size " << x.s << '\n';
    //     }
    //     else if(x.t == 1)
    //     {
    //         if(spare)
    //         {
    //             fake.push(-x.v);
    //             spare--;
    //             // cerr << "inserting fake room of cost " << x.v << '\n';
    //         }
    //         else
    //         {
    //             fake.push(-x.v);
    //
    //             if(actual.empty() || actual.top() < fake.top())
    //                 fake.pop();
    //             else
    //                 actual.pop();
    //         }
    //     }
    //     else
    //     {
    //         if(spare)
    //         {
    //             if(sz(actual) < o)
    //                 actual.push(-x.v);
    //             else
    //             {
    //                 actual.push(-x.v);
    //                 actual.pop();
    //             }
    //             spare--;
    //         }
    //         else
    //         {
    //             if(sz(actual) == o)
    //             {
    //                 actual.push(-x.v);
    //                 actual.pop();
    //             }
    //             else
    //             {
    //                 actual.push(-x.v);
    //                 if(actual.empty() || actual.top() < fake.top())
    //                     fake.pop();
    //                 else
    //                     actual.pop();
    //             }
    //         }
    //     }
    }
    //
    // ll ans = -rooms_total;
    // while(!actual.empty())
    // {
    //     ans -= actual.top();
    //     actual.pop();
    // }
    // while(!fake.empty())
    // {
    //     ans -= fake.top();
    //     fake.pop();
    // }
    //
    // cout << ans << '\n';
}

Compilation message

hot.cpp: In function 'int main()':
hot.cpp:63:13: warning: variable 'x' set but not used [-Wunused-but-set-variable]
   63 |     for(obj x: a)
      |             ^
hot.cpp:55:8: warning: unused variable 'rooms_total' [-Wunused-variable]
   55 |     ll rooms_total = 0;
      |        ^~~~~~~~~~~
hot.cpp:57:9: warning: unused variable 'spare' [-Wunused-variable]
   57 |     int spare = 0;
      |         ^~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 588 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 33 ms 1612 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 46 ms 2764 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 128 ms 7244 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 267 ms 14284 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 284 ms 17868 KB Output isn't correct
2 Halted 0 ms 0 KB -