Submission #121080

# Submission time Handle Problem Language Result Execution time Memory
121080 2019-06-26T05:12:41 Z 윤교준(#2970) Exhibition (JOI19_ho_t2) C++14
100 / 100
67 ms 2448 KB
#include <bits/stdc++.h>
#define eb emplace_back
#define sz(V) ((int)(V).size())
#define allv(V) ((V).begin()),((V).end())
#define sorv(V) sort(allv(V))
#define univ(V) (V).erase(unique(allv(V)),(V).end())
#define revv(V) reverse(allv(V))
#define upmin(a,b) (a)=min((a),(b))
#define upmax(a,b) (a)=max((a),(b))
#define INF (0x3f3f3f3f)
using namespace std;
typedef pair<int, int> pii;

const int MAXN = 100055;
const int MAXM = 100055;

vector<int> AnsV;
int DC[MAXN], DI[MAXN];

int A[MAXN], B[MAXN];
int C[MAXM];

int N, M, Ans;

int main() {
	ios::sync_with_stdio(false);

	cin >> N >> M;
	{
		vector<pii> V;
		for(int i = 0, a, b; i < N; i++) {
			cin >> a >> b;
			V.eb(b, a);
		}
		sorv(V);
		for(int i = 1; i <= N; i++)
			tie(B[i], A[i]) = V[i-1];
	}
	for(int i = 1; i <= M; i++) cin >> C[i];
	sort(C+1, C+M+1);

	vector<int> V;

	for(int i = 1, j, k; i <= N; i++) {
		if(C[M] < A[i]) continue;
		j = int(lower_bound(C+1, C+M+1, A[i]) - C);
		A[i] = C[j];
		V.eb(j);
	}

	revv(V);
	int h = M;
	for(int v : V) {
		if(v <= h) {
			Ans++;
			h--;
		}
	}

	cout << Ans << endl;
	return 0;
}

Compilation message

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:44:20: warning: unused variable 'k' [-Wunused-variable]
  for(int i = 1, j, k; i <= N; i++) {
                    ^
# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 2 ms 384 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 2 ms 384 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 3 ms 384 KB Output is correct
21 Correct 2 ms 428 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 384 KB Output is correct
26 Correct 3 ms 384 KB Output is correct
27 Correct 2 ms 384 KB Output is correct
28 Correct 2 ms 384 KB Output is correct
29 Correct 3 ms 384 KB Output is correct
30 Correct 2 ms 384 KB Output is correct
31 Correct 2 ms 384 KB Output is correct
32 Correct 2 ms 384 KB Output is correct
33 Correct 2 ms 384 KB Output is correct
34 Correct 2 ms 384 KB Output is correct
35 Correct 2 ms 384 KB Output is correct
36 Correct 2 ms 384 KB Output is correct
37 Correct 2 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 2 ms 384 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 3 ms 384 KB Output is correct
21 Correct 2 ms 428 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 384 KB Output is correct
26 Correct 3 ms 384 KB Output is correct
27 Correct 2 ms 384 KB Output is correct
28 Correct 2 ms 384 KB Output is correct
29 Correct 3 ms 384 KB Output is correct
30 Correct 2 ms 384 KB Output is correct
31 Correct 2 ms 384 KB Output is correct
32 Correct 2 ms 384 KB Output is correct
33 Correct 2 ms 384 KB Output is correct
34 Correct 2 ms 384 KB Output is correct
35 Correct 2 ms 384 KB Output is correct
36 Correct 2 ms 384 KB Output is correct
37 Correct 2 ms 384 KB Output is correct
38 Correct 57 ms 2380 KB Output is correct
39 Correct 52 ms 2396 KB Output is correct
40 Correct 53 ms 2384 KB Output is correct
41 Correct 59 ms 2384 KB Output is correct
42 Correct 52 ms 2160 KB Output is correct
43 Correct 52 ms 2040 KB Output is correct
44 Correct 61 ms 2384 KB Output is correct
45 Correct 63 ms 2384 KB Output is correct
46 Correct 54 ms 2384 KB Output is correct
47 Correct 57 ms 2404 KB Output is correct
48 Correct 51 ms 2392 KB Output is correct
49 Correct 50 ms 2124 KB Output is correct
50 Correct 46 ms 2108 KB Output is correct
51 Correct 52 ms 2028 KB Output is correct
52 Correct 54 ms 2032 KB Output is correct
53 Correct 53 ms 2032 KB Output is correct
54 Correct 48 ms 2400 KB Output is correct
55 Correct 58 ms 2384 KB Output is correct
56 Correct 34 ms 2032 KB Output is correct
57 Correct 20 ms 768 KB Output is correct
58 Correct 35 ms 2160 KB Output is correct
59 Correct 41 ms 2016 KB Output is correct
60 Correct 22 ms 768 KB Output is correct
61 Correct 35 ms 1388 KB Output is correct
62 Correct 65 ms 2384 KB Output is correct
63 Correct 64 ms 2448 KB Output is correct
64 Correct 66 ms 2384 KB Output is correct
65 Correct 65 ms 2384 KB Output is correct
66 Correct 64 ms 2384 KB Output is correct
67 Correct 65 ms 2384 KB Output is correct
68 Correct 65 ms 2388 KB Output is correct
69 Correct 65 ms 2384 KB Output is correct
70 Correct 67 ms 2384 KB Output is correct
71 Correct 62 ms 2384 KB Output is correct
72 Correct 60 ms 2384 KB Output is correct
73 Correct 57 ms 2396 KB Output is correct