提出 #62523121


ソースコード 拡げる

#include<bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
namespace IO{
    template<typename T>
    void read(T &x){
        char ch=getchar();int fl=1;x=0;
        while(ch>'9'||ch<'0'){if(ch=='-')fl=-1;ch=getchar();}
        while(ch<='9'&&ch>='0'){x=x*10+ch-48;ch=getchar();}
        x*=fl;
    }
    template<typename T,typename ...Args>
    void read(T &x,Args& ...args){
        read(x);read(args...);
    }
    template <typename _Tp>
    void write(_Tp x) {
        if(x<0) x=(~x+1),putchar('-');
        if(x>9) write(x/10);
        putchar(x%10+'0');
    }
}
using namespace std;
using namespace IO;
const int N=2e5+5,mod=998244353;
int fac[N],inv[N];
int ksm(int x,int y) {
    int ans=1;
    while(y) {
        if(y&1) ans=(1ll*ans*x)%mod;
        x=(1ll*x*x)%mod; y>>=1;
    }
    return ans;
}	
inline void init() {
    fac[0]=1;
    for(int i=1;i<N;i++) fac[i]=(1ll*fac[i-1]*i)%mod;
    inv[N-1]=ksm(fac[N-1],mod-2);
    for(int i=N-2;i>=0;i--) inv[i]=(1ll*inv[i+1]*(i+1))%mod;
}
inline int Inc(int x,int y) {return x+y<mod?x+y:x+y-mod;}
inline int Dec(int x,int y) {return x>=y?x-y:x-y+mod;}
inline int Mul(int x,int y) {return (1ll*x*y)%mod;}
vector<pair<double,int> > vec[N];
int n,a[105][N],num[N];
map<int,int> ma[105];
double Ans[105];
int cmp(double x,double y) {
    return x>y;
}
signed main() {
#ifndef KAxdd
#ifndef ONLINE_JUDGE
    freopen(".in","r",stdin);
    freopen(".out","w",stdout);
#endif
#endif
    read(n);
    for(int i=1;i<=n;i++) {
        int k; read(k);num[i]=k;
        for(int j=1;j<=k;j++) {
            int x; read(x);
            ma[i][x]++;
        }
        for(auto j:ma[i]) {
            vec[j.fi].push_back({(1.0*j.se/k),i});
        }
    }
    double ans=0;
    for(int i=1;i<=n;i++) {
        for(int j=1;j<=n;j++) Ans[j]=0;

        for(auto j:ma[i]) {
            for(auto k:vec[j.fi]) {
                Ans[k.se]+=(k.fi*(1.0*j.se/num[i]));
            }
        }

        for(int j=1;j<=n;j++) {
            if(j==i) continue;
            ans=max(ans,Ans[j]);
        }
    }
    printf("%.010lf",ans);
    return 0;
}

提出情報

提出日時
問題 D - Doubles
ユーザ KAddx
言語 C++ 20 (gcc 12.2)
得点 400
コード長 2191 Byte
結果 AC
実行時間 38 ms
メモリ 13960 KiB

ジャッジ結果

セット名 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 5 ms 3740 KiB
random_02.txt AC 5 ms 3712 KiB
random_03.txt AC 32 ms 12572 KiB
random_04.txt AC 30 ms 13112 KiB
random_05.txt AC 5 ms 3764 KiB
random_06.txt AC 5 ms 3728 KiB
random_07.txt AC 31 ms 12824 KiB
random_08.txt AC 30 ms 12924 KiB
random_09.txt AC 5 ms 3804 KiB
random_10.txt AC 5 ms 3808 KiB
random_11.txt AC 38 ms 12372 KiB
random_12.txt AC 31 ms 12872 KiB
random_13.txt AC 4 ms 3700 KiB
random_14.txt AC 32 ms 12084 KiB
random_15.txt AC 3 ms 3636 KiB
random_16.txt AC 31 ms 11028 KiB
random_17.txt AC 2 ms 3688 KiB
random_18.txt AC 4 ms 3708 KiB
random_19.txt AC 28 ms 13420 KiB
random_20.txt AC 16 ms 13960 KiB
random_21.txt AC 21 ms 13920 KiB
random_22.txt AC 4 ms 3768 KiB
random_23.txt AC 36 ms 12424 KiB
random_24.txt AC 34 ms 12360 KiB
sample_01.txt AC 2 ms 3728 KiB
sample_02.txt AC 1 ms 3632 KiB