Submission #120139

# Submission time Handle Problem Language Result Execution time Memory
120139 2019-06-23T14:23:10 Z antimirage Exhibition (JOI19_ho_t2) C++14
100 / 100
124 ms 6108 KB
/**
	GOT A FEELING THAT I"M GOING UNDER
**/
#include <bits/stdc++.h>

#define fr first
#define sc second
#define mk make_pair
#define pb push_back
#define all(s) s.begin(), s.end()

using namespace std;

const int N = 1e5 + 5;

int n, m, x, y, c[N], ans, last = 1e9 + 7;

multiset < pair <int, int>, greater < pair <int, int> > > st;

main(){
	cin >> n >> m;
	
	for (int i = 1; i <= n; i++) {
		scanf("%d%d", &x, &y);
		st.insert( mk( y, x ) );
	}
	for (int i = 1; i <= m; i++) {
		scanf("%d", &c[i]);
	}
	sort(c + 1, c + m + 1);
	
	for (int i = m; i >= 1; i--) {
		
		while (!st.empty() && st.begin()->sc > c[i])
			st.erase(st.begin());
		
		if (st.empty()) break;
	
		st.erase(st.begin());
		ans++;
	}
	cout << ans << endl;
}

Compilation message

joi2019_ho_t2.cpp:20:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:24:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d", &x, &y);
   ~~~~~^~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:28:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &c[i]);
   ~~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 256 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 256 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 2 ms 384 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 256 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 256 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 384 KB Output is correct
22 Correct 2 ms 384 KB Output is correct
23 Correct 3 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 3 ms 384 KB Output is correct
28 Correct 4 ms 384 KB Output is correct
29 Correct 3 ms 384 KB Output is correct
30 Correct 3 ms 384 KB Output is correct
31 Correct 3 ms 384 KB Output is correct
32 Correct 3 ms 356 KB Output is correct
33 Correct 2 ms 384 KB Output is correct
34 Correct 3 ms 384 KB Output is correct
35 Correct 2 ms 256 KB Output is correct
36 Correct 3 ms 384 KB Output is correct
37 Correct 3 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 256 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 256 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 384 KB Output is correct
22 Correct 2 ms 384 KB Output is correct
23 Correct 3 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 3 ms 384 KB Output is correct
28 Correct 4 ms 384 KB Output is correct
29 Correct 3 ms 384 KB Output is correct
30 Correct 3 ms 384 KB Output is correct
31 Correct 3 ms 384 KB Output is correct
32 Correct 3 ms 356 KB Output is correct
33 Correct 2 ms 384 KB Output is correct
34 Correct 3 ms 384 KB Output is correct
35 Correct 2 ms 256 KB Output is correct
36 Correct 3 ms 384 KB Output is correct
37 Correct 3 ms 384 KB Output is correct
38 Correct 111 ms 5880 KB Output is correct
39 Correct 113 ms 5852 KB Output is correct
40 Correct 109 ms 5840 KB Output is correct
41 Correct 121 ms 6036 KB Output is correct
42 Correct 122 ms 5880 KB Output is correct
43 Correct 119 ms 5880 KB Output is correct
44 Correct 120 ms 5880 KB Output is correct
45 Correct 110 ms 5880 KB Output is correct
46 Correct 105 ms 5880 KB Output is correct
47 Correct 109 ms 5884 KB Output is correct
48 Correct 105 ms 5840 KB Output is correct
49 Correct 91 ms 4600 KB Output is correct
50 Correct 73 ms 4644 KB Output is correct
51 Correct 108 ms 5880 KB Output is correct
52 Correct 109 ms 5880 KB Output is correct
53 Correct 124 ms 6108 KB Output is correct
54 Correct 102 ms 5936 KB Output is correct
55 Correct 107 ms 5948 KB Output is correct
56 Correct 80 ms 5536 KB Output is correct
57 Correct 24 ms 1188 KB Output is correct
58 Correct 90 ms 5468 KB Output is correct
59 Correct 99 ms 5496 KB Output is correct
60 Correct 25 ms 1152 KB Output is correct
61 Correct 51 ms 2808 KB Output is correct
62 Correct 111 ms 5880 KB Output is correct
63 Correct 110 ms 6008 KB Output is correct
64 Correct 110 ms 5880 KB Output is correct
65 Correct 107 ms 5884 KB Output is correct
66 Correct 109 ms 5880 KB Output is correct
67 Correct 106 ms 5880 KB Output is correct
68 Correct 112 ms 6008 KB Output is correct
69 Correct 109 ms 6008 KB Output is correct
70 Correct 110 ms 5884 KB Output is correct
71 Correct 111 ms 6008 KB Output is correct
72 Correct 113 ms 5888 KB Output is correct
73 Correct 109 ms 6008 KB Output is correct