Submission #739942

# Submission time Handle Problem Language Result Execution time Memory
739942 2023-05-11T17:23:18 Z Unforgettablepl Hotel (CEOI11_hot) C++17
30 / 100
592 ms 42096 KB
/*
ID: samikgo1
TASK:
LANG: C++
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
//#define f first
//#define s second
//#define x first
//#define y second
const int INF = INT32_MAX;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
//    freopen("measurement.in","r",stdin);
//    freopen("measurement.out","w",stdout);
    ll n,m,o;
    cin >> n >> m >> o;
    vector<pll> rooms(n);
    vector<pll> offers(m);
    for(pll&i:rooms)cin>>i.second>>i.first;
    for(pll&i:offers)cin>>i.first>>i.second;
    set<pll> roomss(all(rooms));
    sort(allr(offers));
    vector<ll> ans;
    for (pll &i: offers) {
        // i.first is rate
        // i.second is requirement
        auto room = roomss.lower_bound(make_pair(i.second,(ll)0));
        if(room==roomss.end()){ continue;}
        ll a = i.first-room->second;
        roomss.erase(room);
        if(a>0) {ans.emplace_back(a);};
    }
    sort(allr(ans));
    ll anss = 0;
    for (ll i = 0; i < min(o,(ll)ans.size()); i++) {
        anss += ans[i];
    }
    cout << anss;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 7 ms 1232 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 37 ms 4436 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 81 ms 7596 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 260 ms 21264 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 592 ms 42096 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 504 ms 33716 KB Output isn't correct
2 Halted 0 ms 0 KB -