提出 #62523421


ソースコード 拡げる

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define fi first
#define se second
typedef double db;
#define pb push_back
#define eb emplace_back
#define bcnt __builtin_popcount
#define TS printf("!!!tiaoshi\n")
const int inf=1e9+7;
const int N=2e5+5;
int n,m,a[N];
vector<int> b[N];
unordered_map<int,db> mp;
void sol(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
		int x;
		for(int j=1;j<=a[i];j++){
			scanf("%d",&x);b[i].eb(x);
		}
	}
	db ans=0.0;
	for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++){
			db res=0.0,p1=1.0/a[i],p2=1.0/a[j];
			for(int it:b[i]) mp[it]+=p1;
			for(int it:b[j]) res+=p2*mp[it];
			ans=max(ans,res),mp.clear();
		}
	}
	printf("%.8lf",ans);
}
int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int T=1;
	//scanf("%d",&T);
	while(T--) sol();

	return 0;
}

提出情報

提出日時
問題 D - Doubles
ユーザ wangziyue_AK
言語 C++ 23 (gcc 12.2)
得点 400
コード長 918 Byte
結果 AC
実行時間 298 ms
メモリ 8520 KiB

コンパイルエラー

Main.cpp: In function ‘void sol()’:
Main.cpp:18:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   18 |         scanf("%d",&n);
      |         ~~~~~^~~~~~~~~
Main.cpp:20:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   20 |                 scanf("%d",&a[i]);
      |                 ~~~~~^~~~~~~~~~~~
Main.cpp:23:30: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   23 |                         scanf("%d",&x);b[i].eb(x);
      |                         ~~~~~^~~~~~~~~

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 400 / 400
結果
AC × 2
AC × 26
セット名 テストケース
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
ケース名 結果 実行時間 メモリ
random_01.txt AC 12 ms 3968 KiB
random_02.txt AC 17 ms 3852 KiB
random_03.txt AC 23 ms 5284 KiB
random_04.txt AC 32 ms 4848 KiB
random_05.txt AC 12 ms 4040 KiB
random_06.txt AC 22 ms 4056 KiB
random_07.txt AC 27 ms 5064 KiB
random_08.txt AC 31 ms 5008 KiB
random_09.txt AC 13 ms 4168 KiB
random_10.txt AC 12 ms 4000 KiB
random_11.txt AC 20 ms 6108 KiB
random_12.txt AC 38 ms 4948 KiB
random_13.txt AC 8 ms 4064 KiB
random_14.txt AC 16 ms 6412 KiB
random_15.txt AC 8 ms 4004 KiB
random_16.txt AC 16 ms 6272 KiB
random_17.txt AC 2 ms 3860 KiB
random_18.txt AC 46 ms 4200 KiB
random_19.txt AC 298 ms 4348 KiB
random_20.txt AC 216 ms 4268 KiB
random_21.txt AC 13 ms 8520 KiB
random_22.txt AC 8 ms 4080 KiB
random_23.txt AC 180 ms 4352 KiB
random_24.txt AC 183 ms 4228 KiB
sample_01.txt AC 2 ms 3872 KiB
sample_02.txt AC 1 ms 3792 KiB