# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
626124 |
2022-08-11T08:46:20 Z |
l_reho |
Exhibition (JOI19_ho_t2) |
C++14 |
|
359 ms |
16080 KB |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define x first
#define y second
vector<pair<ll, ll>> P;
vector<ll> C;
int dp[1002][1002];
void solve(){
int N, M;
cin>>N>>M;
P.assign(N, pair<ll, ll>());
C.assign(M, 0);
for(int i = 0; i < N; i++)
cin>>P[i].x>>P[i].y;
for(int j = 0; j < M; j++)
cin>>C[j];
sort(C.begin(), C.end());
sort(P.begin(), P.end(), [&](pair<ll, ll> p1, pair<ll, ll> p2){
return p1.second < p2.second || (p1.second == p2.second && p1.first < p2.first);
});
int ans = 0;
for(int i = 0; i <= M; i++){
for(int j = 0; j <= N; j++){
if(i == 0 || j == 0) {
dp[i][j] = 0;
continue;
}
if(P[j-1].first <= C[i-1]){
dp[i][j] = dp[i-1][j-1]+1;
ans = max(dp[i][j], ans);
continue;
}
dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
ans = max(dp[i][j], ans);
}
}
cout<<ans<<endl;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
solve();
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
0 ms |
340 KB |
Output is correct |
7 |
Correct |
0 ms |
340 KB |
Output is correct |
8 |
Correct |
0 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
0 ms |
340 KB |
Output is correct |
14 |
Correct |
0 ms |
340 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
0 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
336 KB |
Output is correct |
18 |
Correct |
0 ms |
340 KB |
Output is correct |
19 |
Correct |
0 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
0 ms |
340 KB |
Output is correct |
7 |
Correct |
0 ms |
340 KB |
Output is correct |
8 |
Correct |
0 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
0 ms |
340 KB |
Output is correct |
14 |
Correct |
0 ms |
340 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
0 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
336 KB |
Output is correct |
18 |
Correct |
0 ms |
340 KB |
Output is correct |
19 |
Correct |
0 ms |
340 KB |
Output is correct |
20 |
Correct |
5 ms |
4308 KB |
Output is correct |
21 |
Correct |
5 ms |
4184 KB |
Output is correct |
22 |
Correct |
5 ms |
4228 KB |
Output is correct |
23 |
Correct |
6 ms |
4308 KB |
Output is correct |
24 |
Correct |
4 ms |
4268 KB |
Output is correct |
25 |
Correct |
5 ms |
4180 KB |
Output is correct |
26 |
Correct |
5 ms |
4184 KB |
Output is correct |
27 |
Correct |
7 ms |
4236 KB |
Output is correct |
28 |
Correct |
5 ms |
4188 KB |
Output is correct |
29 |
Correct |
4 ms |
4308 KB |
Output is correct |
30 |
Correct |
5 ms |
4180 KB |
Output is correct |
31 |
Correct |
5 ms |
4308 KB |
Output is correct |
32 |
Correct |
1 ms |
348 KB |
Output is correct |
33 |
Correct |
2 ms |
4180 KB |
Output is correct |
34 |
Correct |
2 ms |
1492 KB |
Output is correct |
35 |
Correct |
2 ms |
4180 KB |
Output is correct |
36 |
Correct |
5 ms |
4248 KB |
Output is correct |
37 |
Correct |
5 ms |
4308 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
0 ms |
340 KB |
Output is correct |
7 |
Correct |
0 ms |
340 KB |
Output is correct |
8 |
Correct |
0 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
0 ms |
340 KB |
Output is correct |
14 |
Correct |
0 ms |
340 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
0 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
336 KB |
Output is correct |
18 |
Correct |
0 ms |
340 KB |
Output is correct |
19 |
Correct |
0 ms |
340 KB |
Output is correct |
20 |
Correct |
5 ms |
4308 KB |
Output is correct |
21 |
Correct |
5 ms |
4184 KB |
Output is correct |
22 |
Correct |
5 ms |
4228 KB |
Output is correct |
23 |
Correct |
6 ms |
4308 KB |
Output is correct |
24 |
Correct |
4 ms |
4268 KB |
Output is correct |
25 |
Correct |
5 ms |
4180 KB |
Output is correct |
26 |
Correct |
5 ms |
4184 KB |
Output is correct |
27 |
Correct |
7 ms |
4236 KB |
Output is correct |
28 |
Correct |
5 ms |
4188 KB |
Output is correct |
29 |
Correct |
4 ms |
4308 KB |
Output is correct |
30 |
Correct |
5 ms |
4180 KB |
Output is correct |
31 |
Correct |
5 ms |
4308 KB |
Output is correct |
32 |
Correct |
1 ms |
348 KB |
Output is correct |
33 |
Correct |
2 ms |
4180 KB |
Output is correct |
34 |
Correct |
2 ms |
1492 KB |
Output is correct |
35 |
Correct |
2 ms |
4180 KB |
Output is correct |
36 |
Correct |
5 ms |
4248 KB |
Output is correct |
37 |
Correct |
5 ms |
4308 KB |
Output is correct |
38 |
Runtime error |
359 ms |
16080 KB |
Execution killed with signal 11 |
39 |
Halted |
0 ms |
0 KB |
- |