#include<bits/stdc++.h>
using namespace std;
struct point
{
int x,y;
};
int n;
vector<point> vec;
int cnt = 0;
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0);
cin >> n;
stack<point> st;
for(int i=0;i<n;++i)
{
int a,b;
cin >> a >> b;
if(!st.empty() && b < st.top().y && abs(a-st.top().x) <= st.top().y-b) continue;
if(!st.empty() && b == st.top().y)
{
++cnt;
st.push({a,b});
continue;
}
if(st.empty())
{
++cnt;
st.push({a,b});
}
}
cout << cnt;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1318 ms |
80584 KB |
Output is correct |
2 |
Correct |
1369 ms |
79676 KB |
Output is correct |
3 |
Correct |
1303 ms |
77460 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1276 ms |
41048 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1318 ms |
80584 KB |
Output is correct |
2 |
Correct |
1369 ms |
79676 KB |
Output is correct |
3 |
Correct |
1303 ms |
77460 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |