Submission #666284

# Submission time Handle Problem Language Result Execution time Memory
666284 2022-11-28T05:50:02 Z Chal1shkan Med (COCI22_med) C++14
50 / 50
2 ms 340 KB
# 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 time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 316 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 316 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 2 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 316 KB Output is correct