Submission #710579

#TimeUsernameProblemLanguageResultExecution timeMemory
710579WonderfulWhaleHotel (CEOI11_hot)C++17
10 / 100
4022 ms18288 KiB
#include<bits/stdc++.h> using namespace std; #define int int64_t #define pb push_back #define pii pair<int, int> #define st first #define nd second #define all(x) (x).begin(), (x).end() #define sz(x) (int)(x).size() pii tab[500009]; bool vis[500009]; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n, m, o; cin >> n >> m >> o; for(int i=0;i<n;i++) { cin >> tab[i].st >> tab[i].nd; } sort(tab, tab+n); vector<pii> v(m); for(int i=0;i<m;i++) { cin >> v[i].st >> v[i].nd; } sort(all(v)); vector<int> ans; for(pii x:v) { for(int i=0;i<n;i++) { if(!vis[i]&&tab[i].nd>=x.nd&&tab[i].st<x.st) { ans.pb(-(x.st-tab[i].st)); vis[i] = true; break; } } } int res = 0; sort(all(ans)); for(int i=0;i<min(sz(ans), o);i++) { res -= ans[i]; } cout << res << "\n"; }
#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...