Submission #1161108

#TimeUsernameProblemLanguageResultExecution timeMemory
1161108Doncho_BonbonchoKralj (COCI16_kralj)C++20
56 / 140
148 ms6320 KiB
#include <algorithm>
#include <bits/stdc++.h>
#include <vector>
using namespace std;

#ifndef LOCAL
#define cerr if(false) cerr
#endif

#define out( x ) #x << " = " << x << "  "
#define endl "\n"

template<class T, class T2> inline bool chkmax(T &x, const T2 &y) { return x < y ? x = y, 1 : 0; }
template<class T, class T2> inline bool chkmin(T &x, const T2 &y) { return x > y ? x = y, 1 : 0; }

typedef long long ll;
const ll mod = 1e9 +7;
const int MAX_N = 1e6 + 42;

int main(){
#ifndef LOCAL
	std::ios_base::sync_with_stdio( false ); std::cin.tie( NULL ); std::cout.tie( NULL );
#endif

	int n;
	std::cin >> n;

	std::vector< int > a( n );
	std::vector< int > d( n );
	std::vector< int > e( n );

	for( auto& j : a ) std::cin >> j;
	for( auto& j : d ) std::cin >> j;
	for( auto& j : e ) std::cin >> j;

	std::sort( d.begin(), d.end() );
	std::sort( e.begin(), e.end() );

	cerr << " e " << endl;
	for( auto j : e ) cerr << j << " ";
	cerr << " d " << endl;
	for( auto j : d ) cerr << j << " ";
	cerr << endl << endl;

	int ind = 0;
	ll nas = 0;
	for( int i=0 ; i < n ; i++ ){
		while( ind < n and e[ind] <= d[i] ) ind ++;
		cerr << out( e[ind] ) << out( d[i] ) << out( ind ) << endl;
		if( ind == n ) break;
		nas ++;
		ind ++;
	}

	std::cout << nas << endl;

	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...