| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 115328 | model_code | Hotel (CEOI11_hot) | C++17 | 1744 ms | 39776 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/* Model solution for task HOT
* Author: Miroslaw Michalski
* Time complexity : O(n log n)
* 24APR11
* pure STL stuff
*/
#include <cstdio>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <iostream>
using namespace std;
int main() {
int n, m, o, ci, pi;
long long res = 0;
vector<int> think;
map<pair<int, int>, int > v;
scanf("%d%d%d", &n, &m, &o);
for(int i = 0; i < n; i++) {
scanf("%d%d", &ci, &pi);
pair<int, int> obj = make_pair(pi, ci);
if (v.find(obj) == v.end()) {
v[obj] = 1;
} else {
v[obj]++;
}
}
vector<pair<int, int> > q;
for(int j = 0; j < m; j++) {
int vj, dj;
scanf("%d%d", &vj, &dj);
q.push_back(make_pair(vj, dj));
}
sort(q.begin(), q.end());
reverse(q.begin(), q.end());
for(int j = 0; j < m; j++) {
int vj = q[j].first;
int dj = q[j].second;
map<pair<int, int>, int>::iterator it = v.lower_bound(make_pair(dj, -1));
if (it != v.end()) {
if ((it->first).second < vj) {
think.push_back(vj - (it->first).second);
}
if (it->second == 1) {
v.erase(it);
} else {
v[it->first] --;
}
}
}
sort(think.begin(), think.end());
reverse(think.begin(), think.end());
o = min(o, static_cast<int>(think.size()));
for(int i = 0; i < o; i++) {
res += think[i];
}
printf("%lld\n", res);
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
