Submission #659520

# Submission time Handle Problem Language Result Execution time Memory
659520 2022-11-18T10:53:58 Z vinnipuh01 Exhibition (JOI19_ho_t2) C++17
100 / 100
129 ms 6628 KB
#include <iostream>
#include <bits/stdc++.h>
#include <cmath>
#include <algorithm>
#include <vector>
#include <deque>
#include <set>
#include <stack>
#include <string>
#include <map>
#include <queue>
#define int long long
#define sqrt sqrtl

using namespace std;

const long long oo = 1000000000000000000;

long long sum, ans = 0, mx = 0, mn = 1000000000, num, pos;


/*
    ViHHiPuh

   (( `'-""``""-'` ))
     )-__-_.._-__-(
   / --- (o _ o) --- \
   \ .-* ( .0. ) *-. /
   _'-. ,_ '=' _, .-'_
  / `;#'#'# - #'#'#;` \
 \_)) -----'#'----- ((_/
      # --------- #
  '# ------- ------ #'
  /..-'# ------- #'-.\
  _\...-\'# -- #'/-.../_
  ((____)- '#' -(____))


    cout << fixed << setprecision(6) << x;

    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    freopen ( "sum.in", "r", stdin )
*/

vector <pair<int, int> > v;
vector <int> vv;

main () {
	int n, m, x, y, a;
	cin >> n >> m;
	for ( int i = 1; i <= n; i ++ ) {
		cin >> x >> y;
		v.push_back( { y, x } );
	}
	for ( int i = 1; i <= m; i ++ ) {
		cin >> a;
		vv.push_back( a );
	}
	sort( v.begin(), v.end() );
	sort( vv.begin(), vv.end() );
	int l, r;
	l = v.size() - 1;
	r = vv.size() - 1;
	while ( l >= 0 && r >= 0 ) {
		if ( v[ l ].second <= vv[ r ] ) {
			r --;
			ans ++;
		}
		l --;
	}
	cout << ans;
}

Compilation message

joi2019_ho_t2.cpp:50:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   50 | main () {
      | ^~~~
# 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 0 ms 300 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 296 KB Output is correct
11 Correct 0 ms 296 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 292 KB Output is correct
19 Correct 1 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 0 ms 300 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 296 KB Output is correct
11 Correct 0 ms 296 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 292 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 2 ms 308 KB Output is correct
21 Correct 2 ms 340 KB Output is correct
22 Correct 2 ms 340 KB Output is correct
23 Correct 2 ms 340 KB Output is correct
24 Correct 2 ms 340 KB Output is correct
25 Correct 2 ms 340 KB Output is correct
26 Correct 2 ms 356 KB Output is correct
27 Correct 2 ms 312 KB Output is correct
28 Correct 2 ms 340 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 2 ms 308 KB Output is correct
31 Correct 2 ms 312 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 308 KB Output is correct
34 Correct 2 ms 340 KB Output is correct
35 Correct 1 ms 212 KB Output is correct
36 Correct 2 ms 340 KB Output is correct
37 Correct 2 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 0 ms 300 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 296 KB Output is correct
11 Correct 0 ms 296 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 292 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 2 ms 308 KB Output is correct
21 Correct 2 ms 340 KB Output is correct
22 Correct 2 ms 340 KB Output is correct
23 Correct 2 ms 340 KB Output is correct
24 Correct 2 ms 340 KB Output is correct
25 Correct 2 ms 340 KB Output is correct
26 Correct 2 ms 356 KB Output is correct
27 Correct 2 ms 312 KB Output is correct
28 Correct 2 ms 340 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 2 ms 308 KB Output is correct
31 Correct 2 ms 312 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 308 KB Output is correct
34 Correct 2 ms 340 KB Output is correct
35 Correct 1 ms 212 KB Output is correct
36 Correct 2 ms 340 KB Output is correct
37 Correct 2 ms 340 KB Output is correct
38 Correct 126 ms 6572 KB Output is correct
39 Correct 119 ms 6552 KB Output is correct
40 Correct 122 ms 6584 KB Output is correct
41 Correct 123 ms 6580 KB Output is correct
42 Correct 120 ms 6456 KB Output is correct
43 Correct 123 ms 6452 KB Output is correct
44 Correct 121 ms 6524 KB Output is correct
45 Correct 118 ms 6556 KB Output is correct
46 Correct 117 ms 6420 KB Output is correct
47 Correct 106 ms 6068 KB Output is correct
48 Correct 106 ms 5992 KB Output is correct
49 Correct 96 ms 5496 KB Output is correct
50 Correct 95 ms 5468 KB Output is correct
51 Correct 123 ms 6456 KB Output is correct
52 Correct 121 ms 6512 KB Output is correct
53 Correct 118 ms 6428 KB Output is correct
54 Correct 122 ms 6584 KB Output is correct
55 Correct 128 ms 6476 KB Output is correct
56 Correct 87 ms 3992 KB Output is correct
57 Correct 42 ms 2244 KB Output is correct
58 Correct 78 ms 3800 KB Output is correct
59 Correct 80 ms 3924 KB Output is correct
60 Correct 44 ms 2244 KB Output is correct
61 Correct 71 ms 3796 KB Output is correct
62 Correct 119 ms 6560 KB Output is correct
63 Correct 124 ms 6468 KB Output is correct
64 Correct 120 ms 6452 KB Output is correct
65 Correct 124 ms 6532 KB Output is correct
66 Correct 122 ms 6520 KB Output is correct
67 Correct 119 ms 6492 KB Output is correct
68 Correct 128 ms 6464 KB Output is correct
69 Correct 121 ms 6492 KB Output is correct
70 Correct 123 ms 6504 KB Output is correct
71 Correct 127 ms 6548 KB Output is correct
72 Correct 129 ms 6628 KB Output is correct
73 Correct 117 ms 6500 KB Output is correct