Submission #786069

# Submission time Handle Problem Language Result Execution time Memory
786069 2023-07-18T02:25:13 Z kebine Exhibition (JOI19_ho_t2) C++17
50 / 100
1000 ms 8208 KB
#include <bits/stdc++.h>
using namespace std;

#define int long long

const int maks = 1e3 + 5;
int dp[maks][maks];

int n, m, bingkai[maks];
pair<int, int> gambar[maks];

bool com(pair<int, int> a, pair<int, int> b) {
  return ((a.first < b.first) or (a.first == b.first and a.second < b.second));
}

signed main() {

  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> gambar[i].second >> gambar[i].first;
  }

  for (int i = 1; i <= m; i++) {
    cin >> bingkai[i];
  }
  sort(bingkai+1, bingkai+1+m);
  sort(gambar+1, gambar+1+n, com);

  // for (int i = 1; i <= n; i++) cout << gambar[i].first << " " << gambar[i].second << endl;
  // cout << endl;
  // for (int i = 1; i <= m; i++) cout << bingkai[i] << endl;
  // cout << endl;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (gambar[i].second <= bingkai[j]) dp[i][j] = max(dp[i][j], dp[i-1][j-1]+1);
      dp[i][j] = max(dp[i][j], dp[i-1][j]);
      dp[i][j] = max(dp[i][j], dp[i][j-1]);
    }
  }
  cout << dp[n][m] << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 264 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 304 KB Output is correct
11 Correct 1 ms 304 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 312 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 304 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 264 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 304 KB Output is correct
11 Correct 1 ms 304 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 312 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 304 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 7 ms 8104 KB Output is correct
21 Correct 7 ms 8208 KB Output is correct
22 Correct 8 ms 8132 KB Output is correct
23 Correct 7 ms 8128 KB Output is correct
24 Correct 7 ms 8148 KB Output is correct
25 Correct 7 ms 8148 KB Output is correct
26 Correct 7 ms 8140 KB Output is correct
27 Correct 6 ms 8148 KB Output is correct
28 Correct 11 ms 8148 KB Output is correct
29 Correct 7 ms 8148 KB Output is correct
30 Correct 7 ms 8152 KB Output is correct
31 Correct 7 ms 8148 KB Output is correct
32 Correct 3 ms 4308 KB Output is correct
33 Correct 1 ms 316 KB Output is correct
34 Correct 7 ms 6484 KB Output is correct
35 Correct 1 ms 444 KB Output is correct
36 Correct 9 ms 8120 KB Output is correct
37 Correct 7 ms 8148 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 264 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 304 KB Output is correct
11 Correct 1 ms 304 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 312 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 304 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 7 ms 8104 KB Output is correct
21 Correct 7 ms 8208 KB Output is correct
22 Correct 8 ms 8132 KB Output is correct
23 Correct 7 ms 8128 KB Output is correct
24 Correct 7 ms 8148 KB Output is correct
25 Correct 7 ms 8148 KB Output is correct
26 Correct 7 ms 8140 KB Output is correct
27 Correct 6 ms 8148 KB Output is correct
28 Correct 11 ms 8148 KB Output is correct
29 Correct 7 ms 8148 KB Output is correct
30 Correct 7 ms 8152 KB Output is correct
31 Correct 7 ms 8148 KB Output is correct
32 Correct 3 ms 4308 KB Output is correct
33 Correct 1 ms 316 KB Output is correct
34 Correct 7 ms 6484 KB Output is correct
35 Correct 1 ms 444 KB Output is correct
36 Correct 9 ms 8120 KB Output is correct
37 Correct 7 ms 8148 KB Output is correct
38 Execution timed out 1059 ms 5452 KB Time limit exceeded
39 Halted 0 ms 0 KB -