#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define ll long long
#define pb push_back
#define endl '\n'
#define pii pair<ll,ll>
#define F first
#define S second
#define double long double
#define all(x) (x).begin(),(x).end()
using namespace std;
using namespace __gnu_pbds;
typedef tree<ll , null_type , less_equal<ll> ,rb_tree_tag ,tree_order_statistics_node_update >ordered_set;
const int MOD = 1e9 + 7;
const int N=1e6 + 7 ;
const ll INF= 1e18+10;
struct trp{ll F,S,T;};
ll po1(ll x,ll y)
{
ll ans = 1;
while(y){
if( y & 1 ) ans *=x;
y /= 2;
x *=x;
x %= MOD;
ans %= MOD;
}
return ans;
}
ll b[N];
ll n , m;
pii a[N];
bool cmp(pii a,pii b)
{
if(a.S !=b.S) return a.S < b.S;
return a.F < b.F;
}
void solve()
{
cin >> n >> m;
for(ll i= 1; i <= n ; i ++ ) cin>> a[i].F >> a[i].S;
for(ll i= 1;i <= m ; i ++ ) cin >> b[i];
sort(a + 1 , a + n + 1, cmp);
sort(b + 1 , b + m + 1);
ll l = n , r = m;
while(r > 0 && l > 0){
if(a[l].F <= b[r]){
r --;
l --;
}
else l --;
}
cout << m - r << endl;
}
int main(){
//ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
//freopen(".in" , "r" , stdin);freopen(".out" , "w" , stdout);
int t = 1;
//cin >> t;
while(t--) {solve() ; }
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
312 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
308 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
308 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
308 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 |
320 KB |
Output is correct |
12 |
Correct |
1 ms |
312 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 |
224 KB |
Output is correct |
18 |
Correct |
1 ms |
212 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 |
312 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
308 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
308 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
308 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 |
320 KB |
Output is correct |
12 |
Correct |
1 ms |
312 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 |
224 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
212 KB |
Output is correct |
20 |
Correct |
2 ms |
340 KB |
Output is correct |
21 |
Correct |
2 ms |
340 KB |
Output is correct |
22 |
Correct |
2 ms |
340 KB |
Output is correct |
23 |
Correct |
2 ms |
340 KB |
Output is correct |
24 |
Correct |
2 ms |
340 KB |
Output is correct |
25 |
Correct |
2 ms |
352 KB |
Output is correct |
26 |
Correct |
3 ms |
340 KB |
Output is correct |
27 |
Correct |
2 ms |
340 KB |
Output is correct |
28 |
Correct |
2 ms |
340 KB |
Output is correct |
29 |
Correct |
2 ms |
340 KB |
Output is correct |
30 |
Correct |
2 ms |
368 KB |
Output is correct |
31 |
Correct |
2 ms |
324 KB |
Output is correct |
32 |
Correct |
2 ms |
348 KB |
Output is correct |
33 |
Correct |
1 ms |
212 KB |
Output is correct |
34 |
Correct |
2 ms |
340 KB |
Output is correct |
35 |
Correct |
1 ms |
212 KB |
Output is correct |
36 |
Correct |
2 ms |
324 KB |
Output is correct |
37 |
Correct |
2 ms |
316 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
312 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
308 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
308 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
308 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 |
320 KB |
Output is correct |
12 |
Correct |
1 ms |
312 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 |
224 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
212 KB |
Output is correct |
20 |
Correct |
2 ms |
340 KB |
Output is correct |
21 |
Correct |
2 ms |
340 KB |
Output is correct |
22 |
Correct |
2 ms |
340 KB |
Output is correct |
23 |
Correct |
2 ms |
340 KB |
Output is correct |
24 |
Correct |
2 ms |
340 KB |
Output is correct |
25 |
Correct |
2 ms |
352 KB |
Output is correct |
26 |
Correct |
3 ms |
340 KB |
Output is correct |
27 |
Correct |
2 ms |
340 KB |
Output is correct |
28 |
Correct |
2 ms |
340 KB |
Output is correct |
29 |
Correct |
2 ms |
340 KB |
Output is correct |
30 |
Correct |
2 ms |
368 KB |
Output is correct |
31 |
Correct |
2 ms |
324 KB |
Output is correct |
32 |
Correct |
2 ms |
348 KB |
Output is correct |
33 |
Correct |
1 ms |
212 KB |
Output is correct |
34 |
Correct |
2 ms |
340 KB |
Output is correct |
35 |
Correct |
1 ms |
212 KB |
Output is correct |
36 |
Correct |
2 ms |
324 KB |
Output is correct |
37 |
Correct |
2 ms |
316 KB |
Output is correct |
38 |
Correct |
137 ms |
5592 KB |
Output is correct |
39 |
Correct |
134 ms |
5468 KB |
Output is correct |
40 |
Correct |
137 ms |
5496 KB |
Output is correct |
41 |
Correct |
143 ms |
5444 KB |
Output is correct |
42 |
Correct |
133 ms |
5540 KB |
Output is correct |
43 |
Correct |
136 ms |
5524 KB |
Output is correct |
44 |
Correct |
139 ms |
5428 KB |
Output is correct |
45 |
Correct |
139 ms |
5492 KB |
Output is correct |
46 |
Correct |
139 ms |
5624 KB |
Output is correct |
47 |
Correct |
116 ms |
5000 KB |
Output is correct |
48 |
Correct |
121 ms |
4968 KB |
Output is correct |
49 |
Correct |
100 ms |
4532 KB |
Output is correct |
50 |
Correct |
104 ms |
4468 KB |
Output is correct |
51 |
Correct |
161 ms |
5468 KB |
Output is correct |
52 |
Correct |
128 ms |
5548 KB |
Output is correct |
53 |
Correct |
137 ms |
5452 KB |
Output is correct |
54 |
Correct |
130 ms |
5636 KB |
Output is correct |
55 |
Correct |
130 ms |
5480 KB |
Output is correct |
56 |
Correct |
95 ms |
3800 KB |
Output is correct |
57 |
Correct |
45 ms |
1948 KB |
Output is correct |
58 |
Correct |
91 ms |
3756 KB |
Output is correct |
59 |
Correct |
90 ms |
3912 KB |
Output is correct |
60 |
Correct |
45 ms |
1968 KB |
Output is correct |
61 |
Correct |
87 ms |
3176 KB |
Output is correct |
62 |
Correct |
128 ms |
5444 KB |
Output is correct |
63 |
Correct |
136 ms |
5524 KB |
Output is correct |
64 |
Correct |
138 ms |
5460 KB |
Output is correct |
65 |
Correct |
143 ms |
5636 KB |
Output is correct |
66 |
Correct |
138 ms |
5516 KB |
Output is correct |
67 |
Correct |
133 ms |
5544 KB |
Output is correct |
68 |
Correct |
142 ms |
5528 KB |
Output is correct |
69 |
Correct |
171 ms |
5500 KB |
Output is correct |
70 |
Correct |
152 ms |
5536 KB |
Output is correct |
71 |
Correct |
137 ms |
5460 KB |
Output is correct |
72 |
Correct |
150 ms |
5544 KB |
Output is correct |
73 |
Correct |
138 ms |
5444 KB |
Output is correct |