#include<bits/stdc++.h>
using namespace std;
#define int long long
int n, x, y, sx, sy, ans = 1;
void sol() {
if(sx + sy >= x + y) {
return;
}
if(max(sx, sy) - min(sx, sy) < max(x, y) - min(x, y)) {
ans++;
}
sx = x;
sy = y;
return;
}
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin >> n;
cin >> x >> y;
sx = x;
sy = y;
for(int i = 1; i < n; i++) {
cin >> x >> y;
sol();
}
cout << ans;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1381 ms |
3000 KB |
Output is correct |
2 |
Correct |
1600 ms |
112648 KB |
Output is correct |
3 |
Correct |
1519 ms |
109736 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 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 |
0 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 |
0 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 |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1358 ms |
296 KB |
Output is correct |
2 |
Correct |
1427 ms |
96596 KB |
Output is correct |
3 |
Correct |
1444 ms |
94248 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1381 ms |
3000 KB |
Output is correct |
2 |
Correct |
1600 ms |
112648 KB |
Output is correct |
3 |
Correct |
1519 ms |
109736 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |