# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1014852 |
2024-07-05T15:49:52 Z |
aufan |
Exhibition (JOI19_ho_t2) |
C++17 |
|
78 ms |
8400 KB |
#include <bits/stdc++.h>
#define int long long
#define fi first
#define se second
using namespace std;
int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, m;
cin >> n >> m;
vector<int> s(n), v(n), b;
for (int i = 0; i < n; i++) {
cin >> s[i] >> v[i];
b.push_back(v[i]);
}
sort(b.begin(), b.end());
b.erase(unique(b.begin(), b.end()), b.end());
vector<int> c(m);
for (int i = 0; i < m; i++) cin >> c[i];
sort(c.begin(), c.end());
vector<int> ord(n);
iota(ord.begin(), ord.end(), 0);
sort(ord.begin(), ord.end(), [&](int x, int y) {
if (v[x] == v[y]) return s[x] > s[y];
return v[x] > v[y];
});
int k = (int)b.size();
vector<int> fen(k + 1);
auto get = [&](int x) {
return lower_bound(b.begin(), b.end(), x) - b.begin();
};
auto upd = [&](int x, int val) {
for (; x <= k; x += x & -x) fen[x] = max(fen[x], val);
};
auto qry = [&](int x) {
int res = 0;
for (; x > 0; x -= x & -x) res = max(res, fen[x]);
return res;
};
int ans = 0;
for (auto i : ord) {
int lf = 0, rg = m - 1, pos = m;
while (lf <= rg) {
int md = (lf + rg) / 2;
if (s[i] <= c[md]) {
pos = md;
rg = md - 1;
} else {
lf = md + 1;
}
}
int res = min(m - pos - 1, qry(k - get(v[i]))) + 1;
ans = max(ans, res);
upd(k - get(v[i]), res);
}
cout << ans << '\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
456 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
344 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
460 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
456 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
344 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
460 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
1 ms |
468 KB |
Output is correct |
22 |
Correct |
2 ms |
520 KB |
Output is correct |
23 |
Correct |
1 ms |
348 KB |
Output is correct |
24 |
Correct |
1 ms |
464 KB |
Output is correct |
25 |
Correct |
1 ms |
468 KB |
Output is correct |
26 |
Correct |
1 ms |
348 KB |
Output is correct |
27 |
Correct |
1 ms |
348 KB |
Output is correct |
28 |
Correct |
1 ms |
348 KB |
Output is correct |
29 |
Correct |
1 ms |
344 KB |
Output is correct |
30 |
Correct |
1 ms |
344 KB |
Output is correct |
31 |
Correct |
1 ms |
348 KB |
Output is correct |
32 |
Correct |
0 ms |
348 KB |
Output is correct |
33 |
Correct |
1 ms |
348 KB |
Output is correct |
34 |
Correct |
1 ms |
464 KB |
Output is correct |
35 |
Correct |
0 ms |
348 KB |
Output is correct |
36 |
Correct |
1 ms |
348 KB |
Output is correct |
37 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
456 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
344 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
460 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
1 ms |
468 KB |
Output is correct |
22 |
Correct |
2 ms |
520 KB |
Output is correct |
23 |
Correct |
1 ms |
348 KB |
Output is correct |
24 |
Correct |
1 ms |
464 KB |
Output is correct |
25 |
Correct |
1 ms |
468 KB |
Output is correct |
26 |
Correct |
1 ms |
348 KB |
Output is correct |
27 |
Correct |
1 ms |
348 KB |
Output is correct |
28 |
Correct |
1 ms |
348 KB |
Output is correct |
29 |
Correct |
1 ms |
344 KB |
Output is correct |
30 |
Correct |
1 ms |
344 KB |
Output is correct |
31 |
Correct |
1 ms |
348 KB |
Output is correct |
32 |
Correct |
0 ms |
348 KB |
Output is correct |
33 |
Correct |
1 ms |
348 KB |
Output is correct |
34 |
Correct |
1 ms |
464 KB |
Output is correct |
35 |
Correct |
0 ms |
348 KB |
Output is correct |
36 |
Correct |
1 ms |
348 KB |
Output is correct |
37 |
Correct |
1 ms |
348 KB |
Output is correct |
38 |
Correct |
58 ms |
8016 KB |
Output is correct |
39 |
Correct |
45 ms |
7396 KB |
Output is correct |
40 |
Correct |
38 ms |
7372 KB |
Output is correct |
41 |
Correct |
56 ms |
7628 KB |
Output is correct |
42 |
Correct |
51 ms |
8168 KB |
Output is correct |
43 |
Correct |
54 ms |
8024 KB |
Output is correct |
44 |
Correct |
61 ms |
8152 KB |
Output is correct |
45 |
Correct |
63 ms |
8144 KB |
Output is correct |
46 |
Correct |
47 ms |
7380 KB |
Output is correct |
47 |
Correct |
61 ms |
7628 KB |
Output is correct |
48 |
Correct |
36 ms |
6608 KB |
Output is correct |
49 |
Correct |
48 ms |
6348 KB |
Output is correct |
50 |
Correct |
35 ms |
5840 KB |
Output is correct |
51 |
Correct |
54 ms |
8140 KB |
Output is correct |
52 |
Correct |
54 ms |
8140 KB |
Output is correct |
53 |
Correct |
47 ms |
8072 KB |
Output is correct |
54 |
Correct |
44 ms |
8140 KB |
Output is correct |
55 |
Correct |
40 ms |
7384 KB |
Output is correct |
56 |
Correct |
36 ms |
6352 KB |
Output is correct |
57 |
Correct |
11 ms |
2136 KB |
Output is correct |
58 |
Correct |
27 ms |
5580 KB |
Output is correct |
59 |
Correct |
45 ms |
6348 KB |
Output is correct |
60 |
Correct |
13 ms |
2136 KB |
Output is correct |
61 |
Correct |
31 ms |
4060 KB |
Output is correct |
62 |
Correct |
66 ms |
8144 KB |
Output is correct |
63 |
Correct |
65 ms |
7952 KB |
Output is correct |
64 |
Correct |
67 ms |
8144 KB |
Output is correct |
65 |
Correct |
64 ms |
8004 KB |
Output is correct |
66 |
Correct |
78 ms |
8400 KB |
Output is correct |
67 |
Correct |
65 ms |
8140 KB |
Output is correct |
68 |
Correct |
68 ms |
8140 KB |
Output is correct |
69 |
Correct |
64 ms |
7424 KB |
Output is correct |
70 |
Correct |
60 ms |
7228 KB |
Output is correct |
71 |
Correct |
64 ms |
8172 KB |
Output is correct |
72 |
Correct |
48 ms |
7164 KB |
Output is correct |
73 |
Correct |
53 ms |
7380 KB |
Output is correct |