551A - GukiZ and Contest - CodeForces Solution


brute force implementation sortings *800

Please click on ads to support us..

Python Code:

n=int(input())
lst=list(map(int,input().split()))
for i in range(n):
    s=1
    for j in range(n):
        if lst[i]<lst[j]: s+=1
    print(s,end=' ')
					 		 			 	  					        	

C++ Code:

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double lld;
#define pb push_back
#define pob pop_back
bool isprime(ll n)
{
    if (n <= 1)
        return false;
    for (ll i = 2; i <= sqrt(n); i++)
        if (n % i == 0)
            return false;
 
    return true;
}
void solve()
{ 
 ll n;
 cin>>n;
 vector<ll> v(n);
 for(int i=0;i<n;i++)
 {cin>>v[i];}
	for(int i=0;i<n;i++)
	{
		ll a = 1;
		for(int j=0;j<n;j++)
			if(v[j] > v[i]) a++;
		cout << a << " ";
	}
	cout <<endl;
	}
int main()
{ 
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    ll t = 1;
  // cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}

		   	  	   	 	   	 	  				   	


Comments

Submit
0 Comments
More Questions

1684C - Column Swapping
57C - Array
1713D - Tournament Countdown
33A - What is for dinner
810A - Straight A
1433C - Dominant Piranha
633A - Ebony and Ivory
1196A - Three Piles of Candies
299A - Ksusha and Array
448B - Suffix Structures
1092B - Teams Forming
1166C - A Tale of Two Lands
544B - Sea and Islands
152B - Steps
1174D - Ehab and the Expected XOR Problem
1511A - Review Site
1316A - Grade Allocation
838A - Binary Blocks
1515D - Phoenix and Socks
1624D - Palindromes Coloring
1552F - Telepanting
1692G - 2Sort
1191A - Tokitsukaze and Enhancement
903A - Hungry Student Problem
52B - Right Triangles
1712A - Wonderful Permutation
1712D - Empty Graph
1712B - Woeful Permutation
1712C - Sort Zero
1028B - Unnatural Conditions