Submission #951792

# Submission time Handle Problem Language Result Execution time Memory
951792 2024-03-22T16:10:33 Z SmuggingSpun Exhibition (JOI19_ho_t2) C++14
100 / 100
46 ms 4676 KB
#include<bits/stdc++.h>
#define taskname "exhibition"
using namespace std;
int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	if(fopen(taskname".inp", "r")){
		freopen(taskname".inp", "r", stdin);
	}
	int n, m;
	cin >> n >> m;
	vector<pair<int, int>>a(n);
	for(auto& [x, y] : a){
		cin >> x >> y;
	}
	sort(a.begin(), a.end(), [&] (auto i, auto j) -> bool{
		return i.second < j.second || (i.second == j.second && i.first < j.first);
	});
	vector<int>c(m);
	for(int& x : c){
		cin >> x;
	}
	sort(c.begin(), c.end(), greater<int>());
	int low = 1, high = m, ans = 0;
	while(low <= high){
		int mid = (low + high) >> 1;
		for(int i = mid - 1, p = 0; i > -1; i--){
			while(p < n && a[p].first > c[i]){
				p++;
			}
			if(p++ == n){
				high = mid - 1;
				break;
			}
		}	
		if(high != mid - 1){
			low = (ans = mid) + 1;
		}
	}
	cout << ans;
}

Compilation message

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:12:12: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   12 |  for(auto& [x, y] : a){
      |            ^
joi2019_ho_t2.cpp:7:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |   freopen(taskname".inp", "r", stdin);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 452 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 452 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 452 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 452 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 1 ms 344 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 1 ms 460 KB Output is correct
28 Correct 1 ms 344 KB Output is correct
29 Correct 1 ms 344 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 1 ms 348 KB Output is correct
32 Correct 0 ms 468 KB Output is correct
33 Correct 1 ms 348 KB Output is correct
34 Correct 1 ms 348 KB Output is correct
35 Correct 0 ms 348 KB Output is correct
36 Correct 1 ms 344 KB Output is correct
37 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 452 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 452 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 1 ms 344 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 1 ms 460 KB Output is correct
28 Correct 1 ms 344 KB Output is correct
29 Correct 1 ms 344 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 1 ms 348 KB Output is correct
32 Correct 0 ms 468 KB Output is correct
33 Correct 1 ms 348 KB Output is correct
34 Correct 1 ms 348 KB Output is correct
35 Correct 0 ms 348 KB Output is correct
36 Correct 1 ms 344 KB Output is correct
37 Correct 1 ms 348 KB Output is correct
38 Correct 37 ms 4440 KB Output is correct
39 Correct 37 ms 4444 KB Output is correct
40 Correct 32 ms 4304 KB Output is correct
41 Correct 37 ms 4640 KB Output is correct
42 Correct 36 ms 4436 KB Output is correct
43 Correct 36 ms 4444 KB Output is correct
44 Correct 37 ms 4436 KB Output is correct
45 Correct 38 ms 4308 KB Output is correct
46 Correct 37 ms 4436 KB Output is correct
47 Correct 36 ms 3920 KB Output is correct
48 Correct 33 ms 3932 KB Output is correct
49 Correct 31 ms 3560 KB Output is correct
50 Correct 30 ms 3552 KB Output is correct
51 Correct 38 ms 4288 KB Output is correct
52 Correct 38 ms 4432 KB Output is correct
53 Correct 37 ms 4300 KB Output is correct
54 Correct 31 ms 4432 KB Output is correct
55 Correct 37 ms 4436 KB Output is correct
56 Correct 24 ms 3152 KB Output is correct
57 Correct 14 ms 1628 KB Output is correct
58 Correct 22 ms 2908 KB Output is correct
59 Correct 24 ms 3160 KB Output is correct
60 Correct 14 ms 1628 KB Output is correct
61 Correct 23 ms 2652 KB Output is correct
62 Correct 43 ms 4436 KB Output is correct
63 Correct 42 ms 4432 KB Output is correct
64 Correct 43 ms 4308 KB Output is correct
65 Correct 42 ms 4436 KB Output is correct
66 Correct 42 ms 4440 KB Output is correct
67 Correct 43 ms 4312 KB Output is correct
68 Correct 43 ms 4424 KB Output is correct
69 Correct 43 ms 4436 KB Output is correct
70 Correct 46 ms 4440 KB Output is correct
71 Correct 46 ms 4676 KB Output is correct
72 Correct 38 ms 4308 KB Output is correct
73 Correct 40 ms 4432 KB Output is correct