Submission #336805

# Submission time Handle Problem Language Result Execution time Memory
336805 2020-12-16T21:31:23 Z crackersamdjam Exhibition (JOI19_ho_t2) C++17
100 / 100
78 ms 6284 KB
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define gc getchar()
#define pc(x) putchar(x)
template<typename T> void scan(T &x){x = 0;bool _=0;T c=gc;_=c==45;c=_?gc:c;while(c<48||c>57)c=gc;for(;c<48||c>57;c=gc);for(;c>47&&c<58;c=gc)x=(x<<3)+(x<<1)+(c&15);x=_?-x:x;}
template<typename T> void printn(T n){bool _=0;_=n<0;n=_?-n:n;char snum[65];int i=0;do{snum[i++]=char(n%10+48);n/= 10;}while(n);--i;if (_)pc(45);while(i>=0)pc(snum[i--]);}
template<typename First, typename ... Ints> void scan(First &arg, Ints&... rest){scan(arg);scan(rest...);}
template<typename T> void print(T n){printn(n);pc(10);}
template<typename First, typename ... Ints> void print(First arg, Ints... rest){printn(arg);pc(32);print(rest...);}

using namespace std;
const int MM = 1e5+5;

int n, m;
pair<int, int> a[MM];
int b[MM], ans;
multiset<int> st;

int main(){
	scan(n, m);
	for(int i = 0; i < n; i++)
		scan(a[i].second, a[i].first);
	sort(a, a+n);
	
	for(int i = 0; i < m; i++){
		scan(b[i]);
		st.insert(b[i]);
	}

	for(int i = n-1; i >= 0; i--){
		if(size(st) and a[i].second <= *--st.end()){
			st.erase(--st.end());
			ans++;
		}
	}
	print(ans);
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 0 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 268 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 0 ms 364 KB Output is correct
15 Correct 0 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 0 ms 364 KB Output is correct
18 Correct 1 ms 364 KB Output is correct
19 Correct 0 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 0 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 268 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 0 ms 364 KB Output is correct
15 Correct 0 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 0 ms 364 KB Output is correct
18 Correct 1 ms 364 KB Output is correct
19 Correct 0 ms 364 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
21 Correct 1 ms 364 KB Output is correct
22 Correct 1 ms 364 KB Output is correct
23 Correct 1 ms 364 KB Output is correct
24 Correct 1 ms 364 KB Output is correct
25 Correct 1 ms 364 KB Output is correct
26 Correct 1 ms 364 KB Output is correct
27 Correct 1 ms 364 KB Output is correct
28 Correct 1 ms 364 KB Output is correct
29 Correct 1 ms 364 KB Output is correct
30 Correct 1 ms 364 KB Output is correct
31 Correct 1 ms 364 KB Output is correct
32 Correct 1 ms 364 KB Output is correct
33 Correct 1 ms 364 KB Output is correct
34 Correct 1 ms 364 KB Output is correct
35 Correct 1 ms 364 KB Output is correct
36 Correct 1 ms 364 KB Output is correct
37 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 0 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 268 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 0 ms 364 KB Output is correct
15 Correct 0 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 0 ms 364 KB Output is correct
18 Correct 1 ms 364 KB Output is correct
19 Correct 0 ms 364 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
21 Correct 1 ms 364 KB Output is correct
22 Correct 1 ms 364 KB Output is correct
23 Correct 1 ms 364 KB Output is correct
24 Correct 1 ms 364 KB Output is correct
25 Correct 1 ms 364 KB Output is correct
26 Correct 1 ms 364 KB Output is correct
27 Correct 1 ms 364 KB Output is correct
28 Correct 1 ms 364 KB Output is correct
29 Correct 1 ms 364 KB Output is correct
30 Correct 1 ms 364 KB Output is correct
31 Correct 1 ms 364 KB Output is correct
32 Correct 1 ms 364 KB Output is correct
33 Correct 1 ms 364 KB Output is correct
34 Correct 1 ms 364 KB Output is correct
35 Correct 1 ms 364 KB Output is correct
36 Correct 1 ms 364 KB Output is correct
37 Correct 1 ms 364 KB Output is correct
38 Correct 62 ms 6252 KB Output is correct
39 Correct 78 ms 6124 KB Output is correct
40 Correct 47 ms 6124 KB Output is correct
41 Correct 76 ms 6252 KB Output is correct
42 Correct 64 ms 6124 KB Output is correct
43 Correct 58 ms 6284 KB Output is correct
44 Correct 59 ms 6252 KB Output is correct
45 Correct 63 ms 6144 KB Output is correct
46 Correct 59 ms 6148 KB Output is correct
47 Correct 48 ms 4716 KB Output is correct
48 Correct 45 ms 4716 KB Output is correct
49 Correct 55 ms 5996 KB Output is correct
50 Correct 57 ms 5916 KB Output is correct
51 Correct 61 ms 6124 KB Output is correct
52 Correct 64 ms 6124 KB Output is correct
53 Correct 58 ms 6124 KB Output is correct
54 Correct 43 ms 6124 KB Output is correct
55 Correct 63 ms 6252 KB Output is correct
56 Correct 18 ms 1132 KB Output is correct
57 Correct 57 ms 5356 KB Output is correct
58 Correct 18 ms 1132 KB Output is correct
59 Correct 18 ms 1132 KB Output is correct
60 Correct 41 ms 5356 KB Output is correct
61 Correct 50 ms 5612 KB Output is correct
62 Correct 61 ms 6124 KB Output is correct
63 Correct 60 ms 6124 KB Output is correct
64 Correct 61 ms 6124 KB Output is correct
65 Correct 60 ms 6124 KB Output is correct
66 Correct 60 ms 6124 KB Output is correct
67 Correct 59 ms 6124 KB Output is correct
68 Correct 61 ms 6124 KB Output is correct
69 Correct 62 ms 6212 KB Output is correct
70 Correct 63 ms 6124 KB Output is correct
71 Correct 60 ms 6124 KB Output is correct
72 Correct 60 ms 6124 KB Output is correct
73 Correct 55 ms 6124 KB Output is correct