/* code by the cute ~~Dengdualang~~ PixelCat owo */
/* as cute as nacho neko (aka. my wife)! */
/* Nhade stay for a night here */
/* 183234 deng deng deng pixelcat oops */
/* (yang wang yesu)*2 */
/* ^ some weird stuff. nvm =w= */
// #pragma GCC optimize("O4,unroll-loops,no-stack-protector")
// #pragma GCC target("avx,avx2,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,fma")
#include <bits/stdc++.h>
#define int LL //__int128
#define double long double
using namespace std;
using LL = long long;
using LLL = __int128_t;
using uLL = unsigned long long;
using pii = pair<int, int>;
#define For(i, a, b) for (int i = a; i <= b; i++)
#define Fors(i, a, b, s) for (int i = a; i <= b; i += s)
#define Forr(i, a, b) for (int i = a; i >= b; i--)
#define F first
#define S second
#define L(id) (id * 2 + 1)
#define R(id) (id * 2 + 2)
#define LO(x) (x & (-x))
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) ((int)x.size())
#define mkp make_pair
// #define MOD (int)(998244353)
#define MOD (int)((LL)1e9 + 7)
#define INF (int)(4e18)
// #define INF 1e9
#define EPS (1e-6)
#ifdef NYAOWO
#include "library/debug.hpp"
inline void USACO(const string &s) {
cerr << "USACO: " << s << "\n";
}
#else
#define debug(...)
inline void timer() {}
inline void USACO(const string &s) {
freopen((s + ".in").c_str(), "r", stdin);
freopen((s + ".out").c_str(), "w", stdout);
}
#endif
inline void NYA() {
ios::sync_with_stdio(false);
cin.tie(0);
}
inline int gcd(int a, int b) {
return __gcd(a, b);
}
inline int lcm(int a, int b) {
return a / gcd(a, b) * b;
}
int fpow(int b, int p, const int &mod) {
int ans = 1;
while (p) {
if (p & 1) ans = ans * b % mod;
p >>= 1;
b = b * b % mod;
}
return ans;
}
int fpow(int b, int p) {
return fpow(b, p, MOD);
}
template <typename T>
inline void chmin(T &_a, const T &_b) {
if (_b < _a) _a = _b;
}
template <typename T>
inline void chmax(T &_a, const T &_b) {
if (_b > _a) _a = _b;
}
// mt19937_64 rng(
// chrono::steady_clock::now().time_since_epoch().count());
int32_t main() {
// NYA();
// nyaacho >/////<
// miku sama bless me >/////<
int n,m; cin>>n>>m;
vector<pii> p(n);
vector<int> f(m);
for(auto &i:p) cin>>i.F>>i.S;
for(auto &i:f) cin>>i;
sort(all(p),[](pii &a,pii &b){
if(a.S!=b.S) return a.S>b.S;
return a.F>b.F;
});
sort(all(f));
reverse(all(f));
int nowf=0;
int ans=0;
for(auto &i:p){
if(i.F>f[nowf]) continue;
nowf++;
ans++;
if(nowf==m) break;
}
cout<<ans<<"\n";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
300 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
1 ms |
212 KB |
Output is correct |
17 |
Correct |
1 ms |
288 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
300 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
1 ms |
212 KB |
Output is correct |
17 |
Correct |
1 ms |
288 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
212 KB |
Output is correct |
20 |
Correct |
2 ms |
312 KB |
Output is correct |
21 |
Correct |
2 ms |
340 KB |
Output is correct |
22 |
Correct |
2 ms |
340 KB |
Output is correct |
23 |
Correct |
2 ms |
340 KB |
Output is correct |
24 |
Correct |
2 ms |
340 KB |
Output is correct |
25 |
Correct |
2 ms |
340 KB |
Output is correct |
26 |
Correct |
2 ms |
352 KB |
Output is correct |
27 |
Correct |
2 ms |
340 KB |
Output is correct |
28 |
Correct |
2 ms |
316 KB |
Output is correct |
29 |
Correct |
2 ms |
340 KB |
Output is correct |
30 |
Correct |
2 ms |
340 KB |
Output is correct |
31 |
Correct |
2 ms |
352 KB |
Output is correct |
32 |
Correct |
1 ms |
212 KB |
Output is correct |
33 |
Correct |
1 ms |
304 KB |
Output is correct |
34 |
Correct |
2 ms |
312 KB |
Output is correct |
35 |
Correct |
1 ms |
212 KB |
Output is correct |
36 |
Correct |
2 ms |
352 KB |
Output is correct |
37 |
Correct |
2 ms |
308 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
300 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
1 ms |
212 KB |
Output is correct |
17 |
Correct |
1 ms |
288 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
212 KB |
Output is correct |
20 |
Correct |
2 ms |
312 KB |
Output is correct |
21 |
Correct |
2 ms |
340 KB |
Output is correct |
22 |
Correct |
2 ms |
340 KB |
Output is correct |
23 |
Correct |
2 ms |
340 KB |
Output is correct |
24 |
Correct |
2 ms |
340 KB |
Output is correct |
25 |
Correct |
2 ms |
340 KB |
Output is correct |
26 |
Correct |
2 ms |
352 KB |
Output is correct |
27 |
Correct |
2 ms |
340 KB |
Output is correct |
28 |
Correct |
2 ms |
316 KB |
Output is correct |
29 |
Correct |
2 ms |
340 KB |
Output is correct |
30 |
Correct |
2 ms |
340 KB |
Output is correct |
31 |
Correct |
2 ms |
352 KB |
Output is correct |
32 |
Correct |
1 ms |
212 KB |
Output is correct |
33 |
Correct |
1 ms |
304 KB |
Output is correct |
34 |
Correct |
2 ms |
312 KB |
Output is correct |
35 |
Correct |
1 ms |
212 KB |
Output is correct |
36 |
Correct |
2 ms |
352 KB |
Output is correct |
37 |
Correct |
2 ms |
308 KB |
Output is correct |
38 |
Correct |
126 ms |
3088 KB |
Output is correct |
39 |
Correct |
122 ms |
3024 KB |
Output is correct |
40 |
Correct |
115 ms |
2944 KB |
Output is correct |
41 |
Correct |
130 ms |
3024 KB |
Output is correct |
42 |
Correct |
126 ms |
2948 KB |
Output is correct |
43 |
Correct |
125 ms |
3028 KB |
Output is correct |
44 |
Correct |
122 ms |
3072 KB |
Output is correct |
45 |
Correct |
125 ms |
3000 KB |
Output is correct |
46 |
Correct |
124 ms |
2940 KB |
Output is correct |
47 |
Correct |
110 ms |
2716 KB |
Output is correct |
48 |
Correct |
117 ms |
2792 KB |
Output is correct |
49 |
Correct |
101 ms |
2552 KB |
Output is correct |
50 |
Correct |
100 ms |
2556 KB |
Output is correct |
51 |
Correct |
132 ms |
3028 KB |
Output is correct |
52 |
Correct |
124 ms |
3028 KB |
Output is correct |
53 |
Correct |
127 ms |
3152 KB |
Output is correct |
54 |
Correct |
119 ms |
3000 KB |
Output is correct |
55 |
Correct |
123 ms |
3032 KB |
Output is correct |
56 |
Correct |
81 ms |
2244 KB |
Output is correct |
57 |
Correct |
44 ms |
1460 KB |
Output is correct |
58 |
Correct |
79 ms |
2148 KB |
Output is correct |
59 |
Correct |
80 ms |
2248 KB |
Output is correct |
60 |
Correct |
44 ms |
1996 KB |
Output is correct |
61 |
Correct |
71 ms |
3248 KB |
Output is correct |
62 |
Correct |
126 ms |
5456 KB |
Output is correct |
63 |
Correct |
125 ms |
5580 KB |
Output is correct |
64 |
Correct |
128 ms |
5440 KB |
Output is correct |
65 |
Correct |
132 ms |
5448 KB |
Output is correct |
66 |
Correct |
123 ms |
5440 KB |
Output is correct |
67 |
Correct |
126 ms |
5448 KB |
Output is correct |
68 |
Correct |
133 ms |
5448 KB |
Output is correct |
69 |
Correct |
129 ms |
5440 KB |
Output is correct |
70 |
Correct |
126 ms |
5440 KB |
Output is correct |
71 |
Correct |
123 ms |
5452 KB |
Output is correct |
72 |
Correct |
131 ms |
5452 KB |
Output is correct |
73 |
Correct |
128 ms |
5568 KB |
Output is correct |