Submission #572262

# Submission time Handle Problem Language Result Execution time Memory
572262 2022-06-04T07:20:16 Z PiejanVDC Exhibition (JOI19_ho_t2) C++17
50 / 100
288 ms 274432 KB
#include <bits/stdc++.h>
using namespace std;

signed main() {
  int n,m; cin>>n>>m;
  vector<pair<int,int>>v(n);
  for(auto &z : v) {
    cin>>z.second>>z.first;
  }
  sort(v.begin(),v.end());
  vector<int>c(m);
  for(auto &z : c) {
    cin>>z;
  }
  sort(c.begin(),c.end());
  int dp[n+5][m+5];

  for(int i = 0 ; i <= n ; i++) {
    for(int j = 0 ; j <= m ; j++) {
      dp[i][j] = 0;
    }
  }

  int ans = 0;

  for(int i = 1 ; i <= n ; i++) {
    for(int j = 1 ; j <= m ; j++) {
      dp[i][j] = dp[i][j-1];
      dp[i][j] = max(dp[i][j], dp[i-1][j]);
      if(v[i-1].second <= c[j-1])
        dp[i][j] = max(dp[i][j], dp[i-1][j-1] + 1);
      ans = max(ans, dp[i][j]);
    }
  }
  cout << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 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 1 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 300 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 300 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 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 1 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 300 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 300 KB Output is correct
20 Correct 8 ms 4292 KB Output is correct
21 Correct 8 ms 4180 KB Output is correct
22 Correct 7 ms 4172 KB Output is correct
23 Correct 7 ms 4280 KB Output is correct
24 Correct 8 ms 4288 KB Output is correct
25 Correct 7 ms 4180 KB Output is correct
26 Correct 8 ms 4180 KB Output is correct
27 Correct 8 ms 4276 KB Output is correct
28 Correct 7 ms 4284 KB Output is correct
29 Correct 11 ms 4288 KB Output is correct
30 Correct 9 ms 4176 KB Output is correct
31 Correct 8 ms 4176 KB Output is correct
32 Correct 1 ms 308 KB Output is correct
33 Correct 1 ms 212 KB Output is correct
34 Correct 3 ms 1464 KB Output is correct
35 Correct 1 ms 340 KB Output is correct
36 Correct 8 ms 4180 KB Output is correct
37 Correct 8 ms 4180 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 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 1 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 300 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 300 KB Output is correct
20 Correct 8 ms 4292 KB Output is correct
21 Correct 8 ms 4180 KB Output is correct
22 Correct 7 ms 4172 KB Output is correct
23 Correct 7 ms 4280 KB Output is correct
24 Correct 8 ms 4288 KB Output is correct
25 Correct 7 ms 4180 KB Output is correct
26 Correct 8 ms 4180 KB Output is correct
27 Correct 8 ms 4276 KB Output is correct
28 Correct 7 ms 4284 KB Output is correct
29 Correct 11 ms 4288 KB Output is correct
30 Correct 9 ms 4176 KB Output is correct
31 Correct 8 ms 4176 KB Output is correct
32 Correct 1 ms 308 KB Output is correct
33 Correct 1 ms 212 KB Output is correct
34 Correct 3 ms 1464 KB Output is correct
35 Correct 1 ms 340 KB Output is correct
36 Correct 8 ms 4180 KB Output is correct
37 Correct 8 ms 4180 KB Output is correct
38 Runtime error 288 ms 274432 KB Execution killed with signal 9
39 Halted 0 ms 0 KB -