SHARE
TWEET

one

a guest Mar 10th, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <cstdio>
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     ios_base::sync_with_stdio( 0);
  9.     int t, n;
  10.     scanf("%d", &t);
  11.     long long int minim = 99999999, maxim = -1;
  12.     for( int i = 0; i < t; i++ )
  13.     {
  14.         int n;
  15.         scanf("%d", &n);
  16.         int* nn = new int[n];
  17.         int* gg = new int[n];
  18.         int rez = 0;
  19.         for( int y = 0; y < n; y++ )
  20.         {
  21.             scanf("%d", &nn[y]);
  22.             if(nn[y]>=maxim ){maxim=nn[y];gg[y]=-1;}
  23.         }
  24.         for( int y = n-1; y > 0; y-- )
  25.         {
  26.             if(nn[y]<=minim ){minim=nn[y];if(gg[y]==-1){rez++;}}
  27.         }
  28.         printf ("%d \n", rez);
  29.     }
  30.     return 0;
  31. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top