# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
227727 | 2020-04-28T15:16:05 Z | dolphingarlic | Hotel (CEOI11_hot) | C++14 | 870 ms | 51428 KB |
#include <bits/stdc++.h> typedef long long ll; using namespace std; pair<ll, int> orders[500000]; set<pair<int, ll>> rooms; priority_queue<ll> res; int main() { int n, m, o; scanf("%d %d %d", &n, &m, &o); for (int i = 0; i < n; i++) { ll cost; int sz; scanf("%lld %d", &cost, &sz); rooms.insert({sz, cost}); } for (int i = 0; i < m; i++) scanf("%lld %d", &orders[i].first, &orders[i].second); sort(orders, orders + m, greater<pair<ll, int>>()); for (int i = 0; i < m; i++) { auto ptr = rooms.lower_bound({orders[i].second, LLONG_MIN}); if (ptr == rooms.end()) continue; res.push(orders[i].first - (*ptr).second); rooms.erase(ptr); } ll ans = 0; for (int i = 0; i < o; i++) { if (!res.size() || res.top() < 0) break; ans += res.top(); res.pop(); } printf("%lld\n", ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
# | 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 | Correct | 5 ms | 384 KB | Output is correct |
2 | Incorrect | 5 ms | 384 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 15 ms | 1484 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 62 ms | 5620 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 112 ms | 9712 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 410 ms | 26112 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 870 ms | 51428 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 805 ms | 42200 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |