Submission #659520

#TimeUsernameProblemLanguageResultExecution timeMemory
659520vinnipuh01Exhibition (JOI19_ho_t2)C++17
100 / 100
129 ms6628 KiB
#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 (stderr)

joi2019_ho_t2.cpp:50:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   50 | main () {
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...