Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- long l_seq[1000001], l_lesscount[1000001], l_largercount[1000001];
- void get_lesscount(long id, long l_count)
- {
- long number= l_seq[id];
- for(int l= id; l>= 0; l--)
- if (l!= id)
- if (number> abs(l_seq[l]))
- l_lesscount[id]++;
- }
- void get_largercount(long id, long l_count)
- {
- long number= l_seq[id];
- for(int l= id; l< l_count; l++)
- if (l!= id)
- if (number< abs(l_seq[l]))
- l_largercount[id]++;
- }
- int main()
- {
- long l_count;
- cin>> l_count;
- for(int i= 0; i< l_count; i++)
- {
- cin>> l_seq[i];
- l_lesscount[i]= 0;
- l_largercount[i]= 0;
- }
- for(int i= 0; i< l_count; i++)
- {
- get_lesscount(i, l_count);
- get_largercount(i, l_count);
- cout<< l_lesscount[i]<< " ";
- }
- cout<< "\n";
- for(int i= 0; i< l_count; i++)
- cout<< l_largercount[i]<< " ";
- int i_stop;
- cin>> i_stop;
- }
Advertisement
Add Comment
Please, Sign In to add comment