#include <bits/stdc++.h>
using namespace std;
bool comp(pair<int,int>&a, pair<int,int>&b) {
if (a.second==b.second) {
return a.first<b.first;
}
return a.second<b.second;
}
int main() {
int n,m; cin >> n >> m;
vector<pair<int,int>> paintings(n);
vector<int> frames(m);
for (int i=0;i<n;i++) {
cin >> paintings[i].first >> paintings[i].second;
}
for (int i=0;i<m;i++) {
cin >> frames[i];
}
sort(frames.begin(),frames.end());
sort(paintings.begin(),paintings.end(),comp);
int sus;
vector<int> bruh;
for (int i=0;i<n;i++) {
sus=lower_bound(frames.begin(),frames.end(),paintings[i].first)-frames.begin();
bruh.push_back(sus);
}
int ans=0;
for (int i=n-1;i>-1;i--) {
if (bruh[i]<m) {
ans++; m--;
}
}
cout << ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 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 |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
0 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 |
0 ms |
300 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
1 ms |
336 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 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 |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
0 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 |
0 ms |
300 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
1 ms |
336 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
0 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 |
2 ms |
340 KB |
Output is correct |
25 |
Correct |
1 ms |
340 KB |
Output is correct |
26 |
Correct |
2 ms |
340 KB |
Output is correct |
27 |
Correct |
1 ms |
312 KB |
Output is correct |
28 |
Correct |
1 ms |
340 KB |
Output is correct |
29 |
Correct |
2 ms |
340 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 |
212 KB |
Output is correct |
33 |
Correct |
1 ms |
212 KB |
Output is correct |
34 |
Correct |
1 ms |
340 KB |
Output is correct |
35 |
Correct |
1 ms |
212 KB |
Output is correct |
36 |
Correct |
2 ms |
344 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 |
0 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 |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
0 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 |
0 ms |
300 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
1 ms |
336 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
0 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 |
2 ms |
340 KB |
Output is correct |
25 |
Correct |
1 ms |
340 KB |
Output is correct |
26 |
Correct |
2 ms |
340 KB |
Output is correct |
27 |
Correct |
1 ms |
312 KB |
Output is correct |
28 |
Correct |
1 ms |
340 KB |
Output is correct |
29 |
Correct |
2 ms |
340 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 |
212 KB |
Output is correct |
33 |
Correct |
1 ms |
212 KB |
Output is correct |
34 |
Correct |
1 ms |
340 KB |
Output is correct |
35 |
Correct |
1 ms |
212 KB |
Output is correct |
36 |
Correct |
2 ms |
344 KB |
Output is correct |
37 |
Correct |
2 ms |
340 KB |
Output is correct |
38 |
Correct |
103 ms |
4932 KB |
Output is correct |
39 |
Correct |
106 ms |
5004 KB |
Output is correct |
40 |
Correct |
95 ms |
4936 KB |
Output is correct |
41 |
Correct |
104 ms |
4912 KB |
Output is correct |
42 |
Correct |
100 ms |
4904 KB |
Output is correct |
43 |
Correct |
102 ms |
4916 KB |
Output is correct |
44 |
Correct |
104 ms |
4904 KB |
Output is correct |
45 |
Correct |
107 ms |
4912 KB |
Output is correct |
46 |
Correct |
97 ms |
4936 KB |
Output is correct |
47 |
Correct |
99 ms |
4528 KB |
Output is correct |
48 |
Correct |
96 ms |
4620 KB |
Output is correct |
49 |
Correct |
84 ms |
4168 KB |
Output is correct |
50 |
Correct |
81 ms |
4156 KB |
Output is correct |
51 |
Correct |
101 ms |
4908 KB |
Output is correct |
52 |
Correct |
106 ms |
5016 KB |
Output is correct |
53 |
Correct |
100 ms |
4968 KB |
Output is correct |
54 |
Correct |
97 ms |
5024 KB |
Output is correct |
55 |
Correct |
112 ms |
5036 KB |
Output is correct |
56 |
Correct |
65 ms |
3616 KB |
Output is correct |
57 |
Correct |
34 ms |
1620 KB |
Output is correct |
58 |
Correct |
68 ms |
3620 KB |
Output is correct |
59 |
Correct |
70 ms |
3656 KB |
Output is correct |
60 |
Correct |
35 ms |
1612 KB |
Output is correct |
61 |
Correct |
61 ms |
2916 KB |
Output is correct |
62 |
Correct |
116 ms |
4904 KB |
Output is correct |
63 |
Correct |
108 ms |
4912 KB |
Output is correct |
64 |
Correct |
108 ms |
5012 KB |
Output is correct |
65 |
Correct |
118 ms |
5044 KB |
Output is correct |
66 |
Correct |
147 ms |
5012 KB |
Output is correct |
67 |
Correct |
107 ms |
4920 KB |
Output is correct |
68 |
Correct |
109 ms |
4912 KB |
Output is correct |
69 |
Correct |
109 ms |
4936 KB |
Output is correct |
70 |
Correct |
114 ms |
5028 KB |
Output is correct |
71 |
Correct |
107 ms |
4904 KB |
Output is correct |
72 |
Correct |
107 ms |
5020 KB |
Output is correct |
73 |
Correct |
107 ms |
4912 KB |
Output is correct |