# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
720971 |
2023-04-10T00:41:54 Z |
Pring |
Exhibition (JOI19_ho_t2) |
C++14 |
|
1 ms |
340 KB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int, int> pii;
const int MXN = 1005;
int n, m, fr[MXN], dp[MXN][MXN], lastC, ans;
struct P {
int sz, val;
P() {
sz = 0;
val = 0;
}
P(int _sz, int _val) {
sz = _sz;
val = _val;
}
} pic[MXN];
void getDP(int id) {
// cout << "id: " << id << endl;
while (pic[id].sz > fr[lastC]) lastC++;
// cout << "lastC: " << lastC << endl;
vector<int> avail;
for (int i = 0; i < id; i++) if (pic[i].val <= pic[id].val) avail.push_back(i);
// cout << "avail: ";
// for (auto &i : avail) cout << i << ' ';
// cout << endl;
for (int i = lastC; i < m; i++) {
dp[id][i] = 1;
for (auto &j : avail) {
dp[id][i] = max(dp[id][i], dp[j][i - 1] + 1);
}
}
ans = max(ans, dp[id][m - 1]);
}
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cin >> n >> m;
for (int i = 0; i < n; i++) cin >> pic[i].sz >> pic[i].val;
for (int i = 0; i < m; i++) cin >> fr[i];
sort(pic, pic + n, [](P &a, P &b) {
return (a.sz == b.sz ? a.val < b.val : a.sz < b.sz);
});
sort(fr, fr + m);
fr[m] = LLONG_MAX;
for (int i = 0; i < n; i++) {
getDP(i);
}
cout << ans << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 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 |
340 KB |
Output is correct |
5 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 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 |
340 KB |
Output is correct |
5 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 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 |
340 KB |
Output is correct |
5 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |