Submission #317952

# Submission time Handle Problem Language Result Execution time Memory
317952 2020-10-31T02:21:28 Z kym Exhibition (JOI19_ho_t2) C++14
100 / 100
153 ms 17396 KB
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
using namespace std;
#define int ll
#define FOR(i,s,e) for(ll i = s; i <= (ll)e; ++i)
#define DEC(i,s,e) for(ll i = s; i >= (ll)e; --i)
#define IAMSPEED ios_base::sync_with_stdio(false); cin.tie(0);
#define db(x) cerr << #x << "=" << x << "\n"
#define db2(x, y) cerr << #x << "=" << x << " , " << #y << "=" << y << "\n"
#define db3(a,b,c) cerr<<#a<<"="<<a<<","<<#b<<"="<<b<<","<<#c<<"="<<c<<"\n"
#define dbv(v) cerr << #v << ":"; for (auto ite : v) cerr << ite << ' '; cerr <<"\n"
#define dbvp(v) cerr << #v << ":"; for (auto ite : v) cerr << "{"  << ite.f << ',' << ite.s << "} "; cerr << "\n"
#define dba(a,ss,ee) cerr << #a << ":"; FOR(ite,ss,ee) cerr << a[ite] << ' '; cerr << "\n"
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define ll long long 
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define f first
#define s second
#define reach cerr << "LINE: " << __LINE__ << "\n";
typedef pair <ll, ll> pi;
typedef tuple<ll,ll,ll> ti3;
string cts(char x) {string t(1,x); return t;}
ll rand(ll a, ll b) { return a + rng() % (b-a+1); }
const int MOD = 1e9 + 7;
const int inf = (int)1e9 + 500;
const long long oo = (ll)1e18 + 500;
template <typename T> void chmax(T& a, T b) { a = max(a, b); }
template <typename T> void chmin(T& a, T b) { a = min(a, b); }
const int MAXN = 100005;
#ifndef LOCAL
#define cerr if(0)cout
#endif
vector<pi>V[MAXN];
int32_t main() 
{
	IAMSPEED
	int n,m; cin >> n >> m;
	vector<pi>v;
	FOR(i,1,n) {
		int a,b; cin >> a >> b;
		v.pb(pi(a,b));
	}
	vector<int> frames;
	FOR(i,1,m) {
		int x; cin >> x;
		frames.pb(x);
	}
	sort(all(frames));
	sort(all(v));
	priority_queue<int>pq;
	int idx=0;
	multiset<pi,greater<pi>>ms;
	FOR(i,0,frames.size()-1) {
		int sz=frames[i];
		while(idx<(int)v.size()&&v[idx].f<=sz){
			V[i].pb(pi(v[idx].s,v[idx].f));
			ms.insert(pi(v[idx].s,v[idx].f));
			++idx;
			
		}
	}
	int ans = 0;
	DEC(i,frames.size()-1,0) {
		if(ms.size()){
			++ans;
			ms.erase(ms.begin());
		}
		for(auto vv:V[i])if(ms.find(vv)!=ms.end())ms.erase(vv);
		
	}
	cout<<ans;
}

