Submission #1016767

# Submission time Handle Problem Language Result Execution time Memory
1016767 2024-07-08T12:02:58 Z vjudge1 Tenis (COCI20_tenis) C++17
55 / 110
69 ms 9556 KB
#include <bits/stdc++.h>

using namespace std;

int main()
{
	int n;
	cin>>n;
	int r[n][3],x;
	for (int j=0;j<3;j++)
		for (int i=0;i<n;i++)
		{
			cin>>x;
			r[x-1][j]=i;
		}
	vector<int> bestr[n];
	for (int i=0;i<n;i++)
	{
		int mn=r[i][0];
		for (int j=1;j<3;j++)
			mn=min(mn,r[i][j]);
		bestr[mn].push_back(i);
	}
	int wins[n],court[3],cnt=0;
	for (int i=n-1;i>=0;i--)
	{
		for (int j:bestr[i])
			wins[j]=cnt;
		cnt+=bestr[i].size();
		for (int j=0;j<bestr[i].size();j++)
			for (int k=j+1;k<bestr[i].size();k++)
			{
				int cor=-1,mn=n;
				for (int c=0;c<3;c++)
				{
					if (r[bestr[i][j]][c]>i && r[bestr[i][k]][c]>i)
						continue;
					if (r[bestr[i][j]][c]==i)
						if (mn>r[bestr[i][k]][c])
							cor=c,mn=r[bestr[i][k]][c];
					if (r[bestr[i][k]][c]==i)
						if (mn>r[bestr[i][j]][c])
							cor=c,mn=r[bestr[i][j]][c];
				}
				court[cor]++;
				if (r[bestr[i][j]][cor]==i)
					wins[bestr[i][j]]++;
				else
					wins[bestr[i][k]]++;
			}
	}
	for (int i=0;i<3;i++)
		cout<<court[i]<<' ';
	cout<<endl;
	for (int i=0;i<n;i++)
		cout<<wins[i]<<' ';
	cout<<endl;
	
	return 0;
}

Compilation message

tenis.cpp: In function 'int main()':
tenis.cpp:30:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |   for (int j=0;j<bestr[i].size();j++)
      |                ~^~~~~~~~~~~~~~~~
tenis.cpp:31:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |    for (int k=j+1;k<bestr[i].size();k++)
      |                   ~^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 344 KB Partially correct
2 Partially correct 0 ms 348 KB Partially correct
3 Partially correct 0 ms 348 KB Partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 344 KB Partially correct
2 Partially correct 0 ms 348 KB Partially correct
3 Partially correct 0 ms 348 KB Partially correct
4 Partially correct 2 ms 604 KB Partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 344 KB Partially correct
2 Partially correct 0 ms 348 KB Partially correct
3 Partially correct 0 ms 348 KB Partially correct
4 Partially correct 2 ms 604 KB Partially correct
5 Partially correct 24 ms 3420 KB Partially correct
6 Partially correct 38 ms 4948 KB Partially correct
7 Partially correct 49 ms 6740 KB Partially correct
8 Partially correct 62 ms 8272 KB Partially correct
9 Partially correct 61 ms 8020 KB Partially correct
10 Partially correct 69 ms 9556 KB Partially correct