Submission #258235

# Submission time Handle Problem Language Result Execution time Memory
258235 2020-08-05T15:08:56 Z AMO5 Exhibition (JOI19_ho_t2) C++17
100 / 100
93 ms 4568 KB
#include <bits/stdc++.h>

using namespace std;

#define fi first
#define se second
#define eb emplace_back
#define mt make_tuple
#define all(x) (x).begin(), (x).end()  
#define sz(x) int(x.size()) 
#define MOD 1000000007

typedef long long ll;
typedef pair <int, int> ii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef long double ld;

const ll INF=LLONG_MAX;
const int mxn=1e5+5;
bool DEBUG=0;

ii pic[mxn];
int dis[mxn];
int n,m;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
	cin >> n >> m;
	for(int i=0; i<n; i++){
		cin >> pic[i].se >> pic[i].fi;
	}
	for(int i=0; i<m; i++){
		cin >> dis[i];
	}
	sort(pic,pic+n);
	sort(dis,dis+m);
	int nn=n-1,mm=m-1;
	int ans = 0;
	while(nn>=0&&mm>=0){
		if(pic[nn].se<=dis[mm]){
			ans++;
			nn--;
			mm--;
		}else nn--;
	}
	cout << ans << '\n';
}
	
// READ & UNDERSTAND
// ll, int overflow, array bounds, memset(0)
// special cases (n=1?), n+1 (1-index)
// do smth instead of nothing & stay organized
// WRITE STUFF DOWN
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 0 ms 360 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 0 ms 384 KB Output is correct
13 Correct 0 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 1 ms 384 KB Output is correct
18 Correct 1 ms 384 KB Output is correct
19 Correct 1 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 0 ms 360 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 0 ms 384 KB Output is correct
13 Correct 0 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 1 ms 384 KB Output is correct
18 Correct 1 ms 384 KB Output is correct
19 Correct 1 ms 384 KB Output is correct
20 Correct 2 ms 384 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 2 ms 384 KB Output is correct
23 Correct 2 ms 384 KB Output is correct
24 Correct 2 ms 384 KB Output is correct
25 Correct 2 ms 416 KB Output is correct
26 Correct 2 ms 384 KB Output is correct
27 Correct 2 ms 384 KB Output is correct
28 Correct 1 ms 384 KB Output is correct
29 Correct 1 ms 384 KB Output is correct
30 Correct 1 ms 384 KB Output is correct
31 Correct 1 ms 384 KB Output is correct
32 Correct 1 ms 384 KB Output is correct
33 Correct 1 ms 384 KB Output is correct
34 Correct 1 ms 384 KB Output is correct
35 Correct 1 ms 384 KB Output is correct
36 Correct 1 ms 384 KB Output is correct
37 Correct 2 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 0 ms 360 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 0 ms 384 KB Output is correct
13 Correct 0 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 1 ms 384 KB Output is correct
18 Correct 1 ms 384 KB Output is correct
19 Correct 1 ms 384 KB Output is correct
20 Correct 2 ms 384 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 2 ms 384 KB Output is correct
23 Correct 2 ms 384 KB Output is correct
24 Correct 2 ms 384 KB Output is correct
25 Correct 2 ms 416 KB Output is correct
26 Correct 2 ms 384 KB Output is correct
27 Correct 2 ms 384 KB Output is correct
28 Correct 1 ms 384 KB Output is correct
29 Correct 1 ms 384 KB Output is correct
30 Correct 1 ms 384 KB Output is correct
31 Correct 1 ms 384 KB Output is correct
32 Correct 1 ms 384 KB Output is correct
33 Correct 1 ms 384 KB Output is correct
34 Correct 1 ms 384 KB Output is correct
35 Correct 1 ms 384 KB Output is correct
36 Correct 1 ms 384 KB Output is correct
37 Correct 2 ms 384 KB Output is correct
38 Correct 58 ms 4480 KB Output is correct
39 Correct 55 ms 4344 KB Output is correct
40 Correct 79 ms 4472 KB Output is correct
41 Correct 63 ms 4472 KB Output is correct
42 Correct 69 ms 4368 KB Output is correct
43 Correct 63 ms 4476 KB Output is correct
44 Correct 92 ms 4472 KB Output is correct
45 Correct 59 ms 4344 KB Output is correct
46 Correct 58 ms 4344 KB Output is correct
47 Correct 60 ms 3992 KB Output is correct
48 Correct 49 ms 3968 KB Output is correct
49 Correct 48 ms 3576 KB Output is correct
50 Correct 46 ms 3576 KB Output is correct
51 Correct 60 ms 4472 KB Output is correct
52 Correct 57 ms 4472 KB Output is correct
53 Correct 55 ms 4344 KB Output is correct
54 Correct 51 ms 4472 KB Output is correct
55 Correct 60 ms 4500 KB Output is correct
56 Correct 36 ms 3068 KB Output is correct
57 Correct 22 ms 1664 KB Output is correct
58 Correct 37 ms 3072 KB Output is correct
59 Correct 36 ms 3064 KB Output is correct
60 Correct 34 ms 1664 KB Output is correct
61 Correct 35 ms 2680 KB Output is correct
62 Correct 85 ms 4472 KB Output is correct
63 Correct 58 ms 4472 KB Output is correct
64 Correct 93 ms 4472 KB Output is correct
65 Correct 59 ms 4412 KB Output is correct
66 Correct 90 ms 4472 KB Output is correct
67 Correct 67 ms 4472 KB Output is correct
68 Correct 62 ms 4568 KB Output is correct
69 Correct 60 ms 4344 KB Output is correct
70 Correct 84 ms 4480 KB Output is correct
71 Correct 58 ms 4472 KB Output is correct
72 Correct 59 ms 4472 KB Output is correct
73 Correct 55 ms 4472 KB Output is correct