이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#ifdef Home
#define _GLIBCXX_DEBUG
#endif // Home
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
main() {
#ifdef Home
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif // Home
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
vector < pair < int, int > > V(n);
for(auto &[x, e] : V) {
cin >> x >> e;
}
sort(V.begin(), V.end());
stack < pair < int, int > > st;
for(auto &[x, e] : V) {
if(!st.empty() && x - st.top().first <= st.top().second - e) {
continue;
}
for(; !st.empty() && x - st.top().first <= e - st.top().second; st.pop());
st.push({x, e});
}
cout << st.size();
}
컴파일 시 표준 에러 (stderr) 메시지
Main.cpp:12:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
12 | main() {
| ^~~~
# | 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... |