Submission #507639

# Submission time Handle Problem Language Result Execution time Memory
507639 2022-01-12T21:36:57 Z Evirir Exhibition (JOI19_ho_t2) C++17
100 / 100
134 ms 11860 KB
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
// using namespace __gnu_pbds;

#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2")
#define watch(x) cout << (#x) << "=" << (x) << '\n'
#define mset(d, val) memset(d, val, sizeof(d))
#define cbug   \
	if (DEBUG) \
	cout
#define setp(x) cout << fixed << setprecision(x)
#define sz(x) (int)(x).size()
#define all(x) begin(x), end(x)
#define forn(i, a, b) for (int i = (a); i < (b); i++)
#define fore(i, a, b) for (int i = (a); i <= (b); i++)
#define pb push_back
#define F first
#define S second
#define fbo find_by_order
#define ook order_of_key
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
// template<typename T>
// using pbds = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
void SD(int t = 0) { cout << "PASSED " << t << endl; }
ostream &operator<<(ostream &out, ii x)
{
	out << "(" << x.F << "," << x.S << ")";
	return out;
}
const ll INF = ll(1e18);
const int MOD = 998244353;

const bool DEBUG = 0;
const int MAXN = 100005;
const int LG = 21;

int n, m;
ii pic[MAXN];
ll f[MAXN];

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);

	cin >> n >> m;
	forn(i, 0, n) cin >> pic[i].F >> pic[i].S;
	forn(i, 0, m) cin >> f[i];

	sort(pic, pic+n);
	sort(f, f+m);

	set<ii> s;
	forn(i,0,n) s.insert({pic[i].S,i});
	int p=n-1;
	int ans=0;

	for(int i=m-1;i>=0;i--)
	{
		while(p>=0 && pic[p].F>f[i])
		{
			auto ptr = s.find({pic[p].S,p});
			if(ptr!=s.end()) s.erase(ptr);
			p--;
		}
		if(s.empty()) break;
		ans++;
		s.erase(--s.end());
	}

	cout<<ans<<'\n';

	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 332 KB Output is correct
8 Correct 0 ms 332 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 0 ms 320 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 1 ms 320 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 1 ms 316 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 332 KB Output is correct
8 Correct 0 ms 332 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 0 ms 320 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 1 ms 320 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 1 ms 316 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 2 ms 332 KB Output is correct
21 Correct 1 ms 324 KB Output is correct
22 Correct 1 ms 332 KB Output is correct
23 Correct 1 ms 332 KB Output is correct
24 Correct 1 ms 332 KB Output is correct
25 Correct 1 ms 332 KB Output is correct
26 Correct 1 ms 332 KB Output is correct
27 Correct 2 ms 460 KB Output is correct
28 Correct 1 ms 328 KB Output is correct
29 Correct 2 ms 332 KB Output is correct
30 Correct 1 ms 332 KB Output is correct
31 Correct 1 ms 328 KB Output is correct
32 Correct 1 ms 336 KB Output is correct
33 Correct 1 ms 332 KB Output is correct
34 Correct 1 ms 332 KB Output is correct
35 Correct 1 ms 332 KB Output is correct
36 Correct 2 ms 332 KB Output is correct
37 Correct 1 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 332 KB Output is correct
8 Correct 0 ms 332 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 0 ms 320 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 1 ms 320 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 1 ms 316 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 2 ms 332 KB Output is correct
21 Correct 1 ms 324 KB Output is correct
22 Correct 1 ms 332 KB Output is correct
23 Correct 1 ms 332 KB Output is correct
24 Correct 1 ms 332 KB Output is correct
25 Correct 1 ms 332 KB Output is correct
26 Correct 1 ms 332 KB Output is correct
27 Correct 2 ms 460 KB Output is correct
28 Correct 1 ms 328 KB Output is correct
29 Correct 2 ms 332 KB Output is correct
30 Correct 1 ms 332 KB Output is correct
31 Correct 1 ms 328 KB Output is correct
32 Correct 1 ms 336 KB Output is correct
33 Correct 1 ms 332 KB Output is correct
34 Correct 1 ms 332 KB Output is correct
35 Correct 1 ms 332 KB Output is correct
36 Correct 2 ms 332 KB Output is correct
37 Correct 1 ms 332 KB Output is correct
38 Correct 73 ms 11812 KB Output is correct
39 Correct 68 ms 11708 KB Output is correct
40 Correct 62 ms 11716 KB Output is correct
41 Correct 72 ms 11708 KB Output is correct
42 Correct 76 ms 11708 KB Output is correct
43 Correct 69 ms 11720 KB Output is correct
44 Correct 66 ms 11704 KB Output is correct
45 Correct 75 ms 11684 KB Output is correct
46 Correct 89 ms 11700 KB Output is correct
47 Correct 80 ms 11256 KB Output is correct
48 Correct 71 ms 11324 KB Output is correct
49 Correct 55 ms 8800 KB Output is correct
50 Correct 51 ms 8828 KB Output is correct
51 Correct 129 ms 11716 KB Output is correct
52 Correct 134 ms 11716 KB Output is correct
53 Correct 91 ms 11856 KB Output is correct
54 Correct 62 ms 11748 KB Output is correct
55 Correct 94 ms 11736 KB Output is correct
56 Correct 67 ms 9968 KB Output is correct
57 Correct 17 ms 1936 KB Output is correct
58 Correct 49 ms 10160 KB Output is correct
59 Correct 75 ms 10048 KB Output is correct
60 Correct 17 ms 2048 KB Output is correct
61 Correct 34 ms 5356 KB Output is correct
62 Correct 84 ms 11804 KB Output is correct
63 Correct 84 ms 11684 KB Output is correct
64 Correct 82 ms 11732 KB Output is correct
65 Correct 79 ms 11716 KB Output is correct
66 Correct 80 ms 11800 KB Output is correct
67 Correct 87 ms 11772 KB Output is correct
68 Correct 79 ms 11772 KB Output is correct
69 Correct 81 ms 11716 KB Output is correct
70 Correct 85 ms 11764 KB Output is correct
71 Correct 91 ms 11860 KB Output is correct
72 Correct 69 ms 11796 KB Output is correct
73 Correct 63 ms 11744 KB Output is correct