ILZM

For Maksim Shkurenko

Dec 17th, 2011
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.25 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. long l_seq[1000001], l_lesscount[1000001], l_largercount[1000001];
  6.  
  7. void get_lesscount(long id, long l_count)
  8. {
  9.      long number= l_seq[id];
  10.      
  11.      for(int l= id; l>= 0; l--)
  12.              if (l!= id)
  13.                 if (number> abs(l_seq[l]))
  14.                    l_lesscount[id]++;      
  15. }
  16.  
  17. void get_largercount(long id, long l_count)
  18. {
  19.      long number= l_seq[id];
  20.      
  21.      for(int l= id; l< l_count; l++)
  22.              if (l!= id)
  23.                 if (number< abs(l_seq[l]))
  24.                    l_largercount[id]++;      
  25. }
  26.  
  27. int main()
  28. {
  29.     long l_count;
  30.    
  31.     cin>> l_count;
  32.    
  33.     for(int i= 0; i< l_count; i++)
  34.     {
  35.             cin>> l_seq[i];
  36.      
  37.             l_lesscount[i]= 0;
  38.             l_largercount[i]= 0;
  39.      }
  40.            
  41.     for(int i= 0; i< l_count; i++)
  42.     {
  43.             get_lesscount(i, l_count);
  44.             get_largercount(i, l_count);  
  45.                    
  46.             cout<< l_lesscount[i]<< " ";                      
  47.     }        
  48.    
  49.     cout<< "\n";      
  50.          
  51.     for(int i= 0; i< l_count; i++)
  52.             cout<< l_largercount[i]<< " ";  
  53.            
  54.     int i_stop;      
  55.            
  56.     cin>> i_stop;                  
  57. }
Advertisement
Add Comment
Please, Sign In to add comment