forked from kingrishabdugar/LRNDSA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCARVANS.cpp
40 lines (40 loc) · 810 Bytes
/
CARVANS.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include<iostream>
#include <bits/stdc++.h>
using namespace std;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define l long
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define vi vector<int>
#define vll vector<ll>
#define pb push_back
#define ld long double
#define mp make_pair
#define pii pair<int,int>
#define mod 1000000007
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
int main()
{
ll t;
cin>>t;
while(t--)
{
ll n;
cin>>n;
ll a[n];
ll count=1;
rep(i,n){
cin>>a[i];
}
for(int i=1;i<n;i++)
{
if(a[i]<a[i-1])
count++;
else
a[i]=a[i-1];
}
cout<<count<<endl;
}
}