Submission #572253

# Submission time Handle Problem Language Result Execution time Memory
572253 2022-06-04T07:07:18 Z PiejanVDC Exhibition (JOI19_ho_t2) C++17
0 / 100
1 ms 212 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];
      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 0 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 1 ms 212 KB Output is correct
7 Incorrect 0 ms 212 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 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 1 ms 212 KB Output is correct
7 Incorrect 0 ms 212 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 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 1 ms 212 KB Output is correct
7 Incorrect 0 ms 212 KB Output isn't correct
8 Halted 0 ms 0 KB -