# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
964510 | 2024-04-17T04:35:40 Z | starchan | Hotel (CEOI11_hot) | C++17 | 906 ms | 63220 KB |
#include<bits/stdc++.h> using namespace std; #define int long long #define in array<int, 2> #define f first #define s second #define pb push_back #define pob pop_back #define INF (int)1e17 #define MX (int)3e5+5 #define fast() ios_base::sync_with_stdio(false); cin.tie(NULL) signed main() { fast(); int n, m, k; cin >> n >> m >> k; vector<int> c(n+1); vector<int> p(n+1); set<int> work; for(int i = 1; i <= n; i++) { cin >> c[i] >> p[i]; work.insert(i); } sort(c.begin()+1, c.end()); sort(p.begin()+1, p.end()); vector<in> d(m); for(int i = 0; i < m; i++) cin >> d[i][0] >> d[i][1]; vector<int> cost; sort(d.rbegin(), d.rend()); for(auto [v, sz]: d) { int t = lower_bound(p.begin(), p.end(), sz) - p.begin(); auto it = work.lower_bound(t); if(it == work.end()) continue; cost.pb(v - c[*it]); work.erase(it); } int ans = 0; sort(cost.rbegin(), cost.rend()); for(int i = 0; i < k && i < cost.size(); i++) { if(cost[i] > 0) ans+=cost[i]; } cout << ans << "\n"; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 1372 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 39 ms | 5708 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 73 ms | 9760 KB | Output is correct |
2 | Correct | 55 ms | 7688 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 228 ms | 25952 KB | Output is correct |
2 | Correct | 114 ms | 13928 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 470 ms | 51608 KB | Output is correct |
2 | Correct | 658 ms | 53480 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 465 ms | 61756 KB | Output is correct |
2 | Correct | 619 ms | 63220 KB | Output is correct |
3 | Correct | 906 ms | 61960 KB | Output is correct |