Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- typedef long long ll;
- void solution() {
- int n;
- cin>>n;
- int ans = 1;
- vector<double> a(n), b(n);
- vector<int> dp(n,1);
- for (int i = 0; i < n; i++)
- {
- cin>>a[i]>>b[i];
- }
- for (int i = 1; i < n; i++)
- {
- for (int j = 0; j < i; j++)
- {
- if(a[i]>a[j] && b[i]<b[j]){
- dp[i] = max(dp[i],dp[j]+1);
- ans = max(ans, dp[i]);
- }
- }
- }
- cout<<ans<<endl;
- }
- int main() {
- int t;
- cin >> t;
- while (t--) {
- solution();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement