#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//first->value
//second->size
int n, m;
ll c[100010], arr[100010];
pair<ll, ll>pics[100010];
int main()
{
cin>>n>>m;
for(int i=1; i<=n; i++)cin>>pics[i].second>>pics[i].first;
for(int i=1; i<=m; i++)cin>>c[i];
sort(pics+1, pics+n+1);
sort(c+1, c+m+1);
for(int i=1; i<=n; i++)
{
int l=1, r=m+1, mid=(m+2)/2;
while(l<=r)
{
if(c[mid]<pics[i].second){l=mid+1; mid=(l+r)/2;}
else {r=mid-1; mid=(l+r)/2;}
}
arr[i]=l;
}
int br=0, ans=0;
for(int i=n; i>0; i--)
{
if(m-arr[i]>=br){ans++; br++;}
}
cout<<ans;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
1 ms |
212 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
312 KB |
Output is correct |
19 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
1 ms |
212 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
312 KB |
Output is correct |
19 |
Correct |
1 ms |
212 KB |
Output is correct |
20 |
Correct |
2 ms |
340 KB |
Output is correct |
21 |
Correct |
1 ms |
340 KB |
Output is correct |
22 |
Correct |
1 ms |
340 KB |
Output is correct |
23 |
Correct |
1 ms |
340 KB |
Output is correct |
24 |
Correct |
1 ms |
324 KB |
Output is correct |
25 |
Correct |
2 ms |
324 KB |
Output is correct |
26 |
Correct |
2 ms |
340 KB |
Output is correct |
27 |
Correct |
2 ms |
320 KB |
Output is correct |
28 |
Correct |
1 ms |
340 KB |
Output is correct |
29 |
Correct |
2 ms |
320 KB |
Output is correct |
30 |
Correct |
1 ms |
340 KB |
Output is correct |
31 |
Correct |
2 ms |
340 KB |
Output is correct |
32 |
Correct |
1 ms |
320 KB |
Output is correct |
33 |
Correct |
1 ms |
320 KB |
Output is correct |
34 |
Correct |
1 ms |
344 KB |
Output is correct |
35 |
Correct |
1 ms |
320 KB |
Output is correct |
36 |
Correct |
2 ms |
340 KB |
Output is correct |
37 |
Correct |
2 ms |
340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
1 ms |
212 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
312 KB |
Output is correct |
19 |
Correct |
1 ms |
212 KB |
Output is correct |
20 |
Correct |
2 ms |
340 KB |
Output is correct |
21 |
Correct |
1 ms |
340 KB |
Output is correct |
22 |
Correct |
1 ms |
340 KB |
Output is correct |
23 |
Correct |
1 ms |
340 KB |
Output is correct |
24 |
Correct |
1 ms |
324 KB |
Output is correct |
25 |
Correct |
2 ms |
324 KB |
Output is correct |
26 |
Correct |
2 ms |
340 KB |
Output is correct |
27 |
Correct |
2 ms |
320 KB |
Output is correct |
28 |
Correct |
1 ms |
340 KB |
Output is correct |
29 |
Correct |
2 ms |
320 KB |
Output is correct |
30 |
Correct |
1 ms |
340 KB |
Output is correct |
31 |
Correct |
2 ms |
340 KB |
Output is correct |
32 |
Correct |
1 ms |
320 KB |
Output is correct |
33 |
Correct |
1 ms |
320 KB |
Output is correct |
34 |
Correct |
1 ms |
344 KB |
Output is correct |
35 |
Correct |
1 ms |
320 KB |
Output is correct |
36 |
Correct |
2 ms |
340 KB |
Output is correct |
37 |
Correct |
2 ms |
340 KB |
Output is correct |
38 |
Correct |
106 ms |
6292 KB |
Output is correct |
39 |
Correct |
97 ms |
6204 KB |
Output is correct |
40 |
Correct |
97 ms |
6252 KB |
Output is correct |
41 |
Correct |
109 ms |
6276 KB |
Output is correct |
42 |
Correct |
99 ms |
6204 KB |
Output is correct |
43 |
Correct |
99 ms |
6292 KB |
Output is correct |
44 |
Correct |
104 ms |
6220 KB |
Output is correct |
45 |
Correct |
125 ms |
6224 KB |
Output is correct |
46 |
Correct |
98 ms |
6196 KB |
Output is correct |
47 |
Correct |
95 ms |
5708 KB |
Output is correct |
48 |
Correct |
89 ms |
5676 KB |
Output is correct |
49 |
Correct |
84 ms |
4940 KB |
Output is correct |
50 |
Correct |
81 ms |
4936 KB |
Output is correct |
51 |
Correct |
99 ms |
6268 KB |
Output is correct |
52 |
Correct |
99 ms |
6272 KB |
Output is correct |
53 |
Correct |
96 ms |
6220 KB |
Output is correct |
54 |
Correct |
91 ms |
6296 KB |
Output is correct |
55 |
Correct |
102 ms |
6260 KB |
Output is correct |
56 |
Correct |
64 ms |
4576 KB |
Output is correct |
57 |
Correct |
34 ms |
1976 KB |
Output is correct |
58 |
Correct |
63 ms |
4480 KB |
Output is correct |
59 |
Correct |
69 ms |
4464 KB |
Output is correct |
60 |
Correct |
35 ms |
2044 KB |
Output is correct |
61 |
Correct |
60 ms |
3484 KB |
Output is correct |
62 |
Correct |
107 ms |
6220 KB |
Output is correct |
63 |
Correct |
108 ms |
6276 KB |
Output is correct |
64 |
Correct |
107 ms |
6192 KB |
Output is correct |
65 |
Correct |
107 ms |
6260 KB |
Output is correct |
66 |
Correct |
107 ms |
6216 KB |
Output is correct |
67 |
Correct |
108 ms |
6312 KB |
Output is correct |
68 |
Correct |
108 ms |
6196 KB |
Output is correct |
69 |
Correct |
109 ms |
6276 KB |
Output is correct |
70 |
Correct |
109 ms |
6232 KB |
Output is correct |
71 |
Correct |
107 ms |
6204 KB |
Output is correct |
72 |
Correct |
106 ms |
6304 KB |
Output is correct |
73 |
Correct |
102 ms |
6348 KB |
Output is correct |