# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1017596 | 2024-07-09T09:01:47 Z | vjudge1 | Stove (JOI18_stove) | C++17 | 0 ms | 348 KB |
#include <iostream> #include <vector> #include <algorithm> #include <queue> using namespace std; typedef pair<int, int> pii; int min_heating_time(int N, int K, vector<pii>& events) { sort(events.begin(), events.end()); priority_queue<int, vector<int>, greater<int>> pq; int total_heating_time = 0; for (auto& event : events) { int arrival = event.first; int departure = event.second; while (!pq.empty() && pq.top() < arrival) { pq.pop(); } if (pq.size() < K) { pq.push(departure); total_heating_time++; } } return total_heating_time; } int main() { int N, K; cin >> N >> K; vector<pii> events(N); for (int i = 0; i < N; ++i) { cin >> events[i].first >> events[i].second; } int result = min_heating_time(N, K, events); cout << result << endl; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |