# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
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
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |