# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
115339 | 2019-06-06T17:25:49 Z | model_code | Hotel (CEOI11_hot) | C++17 | 4000 ms | 10464 KB |
/* Slow solution for task HOT * Author: Miroslaw Michalski * 24APR11 * linear search */ #include <cstdio> #include <vector> #include <algorithm> #include <iostream> using namespace std; const int INF = 1100000000; int main() { int n, m, o, ci, pi; long long res = 0; vector<int> think; vector<pair<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); v.push_back(obj); } sort(v.begin(), v.end()); vector<pair<int, int> > q; for(int i = 0; i < m; i++) { scanf("%d%d", &ci, &pi); q.push_back(make_pair(ci, pi)); } sort(q.begin(), q.end()); reverse(q.begin(), q.end()); for(int i = 0; i < m; i++) { ci = q[i].first; pi = q[i].second; for(size_t j = 0; j < v.size(); j++) { if (v[j] > make_pair(pi, -1)) { if (v[j].second < ci) { think.push_back(ci - v[j].second); } v[j] = make_pair(-INF, -INF); break; } } } 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); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 35 ms | 512 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 804 ms | 1400 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2480 ms | 2412 KB | Output is correct |
2 | Correct | 1319 ms | 1772 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4086 ms | 4912 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4003 ms | 9692 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4019 ms | 10464 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |