| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 990887 | tincamatei | Advertisement 2 (JOI23_ho_t2) | C++14 | 318 ms | 34676 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
bool eats(std::pair<int, int> eater, std::pair<int, int> eaten) {
int dist = std::abs(eater.first - eaten.first);
return dist <= eater.second - eaten.second;
}
int main() {
std::cin.tie(NULL);
std::iostream::sync_with_stdio(false);
int N;
std::cin >> N;
std::set<std::pair<int, int>> ordered;
std::vector<std::pair<int, int>> input(N);
for (int i = 0; i < N; i++) {
int X, E;
std::cin >> X >> E;
input[i] = {X, E};
}
std::sort(input.begin(), input.end(), [](const std::pair<int, int> a,
const std::pair<int, int> b) {
return a.second < b.second;
});
for (int i = 0; i < N; i++) {
auto [X, E] = input[i];
std::vector<std::pair<int, int> > to_erase;
auto split = ordered.lower_bound({X, -1});
auto it = split;
while (it != ordered.end() && eats({X, E}, *it)) {
to_erase.push_back(*it);
it++;
}
it = split;
while (it != ordered.begin() && eats({X, E}, *it)) {
it--;
if (eats({X, E}, *it))
to_erase.push_back(*it);
}
for (auto it: to_erase)
ordered.erase(it);
ordered.insert({X, E});
}
std::cout << ordered.size();
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... | ||||
