582021-01-09 16:03:54mraronRobotokcpp11Elfogadva 50/5035ms4164 KiB
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<cassert>
#include<cassert>
#include<unordered_map>
#include<unordered_set>
#include<functional>
#include<queue>
#include<stack>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<sstream>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<numeric>
#include<random>
#include<chrono>
#include<bitset>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define all(x) (x).begin(), (x).end()
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define sz(x) (int)(x).size()
#define gc getchar
#define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mp make_pair

#ifndef ONLINE_JUDGE
#  define LOG(x) (cerr << #x << " = " << (x) << endl)
#else
#  define LOG(x) ((void)0)
#endif

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;


const double PI=acos(-1);
const ll INF = 1LL<<62;
const ll MINF = -(1LL<<62);

template<typename T> T getint() {
	T val=0;
	char c;
	
	bool neg=false;
	while((c=gc()) && !(c>='0' && c<='9')) {
		neg|=c=='-';
	}

	do {
		val=(val*10)+c-'0';
	} while((c=gc()) && (c>='0' && c<='9'));

	return val*(neg?-1:1);
}

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); uniform_int_distribution<int>(0, n-1)(rng)


int main() {
	IO;
	int n,m,k;
	cin>>n>>m>>k;
	vector<pair<int,int>> t(k);
	for(int i=0;i<k;++i) {
		cin>>t[i].xx>>t[i].yy;
		swap(t[i].xx, t[i].yy);
	}
	sort(all(t));
	vector<int> lis;
	for(auto& i:t) {
		i.yy*=-1;
		auto it=lower_bound(lis.begin(), lis.end(), i.yy);
		if(it==lis.end()) lis.pb(i.yy);
		else *it=i.yy;
	}
	cout<<sz(lis)<<"\n";
	return 0;
}


RészfeladatÖsszpontTesztVerdiktIdőMemória
base50/50
1Elfogadva0/01ms1752 KiB
2Elfogadva0/027ms3084 KiB
3Elfogadva2/21ms1844 KiB
4Elfogadva2/21ms1844 KiB
5Elfogadva2/21ms1848 KiB
6Elfogadva2/23ms1944 KiB
7Elfogadva2/22ms1876 KiB
8Elfogadva2/21ms1860 KiB
9Elfogadva2/21ms1868 KiB
10Elfogadva2/21ms1856 KiB
11Elfogadva2/26ms2032 KiB
12Elfogadva2/216ms2552 KiB
13Elfogadva2/21ms1852 KiB
14Elfogadva2/235ms4152 KiB
15Elfogadva2/227ms4152 KiB
16Elfogadva2/230ms4152 KiB
17Elfogadva4/426ms4156 KiB
18Elfogadva6/634ms4164 KiB
19Elfogadva6/632ms4160 KiB
20Elfogadva6/627ms4152 KiB