Submission #884236

# Submission time Handle Problem Language Result Execution time Memory
884236 2023-12-06T21:38:34 Z tsumondai Med (COCI22_med) C++14
50 / 50
1 ms 348 KB
#include <bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define foru(i, l, r) for(int i = l; i <= r; i++)
#define ford(i, r, l) for(int i = r; i >= l; i--)
#define __TIME  (1.0 * clock() / CLOCKS_PER_SEC)

typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<ii, ii> iiii;

const int N = 500 + 5;

const int oo = 1e9, mod = 1e9 + 7;

int n;
ii ans[N];
ii coms[N];

map<int, string> dick;

void process() {
	int n;
	cin >> n;
	vector<int> sum(n);
	vector<string> s(n);
	for (int i = 0; i < n; i++)
	{
		cin >> s[i];
		for (int j = 0; j < 5; j++)
		{
			int day;
			cin >> day;
			sum[i] += day;
		}
	}
	for (int i = 0; i < n; i++)
	{
		int minn = n, maxx = n;
		int misum = sum[i] + 500, masum = sum[i] - 500;
		for (int j = 0; j < n; j++)
		{
			if (i == j)
			{
				continue;
			}
			if (misum > sum[j] || (misum == sum[j] && s[i] < s[j]))
			{
				minn--;
			}
			if (masum > sum[j] || (masum == sum[j] && s[i] < s[j]))
			{
				maxx--;
			}

		}
		cout << minn << " " << maxx << "\n";
	}

	return;
}

signed main() {
	cin.tie(0)->sync_with_stdio(false);
	//freopen(".inp", "r", stdin);
	//freopen(".out", "w", stdout);
	process();
	cerr << "Time elapsed: " << __TIME << " s.\n";
	return 0;
}

// dont stop
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct