제출 #666284

#제출 시각아이디문제언어결과실행 시간메모리
666284Chal1shkanMed (COCI22_med)C++14
50 / 50
2 ms340 KiB
# include <bits/stdc++.h>

# define pb push_back
# define ff first
# define ss second
# define nl "\n"
# define pii pair <int, int>
# define pll pair <ll, ll>
  
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
  
const ll maxn = 1e5 + 125;
const ll maxl = 20 + 0;
const ll inf = 2e9 + 0;
const ll mod = 998244353;

using namespace std;

void ma1n ()
{
	ll n;
	cin >> n;
	vector < pair <string, ll> > v(n);
	for (ll i = 0; i < n; ++i)
	{
		cin >> v[i].ff;
		ll sum = 0;
		for (ll j = 0, cv; j < 5; ++j)
		{
			cin >> cv;
			sum += cv;
		}
		v[i].ss = sum;
	}
	for (ll i = 0; i < n; ++i)
	{
		ll x = 1, y = 1;
		for (ll j = 0; j < n; ++j)
		{
			if (i == j) continue;
			if (v[i].ss + 500 < v[j].ss) ++x;
			if (v[i].ss + 500 == v[j].ss)
			{
				if (v[i].ff > v[j].ff) ++ x;
			} 
		}
		for (ll j = 0; j < n; ++j)
		{
			if (i == j) continue;
			if (v[i].ss - 500 < v[j].ss) ++y;
			if (v[i].ss - 500 == v[j].ss)
			{
				if (v[i].ff > v[j].ff) ++y;
			} 
		}
		cout << x << ' ' << y << nl;	
	}
}
    
int main ()
{
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int ttt = 1;
//  cin >> ttt;
    for (int test = 1; test <= ttt; test++)
    {
//      cout << "Case " << test << ":" << nl;
        ma1n();
    }
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...