// Src : Vux2Code
#include <bits/stdc++.h>
#define pq_rvs pll,vector<pll>,greater<pll>
using namespace std;
typedef long long ll;
typedef pair <ll, ll> pll;
const ll maxN = 1e6 + 5, inf64 = 1e18, mod = 1e9 + 7, maxLog = 20;
ll t = 1;
ll n, m, b [maxN];
pll a [maxN];
void solve () {
cin >> n >> m;
for (int i = 1; i <= n; i ++) cin >> a [i]. first >> a [i]. second;
for (int i = 1; i <= m; i ++) cin >> b [i];
sort (a + 1, a + n + 1, [&](pll x, pll y){
if (x. second != y. second) return x. second > y. second;
return x. first > y. first;
});
sort (b + 1, b + m + 1, greater <ll> ());
int j = 1;
for (int i = 1; (i <= n && j <= m); i ++) if (a [i]. first <= b [j]) j ++;
cout << j - 1;
}
int main (){
ios::sync_with_stdio (0);
cin. tie (0);
cout. tie (0);
//freopen (".inp", "r", stdin);
//freopen (".out", "w", stdout);
//cin >> t;
while (t --) solve ();
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2392 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
344 KB |
Output is correct |
10 |
Correct |
1 ms |
2392 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
2396 KB |
Output is correct |
14 |
Correct |
0 ms |
2396 KB |
Output is correct |
15 |
Correct |
0 ms |
344 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2392 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
344 KB |
Output is correct |
10 |
Correct |
1 ms |
2392 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
2396 KB |
Output is correct |
14 |
Correct |
0 ms |
2396 KB |
Output is correct |
15 |
Correct |
0 ms |
344 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
344 KB |
Output is correct |
21 |
Correct |
1 ms |
2528 KB |
Output is correct |
22 |
Correct |
1 ms |
476 KB |
Output is correct |
23 |
Correct |
1 ms |
348 KB |
Output is correct |
24 |
Correct |
1 ms |
348 KB |
Output is correct |
25 |
Correct |
1 ms |
348 KB |
Output is correct |
26 |
Correct |
1 ms |
604 KB |
Output is correct |
27 |
Correct |
1 ms |
348 KB |
Output is correct |
28 |
Correct |
1 ms |
348 KB |
Output is correct |
29 |
Correct |
1 ms |
348 KB |
Output is correct |
30 |
Correct |
1 ms |
348 KB |
Output is correct |
31 |
Correct |
1 ms |
348 KB |
Output is correct |
32 |
Correct |
1 ms |
348 KB |
Output is correct |
33 |
Correct |
1 ms |
348 KB |
Output is correct |
34 |
Correct |
1 ms |
2396 KB |
Output is correct |
35 |
Correct |
0 ms |
480 KB |
Output is correct |
36 |
Correct |
1 ms |
344 KB |
Output is correct |
37 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2392 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
344 KB |
Output is correct |
10 |
Correct |
1 ms |
2392 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
2396 KB |
Output is correct |
14 |
Correct |
0 ms |
2396 KB |
Output is correct |
15 |
Correct |
0 ms |
344 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
344 KB |
Output is correct |
21 |
Correct |
1 ms |
2528 KB |
Output is correct |
22 |
Correct |
1 ms |
476 KB |
Output is correct |
23 |
Correct |
1 ms |
348 KB |
Output is correct |
24 |
Correct |
1 ms |
348 KB |
Output is correct |
25 |
Correct |
1 ms |
348 KB |
Output is correct |
26 |
Correct |
1 ms |
604 KB |
Output is correct |
27 |
Correct |
1 ms |
348 KB |
Output is correct |
28 |
Correct |
1 ms |
348 KB |
Output is correct |
29 |
Correct |
1 ms |
348 KB |
Output is correct |
30 |
Correct |
1 ms |
348 KB |
Output is correct |
31 |
Correct |
1 ms |
348 KB |
Output is correct |
32 |
Correct |
1 ms |
348 KB |
Output is correct |
33 |
Correct |
1 ms |
348 KB |
Output is correct |
34 |
Correct |
1 ms |
2396 KB |
Output is correct |
35 |
Correct |
0 ms |
480 KB |
Output is correct |
36 |
Correct |
1 ms |
344 KB |
Output is correct |
37 |
Correct |
1 ms |
344 KB |
Output is correct |
38 |
Correct |
35 ms |
6228 KB |
Output is correct |
39 |
Correct |
32 ms |
6228 KB |
Output is correct |
40 |
Correct |
28 ms |
5724 KB |
Output is correct |
41 |
Correct |
33 ms |
5708 KB |
Output is correct |
42 |
Correct |
34 ms |
6224 KB |
Output is correct |
43 |
Correct |
36 ms |
5556 KB |
Output is correct |
44 |
Correct |
35 ms |
5468 KB |
Output is correct |
45 |
Correct |
34 ms |
5668 KB |
Output is correct |
46 |
Correct |
33 ms |
5456 KB |
Output is correct |
47 |
Correct |
32 ms |
5084 KB |
Output is correct |
48 |
Correct |
30 ms |
4956 KB |
Output is correct |
49 |
Correct |
27 ms |
4644 KB |
Output is correct |
50 |
Correct |
27 ms |
4436 KB |
Output is correct |
51 |
Correct |
35 ms |
5624 KB |
Output is correct |
52 |
Correct |
35 ms |
5688 KB |
Output is correct |
53 |
Correct |
35 ms |
5460 KB |
Output is correct |
54 |
Correct |
30 ms |
5724 KB |
Output is correct |
55 |
Correct |
39 ms |
5720 KB |
Output is correct |
56 |
Correct |
27 ms |
3920 KB |
Output is correct |
57 |
Correct |
14 ms |
2136 KB |
Output is correct |
58 |
Correct |
21 ms |
3932 KB |
Output is correct |
59 |
Correct |
20 ms |
3992 KB |
Output is correct |
60 |
Correct |
14 ms |
2140 KB |
Output is correct |
61 |
Correct |
21 ms |
3420 KB |
Output is correct |
62 |
Correct |
35 ms |
5468 KB |
Output is correct |
63 |
Correct |
35 ms |
5592 KB |
Output is correct |
64 |
Correct |
37 ms |
5976 KB |
Output is correct |
65 |
Correct |
34 ms |
5676 KB |
Output is correct |
66 |
Correct |
34 ms |
6120 KB |
Output is correct |
67 |
Correct |
35 ms |
5468 KB |
Output is correct |
68 |
Correct |
33 ms |
5468 KB |
Output is correct |
69 |
Correct |
34 ms |
5852 KB |
Output is correct |
70 |
Correct |
35 ms |
6256 KB |
Output is correct |
71 |
Correct |
35 ms |
5456 KB |
Output is correct |
72 |
Correct |
35 ms |
5720 KB |
Output is correct |
73 |
Correct |
32 ms |
5468 KB |
Output is correct |