#include <bits/stdc++.h>
using namespace std;
struct T
{
int x;
int y;
};
bool good(T a, T b)
{
return a.x <= b.x && a.y <= b.y;
}
bool operator < (T a, T b)
{
if (a.y == b.y)
{
return a.x < b.x;
}
return a.y < b.y;
}
const int N = 10000000 + 7;
int n;
T v[N];
int dp[N];
signed main()
{
#ifdef ONPC
freopen ("input.txt", "r", stdin);
#endif // ONPC
#ifndef ONPC
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#endif // ONPC
///gen();
cin >> n;
for (int i = 1; i <= n; i++)
{
int x, y;
cin >> v[i].x >> v[i].y;
x = -(v[i].x + v[i].y);
y = (v[i].x - v[i].y);
v[i].x = x;
v[i].y = y;
}
sort(v + 1, v + n + 1);
int mn = v[1].x, cnt = 1;
for (int i = 2; i <= n; i++)
{
if (v[i].x < mn)
{
mn = v[i].x;
cnt++;
}
}
cout << cnt << "\n";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1505 ms |
94968 KB |
Output is correct |
2 |
Correct |
1473 ms |
94572 KB |
Output is correct |
3 |
Correct |
1450 ms |
92108 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
328 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
328 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
328 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
328 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
328 KB |
Output is correct |
9 |
Correct |
0 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
328 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
328 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
328 KB |
Output is correct |
9 |
Correct |
0 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
328 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
328 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
328 KB |
Output is correct |
9 |
Correct |
0 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
48 ms |
5308 KB |
Output is correct |
15 |
Correct |
47 ms |
5300 KB |
Output is correct |
16 |
Correct |
36 ms |
4488 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1543 ms |
94348 KB |
Output is correct |
2 |
Correct |
1511 ms |
94192 KB |
Output is correct |
3 |
Correct |
1488 ms |
91844 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1505 ms |
94968 KB |
Output is correct |
2 |
Correct |
1473 ms |
94572 KB |
Output is correct |
3 |
Correct |
1450 ms |
92108 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
328 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
328 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
328 KB |
Output is correct |
12 |
Correct |
0 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
48 ms |
5308 KB |
Output is correct |
18 |
Correct |
47 ms |
5300 KB |
Output is correct |
19 |
Correct |
36 ms |
4488 KB |
Output is correct |
20 |
Correct |
1543 ms |
94348 KB |
Output is correct |
21 |
Correct |
1511 ms |
94192 KB |
Output is correct |
22 |
Correct |
1488 ms |
91844 KB |
Output is correct |
23 |
Execution timed out |
2062 ms |
148828 KB |
Time limit exceeded |
24 |
Halted |
0 ms |
0 KB |
- |