//#pragma GCC target ("avx2,sse2")
//#pragma GCC optimization ("Ofast")
//#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree <pair <ll, int>, null_type, less <pair <ll, int> >, rb_tree_tag, tree_order_statistics_node_update>
#define ll long long
#define ull unsigned long long
#define db double
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define fi first
#define se second
#define mp make_pair
#define up_b upper_bound
#define low_b lower_bound
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define endl "\n"
#define left fsdsdfoisf
#define sum dpsdfioppsf
#define assign xcvjlkdjfio
#define trie fksdfkjkfnjuiv
#define next sidlfjsfkl
#define merge sdfksdkfsldf
#define int long long
using namespace std;
void dout() {
cerr << endl;
}
template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
cerr << H << ' ';
dout(T...);
}
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef pair <int, int> pii;
const int N = 1e5 + 7;
int n, m, c[N], dp[N];
vector <pii> v;
void solve(int tc) {
// check for (int i = 0; i < n; j++)
cin >> n >> m;
for (int i = 0; i < n; i++) {
int s, val;
cin >> s >> val;
v.pb({val, s});
}
sort(all(v));
reverse(all(v));
for (int i = 1; i <= m; i++) {
cin >> c[i];
}
sort(c + 1, c + m + 1);
int mx = 0;
for (int i = 0; i < n; i++) {
int s = v[i].se, val = v[i].fi;
int x = lower_bound(c + 1, c + m + 1, s) - c;
dp[i] = min(mx + 1, m - x + 1);
mx = max(mx, dp[i]);
}
cout << mx;
}
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
// freopen("meetings.in", "r", stdin);
// freopen("meetings.out", "w", stdout);
int tc = 1;
// cin >> tc;
for (int i = 0; i < tc; i++) {
solve(i);
// cleanup();
}
}
Compilation message
joi2019_ho_t2.cpp: In function 'void solve(long long int)':
joi2019_ho_t2.cpp:69:26: warning: unused variable 'val' [-Wunused-variable]
int s = v[i].se, val = v[i].fi;
^~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
2 ms |
376 KB |
Output is correct |
10 |
Correct |
2 ms |
376 KB |
Output is correct |
11 |
Correct |
2 ms |
376 KB |
Output is correct |
12 |
Correct |
2 ms |
376 KB |
Output is correct |
13 |
Correct |
2 ms |
376 KB |
Output is correct |
14 |
Correct |
2 ms |
376 KB |
Output is correct |
15 |
Correct |
2 ms |
376 KB |
Output is correct |
16 |
Correct |
2 ms |
376 KB |
Output is correct |
17 |
Correct |
2 ms |
376 KB |
Output is correct |
18 |
Correct |
2 ms |
376 KB |
Output is correct |
19 |
Correct |
2 ms |
376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
2 ms |
376 KB |
Output is correct |
10 |
Correct |
2 ms |
376 KB |
Output is correct |
11 |
Correct |
2 ms |
376 KB |
Output is correct |
12 |
Correct |
2 ms |
376 KB |
Output is correct |
13 |
Correct |
2 ms |
376 KB |
Output is correct |
14 |
Correct |
2 ms |
376 KB |
Output is correct |
15 |
Correct |
2 ms |
376 KB |
Output is correct |
16 |
Correct |
2 ms |
376 KB |
Output is correct |
17 |
Correct |
2 ms |
376 KB |
Output is correct |
18 |
Correct |
2 ms |
376 KB |
Output is correct |
19 |
Correct |
2 ms |
376 KB |
Output is correct |
20 |
Correct |
3 ms |
504 KB |
Output is correct |
21 |
Correct |
3 ms |
376 KB |
Output is correct |
22 |
Correct |
3 ms |
376 KB |
Output is correct |
23 |
Correct |
3 ms |
504 KB |
Output is correct |
24 |
Correct |
3 ms |
504 KB |
Output is correct |
25 |
Correct |
3 ms |
376 KB |
Output is correct |
26 |
Correct |
3 ms |
504 KB |
Output is correct |
27 |
Correct |
3 ms |
376 KB |
Output is correct |
28 |
Correct |
3 ms |
376 KB |
Output is correct |
29 |
Correct |
3 ms |
376 KB |
Output is correct |
30 |
Correct |
3 ms |
376 KB |
Output is correct |
31 |
Correct |
3 ms |
376 KB |
Output is correct |
32 |
Correct |
2 ms |
376 KB |
Output is correct |
33 |
Correct |
2 ms |
376 KB |
Output is correct |
34 |
Correct |
3 ms |
348 KB |
Output is correct |
35 |
Correct |
2 ms |
376 KB |
Output is correct |
36 |
Correct |
3 ms |
504 KB |
Output is correct |
37 |
Correct |
3 ms |
376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
2 ms |
376 KB |
Output is correct |
10 |
Correct |
2 ms |
376 KB |
Output is correct |
11 |
Correct |
2 ms |
376 KB |
Output is correct |
12 |
Correct |
2 ms |
376 KB |
Output is correct |
13 |
Correct |
2 ms |
376 KB |
Output is correct |
14 |
Correct |
2 ms |
376 KB |
Output is correct |
15 |
Correct |
2 ms |
376 KB |
Output is correct |
16 |
Correct |
2 ms |
376 KB |
Output is correct |
17 |
Correct |
2 ms |
376 KB |
Output is correct |
18 |
Correct |
2 ms |
376 KB |
Output is correct |
19 |
Correct |
2 ms |
376 KB |
Output is correct |
20 |
Correct |
3 ms |
504 KB |
Output is correct |
21 |
Correct |
3 ms |
376 KB |
Output is correct |
22 |
Correct |
3 ms |
376 KB |
Output is correct |
23 |
Correct |
3 ms |
504 KB |
Output is correct |
24 |
Correct |
3 ms |
504 KB |
Output is correct |
25 |
Correct |
3 ms |
376 KB |
Output is correct |
26 |
Correct |
3 ms |
504 KB |
Output is correct |
27 |
Correct |
3 ms |
376 KB |
Output is correct |
28 |
Correct |
3 ms |
376 KB |
Output is correct |
29 |
Correct |
3 ms |
376 KB |
Output is correct |
30 |
Correct |
3 ms |
376 KB |
Output is correct |
31 |
Correct |
3 ms |
376 KB |
Output is correct |
32 |
Correct |
2 ms |
376 KB |
Output is correct |
33 |
Correct |
2 ms |
376 KB |
Output is correct |
34 |
Correct |
3 ms |
348 KB |
Output is correct |
35 |
Correct |
2 ms |
376 KB |
Output is correct |
36 |
Correct |
3 ms |
504 KB |
Output is correct |
37 |
Correct |
3 ms |
376 KB |
Output is correct |
38 |
Correct |
73 ms |
6492 KB |
Output is correct |
39 |
Correct |
65 ms |
6508 KB |
Output is correct |
40 |
Correct |
60 ms |
6508 KB |
Output is correct |
41 |
Correct |
71 ms |
6452 KB |
Output is correct |
42 |
Correct |
69 ms |
6504 KB |
Output is correct |
43 |
Correct |
77 ms |
6476 KB |
Output is correct |
44 |
Correct |
71 ms |
6512 KB |
Output is correct |
45 |
Correct |
79 ms |
6412 KB |
Output is correct |
46 |
Correct |
67 ms |
6508 KB |
Output is correct |
47 |
Correct |
71 ms |
5912 KB |
Output is correct |
48 |
Correct |
70 ms |
5996 KB |
Output is correct |
49 |
Correct |
63 ms |
5224 KB |
Output is correct |
50 |
Correct |
60 ms |
5224 KB |
Output is correct |
51 |
Correct |
69 ms |
6504 KB |
Output is correct |
52 |
Correct |
69 ms |
6512 KB |
Output is correct |
53 |
Correct |
67 ms |
6480 KB |
Output is correct |
54 |
Correct |
60 ms |
6504 KB |
Output is correct |
55 |
Correct |
71 ms |
6508 KB |
Output is correct |
56 |
Correct |
43 ms |
4792 KB |
Output is correct |
57 |
Correct |
24 ms |
2040 KB |
Output is correct |
58 |
Correct |
43 ms |
4712 KB |
Output is correct |
59 |
Correct |
50 ms |
4832 KB |
Output is correct |
60 |
Correct |
25 ms |
2040 KB |
Output is correct |
61 |
Correct |
44 ms |
3692 KB |
Output is correct |
62 |
Correct |
81 ms |
6504 KB |
Output is correct |
63 |
Correct |
81 ms |
6508 KB |
Output is correct |
64 |
Correct |
81 ms |
6760 KB |
Output is correct |
65 |
Correct |
81 ms |
6544 KB |
Output is correct |
66 |
Correct |
81 ms |
6504 KB |
Output is correct |
67 |
Correct |
81 ms |
6504 KB |
Output is correct |
68 |
Correct |
81 ms |
6504 KB |
Output is correct |
69 |
Correct |
86 ms |
6504 KB |
Output is correct |
70 |
Correct |
83 ms |
6508 KB |
Output is correct |
71 |
Correct |
80 ms |
6500 KB |
Output is correct |
72 |
Correct |
77 ms |
6504 KB |
Output is correct |
73 |
Correct |
71 ms |
6504 KB |
Output is correct |