Submission #739231

#TimeUsernameProblemLanguageResultExecution timeMemory
739231UnforgettableplHotel (CEOI11_hot)C++17
10 / 100
558 ms53256 KiB
/* 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); ll ans = 0; 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)); 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;} if(room->second<i.first){ // Rate is gud ans+=i.first-room->second; roomss.erase(room); } } cout << ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...