#include<bits/stdc++.h>
#define ff first
#define ss second
using namespace std;
int n,m,c[100005],i,j,dp[1005][1005];
pair<int,int> p[100005];
bool cmp(pair<int,int> a,pair<int,int> b){
if(a.ss==b.ss) return a.ff<b.ff;
return a.ss<b.ss;
}
int main(){
cin >> n >> m;
for(i=1;i<=n;i++){
cin >> p[i].ff >> p[i].ss;
}
for(i=1;i<=m;i++){
cin >> c[i];
}
sort(p+1,p+n+1,cmp);
sort(c+1,c+m+1);
for(i=1;i<=m;i++){
for(j=1;j<=n;j++){
if(c[i]>=p[j].ff) dp[i][j]=dp[i-1][j-1]+1;
else dp[i][j]=dp[i][j-1];
}
}
cout << dp[m][n];
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 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 |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
604 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 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 |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
604 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
344 KB |
Output is correct |
20 |
Correct |
3 ms |
4188 KB |
Output is correct |
21 |
Correct |
3 ms |
4444 KB |
Output is correct |
22 |
Correct |
3 ms |
4440 KB |
Output is correct |
23 |
Correct |
3 ms |
4188 KB |
Output is correct |
24 |
Correct |
3 ms |
4324 KB |
Output is correct |
25 |
Correct |
3 ms |
4188 KB |
Output is correct |
26 |
Correct |
3 ms |
4324 KB |
Output is correct |
27 |
Correct |
3 ms |
4188 KB |
Output is correct |
28 |
Correct |
2 ms |
4188 KB |
Output is correct |
29 |
Correct |
3 ms |
4188 KB |
Output is correct |
30 |
Correct |
2 ms |
4188 KB |
Output is correct |
31 |
Correct |
3 ms |
4188 KB |
Output is correct |
32 |
Correct |
1 ms |
348 KB |
Output is correct |
33 |
Correct |
2 ms |
4188 KB |
Output is correct |
34 |
Correct |
1 ms |
1372 KB |
Output is correct |
35 |
Correct |
2 ms |
4188 KB |
Output is correct |
36 |
Correct |
4 ms |
4188 KB |
Output is correct |
37 |
Correct |
3 ms |
4296 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 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 |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
604 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
344 KB |
Output is correct |
20 |
Correct |
3 ms |
4188 KB |
Output is correct |
21 |
Correct |
3 ms |
4444 KB |
Output is correct |
22 |
Correct |
3 ms |
4440 KB |
Output is correct |
23 |
Correct |
3 ms |
4188 KB |
Output is correct |
24 |
Correct |
3 ms |
4324 KB |
Output is correct |
25 |
Correct |
3 ms |
4188 KB |
Output is correct |
26 |
Correct |
3 ms |
4324 KB |
Output is correct |
27 |
Correct |
3 ms |
4188 KB |
Output is correct |
28 |
Correct |
2 ms |
4188 KB |
Output is correct |
29 |
Correct |
3 ms |
4188 KB |
Output is correct |
30 |
Correct |
2 ms |
4188 KB |
Output is correct |
31 |
Correct |
3 ms |
4188 KB |
Output is correct |
32 |
Correct |
1 ms |
348 KB |
Output is correct |
33 |
Correct |
2 ms |
4188 KB |
Output is correct |
34 |
Correct |
1 ms |
1372 KB |
Output is correct |
35 |
Correct |
2 ms |
4188 KB |
Output is correct |
36 |
Correct |
4 ms |
4188 KB |
Output is correct |
37 |
Correct |
3 ms |
4296 KB |
Output is correct |
38 |
Runtime error |
147 ms |
13772 KB |
Execution killed with signal 11 |
39 |
Halted |
0 ms |
0 KB |
- |