Submission #562504

# Submission time Handle Problem Language Result Execution time Memory
562504 2022-05-14T13:57:01 Z dattranxxx Exhibition (JOI19_ho_t2) C++11
100 / 100
51 ms 4428 KB
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
void file() {
	const string FILE_NAME = "FILE_NAME";
	freopen((FILE_NAME + ".inp").c_str(), "r", stdin);
	freopen((FILE_NAME + ".out").c_str(), "w", stdout);
}
const int N = 1e5 + 5;
pair<int, int> a[N];
int b[N];
int n, m;
int check(int k) {
	for (int i = m-k, j = 0; i < m; ++i, ++j) {
		while (j < n && a[j].second > b[i]) j++;
		if (j == n) return 0;
	}
	return 1;
		
}
int main() {
	cin.tie(0)->sync_with_stdio(0); cout.tie(0);
	cin >> n >> m;
	for (int i = 0; i < n; ++i)
		cin >> a[i].second >> a[i].first;
	for (int i = 0; i < m; ++i)
		cin >> b[i];
	sort(a, a + n);
	sort(b, b + m);
	int lo = 0, hi = min(n, m), mid, ans = 0;
	while (lo <= hi) {
		mid = (lo + hi) >> 1;
		if (check(mid))
			ans = mid,
			lo = mid + 1;
		else
			hi = mid - 1;
	}
	cout << ans;
	return 0;
}

Compilation message

joi2019_ho_t2.cpp: In function 'void file()':
joi2019_ho_t2.cpp:6:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    6 |  freopen((FILE_NAME + ".inp").c_str(), "r", stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:7:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |  freopen((FILE_NAME + ".out").c_str(), "w", stdout);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 0 ms 332 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 340 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 0 ms 332 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 340 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 368 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 352 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 344 KB Output is correct
34 Correct 1 ms 348 KB Output is correct
35 Correct 1 ms 340 KB Output is correct
36 Correct 1 ms 340 KB Output is correct
37 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 0 ms 332 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 340 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 368 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 352 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 344 KB Output is correct
34 Correct 1 ms 348 KB Output is correct
35 Correct 1 ms 340 KB Output is correct
36 Correct 1 ms 340 KB Output is correct
37 Correct 1 ms 340 KB Output is correct
38 Correct 45 ms 4268 KB Output is correct
39 Correct 42 ms 4372 KB Output is correct
40 Correct 41 ms 4292 KB Output is correct
41 Correct 49 ms 4300 KB Output is correct
42 Correct 45 ms 4304 KB Output is correct
43 Correct 48 ms 4280 KB Output is correct
44 Correct 45 ms 4384 KB Output is correct
45 Correct 50 ms 4288 KB Output is correct
46 Correct 44 ms 4304 KB Output is correct
47 Correct 42 ms 3916 KB Output is correct
48 Correct 39 ms 3908 KB Output is correct
49 Correct 37 ms 3556 KB Output is correct
50 Correct 37 ms 3532 KB Output is correct
51 Correct 45 ms 4268 KB Output is correct
52 Correct 45 ms 4392 KB Output is correct
53 Correct 45 ms 4268 KB Output is correct
54 Correct 39 ms 4380 KB Output is correct
55 Correct 49 ms 4316 KB Output is correct
56 Correct 26 ms 3020 KB Output is correct
57 Correct 16 ms 1620 KB Output is correct
58 Correct 27 ms 2988 KB Output is correct
59 Correct 31 ms 3108 KB Output is correct
60 Correct 18 ms 1748 KB Output is correct
61 Correct 28 ms 2512 KB Output is correct
62 Correct 49 ms 4384 KB Output is correct
63 Correct 51 ms 4272 KB Output is correct
64 Correct 49 ms 4300 KB Output is correct
65 Correct 50 ms 4332 KB Output is correct
66 Correct 50 ms 4340 KB Output is correct
67 Correct 49 ms 4388 KB Output is correct
68 Correct 49 ms 4388 KB Output is correct
69 Correct 51 ms 4428 KB Output is correct
70 Correct 50 ms 4300 KB Output is correct
71 Correct 48 ms 4384 KB Output is correct
72 Correct 49 ms 4340 KB Output is correct
73 Correct 48 ms 4300 KB Output is correct