| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1342240 | ramzialoulou | Fire (BOI24_fire) | C++20 | 18 ms | 2648 KiB |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, m;
cin >> n >> m;
vector<pair<int, int>> a(n);
for (auto& [x, y] : a) {
cin >> x >> y;
if (x > y) {
assert(y == 0);
y = m - 1;
}
}
sort(a.begin(), a.end());
int R = -1;
priority_queue<int> pq;
int ans = -1;
int i = 0;
for (int p = 1; p <= n; p++) {
while (i < n && a[i].first <= R + 1) {
pq.push(a[i].second);
i++;
}
if (pq.empty() || pq.top() == R) {
break;
}
R = pq.top();
if (R == m - 1) {
ans = p;
break;
}
}
cout << ans << '\n';
return 0;
}
| # | 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... | ||||
