| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 990895 | tincamatei | Advertisement 2 (JOI23_ho_t2) | C++14 | 118 ms | 14164 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::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, X + E};
}
std::sort(input.begin(), input.end(), [](const std::pair<int, int> a,
const std::pair<int, int> b) {
return a.first < b.first || (a.first == b.first && a.second > b.second);
});
const int INF = 1000000000;
std::pair<int, int> last = {-INF - 1, -INF - 1};
int res = 0;
for (int i = 0; i < input.size(); i++) {
auto [L, R] = input[i];
// otherwise this is eaten
if (R > last.second) {
res++;
last = {L, R};
}
}
std::cout << res;
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... | ||||