# Verdict Execution time Memory Grader output
1 Correct 2 ms 2688 KB Output is correct
2 Correct 2 ms 2688 KB Output is correct
3 Correct 3 ms 2688 KB Output is correct
4 Correct 2 ms 2688 KB Output is correct
5 Correct 2 ms 2688 KB Output is correct
6 Correct 2 ms 2688 KB Output is correct
7 Correct 2 ms 2688 KB Output is correct
8 Correct 2 ms 2688 KB Output is correct
9 Correct 2 ms 2688 KB Output is correct
10 Correct 2 ms 2688 KB Output is correct
11 Correct 2 ms 2688 KB Output is correct
12 Correct 2 ms 2688 KB Output is correct
13 Correct 2 ms 2688 KB Output is correct
14 Correct 2 ms 2688 KB Output is correct
15 Correct 2 ms 2688 KB Output is correct
16 Correct 2 ms 2688 KB Output is correct
17 Correct 3 ms 2816 KB Output is correct
18 Correct 2 ms 2688 KB Output is correct
19 Correct 2 ms 2688 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2688 KB Output is correct
2 Correct 2 ms 2688 KB Output is correct
3 Correct 3 ms 2688 KB Output is correct
4 Correct 2 ms 2688 KB Output is correct
5 Correct 2 ms 2688 KB Output is correct
6 Correct 2 ms 2688 KB Output is correct
7 Correct 2 ms 2688 KB Output is correct
8 Correct 2 ms 2688 KB Output is correct
9 Correct 2 ms 2688 KB Output is correct
10 Correct 2 ms 2688 KB Output is correct
11 Correct 2 ms 2688 KB Output is correct
12 Correct 2 ms 2688 KB Output is correct
13 Correct 2 ms 2688 KB Output is correct
14 Correct 2 ms 2688 KB Output is correct
15 Correct 2 ms 2688 KB Output is correct
16 Correct 2 ms 2688 KB Output is correct
17 Correct 3 ms 2816 KB Output is correct
18 Correct 2 ms 2688 KB Output is correct
19 Correct 2 ms 2688 KB Output is correct
20 Correct 3 ms 2816 KB Output is correct
21 Correct 3 ms 2816 KB Output is correct
22 Correct 3 ms 2688 KB Output is correct
23 Correct 2 ms 2688 KB Output is correct
24 Correct 3 ms 2816 KB Output is correct
25 Correct 3 ms 2816 KB Output is correct
26 Correct 3 ms 2816 KB Output is correct
27 Correct 3 ms 2688 KB Output is correct
28 Correct 3 ms 2816 KB Output is correct
29 Correct 3 ms 2816 KB Output is correct
30 Correct 3 ms 2816 KB Output is correct
31 Correct 4 ms 2816 KB Output is correct
32 Correct 2 ms 2688 KB Output is correct
33 Correct 2 ms 2688 KB Output is correct
34 Correct 3 ms 2816 KB Output is correct
35 Correct 2 ms 2688 KB Output is correct
36 Correct 3 ms 2816 KB Output is correct
37 Correct 3 ms 2816 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2688 KB Output is correct
2 Correct 2 ms 2688 KB Output is correct
3 Correct 3 ms 2688 KB Output is correct
4 Correct 2 ms 2688 KB Output is correct
5 Correct 2 ms 2688 KB Output is correct
6 Correct 2 ms 2688 KB Output is correct
7 Correct 2 ms 2688 KB Output is correct
8 Correct 2 ms 2688 KB Output is correct
9 Correct 2 ms 2688 KB Output is correct
10 Correct 2 ms 2688 KB Output is correct
11 Correct 2 ms 2688 KB Output is correct
12 Correct 2 ms 2688 KB Output is correct
13 Correct 2 ms 2688 KB Output is correct
14 Correct 2 ms 2688 KB Output is correct
15 Correct 2 ms 2688 KB Output is correct
16 Correct 2 ms 2688 KB Output is correct
17 Correct 3 ms 2816 KB Output is correct
18 Correct 2 ms 2688 KB Output is correct
19 Correct 2 ms 2688 KB Output is correct
20 Correct 3 ms 2816 KB Output is correct
21 Correct 3 ms 2816 KB Output is correct
22 Correct 3 ms 2688 KB Output is correct
23 Correct 2 ms 2688 KB Output is correct
24 Correct 3 ms 2816 KB Output is correct
25 Correct 3 ms 2816 KB Output is correct
26 Correct 3 ms 2816 KB Output is correct
27 Correct 3 ms 2688 KB Output is correct
28 Correct 3 ms 2816 KB Output is correct
29 Correct 3 ms 2816 KB Output is correct
30 Correct 3 ms 2816 KB Output is correct
31 Correct 4 ms 2816 KB Output is correct
32 Correct 2 ms 2688 KB Output is correct
33 Correct 2 ms 2688 KB Output is correct
34 Correct 3 ms 2816 KB Output is correct
35 Correct 2 ms 2688 KB Output is correct
36 Correct 3 ms 2816 KB Output is correct
37 Correct 3 ms 2816 KB Output is correct
38 Correct 97 ms 17396 KB Output is correct
39 Correct 84 ms 16232 KB Output is correct
40 Correct 76 ms 15848 KB Output is correct
41 Correct 93 ms 16264 KB Output is correct
42 Correct 57 ms 9064 KB Output is correct
43 Correct 58 ms 8940 KB Output is correct
44 Correct 96 ms 17384 KB Output is correct
45 Correct 126 ms 16616 KB Output is correct
46 Correct 96 ms 14812 KB Output is correct
47 Correct 138 ms 16172 KB Output is correct
48 Correct 103 ms 15080 KB Output is correct
49 Correct 91 ms 13032 KB Output is correct
50 Correct 74 ms 12864 KB Output is correct
51 Correct 58 ms 8924 KB Output is correct
52 Correct 56 ms 8936 KB Output is correct
53 Correct 58 ms 8716 KB Output is correct
54 Correct 78 ms 15720 KB Output is correct
55 Correct 91 ms 16760 KB Output is correct
56 Correct 85 ms 10216 KB Output is correct
57 Correct 24 ms 4732 KB Output is correct
58 Correct 61 ms 14052 KB Output is correct
59 Correct 125 ms 14824 KB Output is correct
60 Correct 25 ms 4740 KB Output is correct
61 Correct 53 ms 8944 KB Output is correct
62 Correct 153 ms 16740 KB Output is correct
63 Correct 148 ms 16744 KB Output is correct
64 Correct 153 ms 16744 KB Output is correct
65 Correct 145 ms 16744 KB Output is correct
66 Correct 143 ms 16744 KB Output is correct
67 Correct 146 ms 16688 KB Output is correct
68 Correct 152 ms 16756 KB Output is correct
69 Correct 144 ms 16748 KB Output is correct
70 Correct 150 ms 16744 KB Output is correct
71 Correct 139 ms 16488 KB Output is correct
72 Correct 114 ms 16488 KB Output is correct
73 Correct 100 ms 15848 KB Output is correct