# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1093343 | 2024-09-26T16:23:18 Z | mar | Hotel (CEOI11_hot) | C++14 | 686 ms | 39764 KB |
#include<bits/stdc++.h> using namespace std; typedef long long ll; set<pair<int,int>>room; int main() { int n,m,o; cin>>n>>m>>o; for(int i = 0; i<n; i++) { int c, p; cin>>c>>p; room.insert({p, c}); } vector<pair<int,int>> of(m); for(int i = 0; i < m; i++) { cin>>of[i].first>>of[i].second; } sort(of.begin(), of.end()); reverse(of.begin(), of.end()); vector<int>vals; for(int i=0; i<m; i++) { auto it = room.lower_bound({of[i].second, 0}); if(it == room.end()) { continue; } vals.push_back(of[i].first-it->second); room.erase(it); } sort(vals.rbegin(), vals.rend()); ll ans = 0; for(int i=0; i<vals.size() && i<o; i++) { ans += max(vals[i], 0); } cout<<ans<<endl; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 432 KB | Output is correct |
2 | Incorrect | 0 ms | 348 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 1112 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 59 ms | 4436 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 103 ms | 7420 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 315 ms | 20172 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 686 ms | 39764 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 653 ms | 33380 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |