Submission #62550458


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
#define ll long long
int n;
int k[105];
int f[105][100005];
vector<int>v[105];
double ans;
int main() {
    cin>>n;
    for(int i=1;i<=n;i++)
    {
    	cin>>k[i];
    	for(int j=1;j<=k[i];j++)
    	{
    		int x;
    		cin>>x;
    		if(!f[i][x])
    		{
    			v[i].push_back(x);
			}
    		f[i][x]++;
		}
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=i+1;j<=n;j++)
		{
			int x,y;
			if(k[i]<k[j])
			{
				x=i;
				y=j;
			}
			else
			{
				y=i;
				x=j;
			}
			double sum=0;
			for(int w=0;w<v[x].size();w++)
			{
				int p=v[x][w];
				double a=f[x][p],b=f[y][p];
				sum+=a/k[x]*b/k[y];
			}
			ans=max(ans,sum);
		}
	}
	printf("%.10f",ans);
    return 0;
}

Submission Info

Submission Time
Task D - Doubles
User lichaozhe2022
Language C++ 20 (gcc 12.2)
Score 400
Code Size 757 Byte
Status AC
Exec Time 62 ms
Memory 43316 KiB

Compile Error

Main.cpp: In function ‘int main()’:
Main.cpp:41:38: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<int>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
   41 |                         for(int w=0;w<v[x].size();w++)
      |                                     ~^~~~~~~~~~~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 2
AC × 26
Set Name Test Cases
Sample sample_01.txt, sample_02.txt
All random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, random_23.txt, random_24.txt, sample_01.txt, sample_02.txt
Case Name Status Exec Time Memory
random_01.txt AC 16 ms 3992 KiB
random_02.txt AC 16 ms 4096 KiB
random_03.txt AC 18 ms 5436 KiB
random_04.txt AC 19 ms 7240 KiB
random_05.txt AC 16 ms 3960 KiB
random_06.txt AC 16 ms 4144 KiB
random_07.txt AC 18 ms 5796 KiB
random_08.txt AC 18 ms 6744 KiB
random_09.txt AC 16 ms 4024 KiB
random_10.txt AC 16 ms 3808 KiB
random_11.txt AC 17 ms 5144 KiB
random_12.txt AC 18 ms 6204 KiB
random_13.txt AC 16 ms 3904 KiB
random_14.txt AC 18 ms 4644 KiB
random_15.txt AC 16 ms 3724 KiB
random_16.txt AC 17 ms 4368 KiB
random_17.txt AC 1 ms 3736 KiB
random_18.txt AC 16 ms 4144 KiB
random_19.txt AC 62 ms 43300 KiB
random_20.txt AC 31 ms 4868 KiB
random_21.txt AC 17 ms 4228 KiB
random_22.txt AC 16 ms 3744 KiB
random_23.txt AC 53 ms 43288 KiB
random_24.txt AC 53 ms 43316 KiB
sample_01.txt AC 1 ms 3728 KiB
sample_02.txt AC 1 ms 3716 KiB