結果

問題 No.108 トリプルカードコンプ
ユーザー tailstails
提出日時 2023-02-24 18:41:24
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 641 bytes
コンパイル時間 5,824 ms
コンパイル使用メモリ 331,248 KB
実行使用メモリ 4,376 KB
最終ジャッジ日時 2023-10-11 03:42:53
合計ジャッジ時間 7,113 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 1 ms
4,352 KB
testcase_02 AC 1 ms
4,352 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 1 ms
4,352 KB
testcase_07 AC 2 ms
4,352 KB
testcase_08 AC 1 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 1 ms
4,352 KB
testcase_11 AC 2 ms
4,356 KB
testcase_12 AC 1 ms
4,356 KB
testcase_13 AC 2 ms
4,352 KB
testcase_14 AC 2 ms
4,352 KB
testcase_15 AC 2 ms
4,352 KB
testcase_16 AC 2 ms
4,352 KB
testcase_17 AC 2 ms
4,348 KB
testcase_18 AC 1 ms
4,356 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 1 ms
4,356 KB
testcase_21 AC 2 ms
4,352 KB
testcase_22 AC 1 ms
4,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")

#include<bits/stdc++.h>
using namespace std;

#define e(a,b,c) _e[a+1][b+1][c+1]
#define rep(v,e) for(int v=0;v<e;++v)
#define rep3(v,s,e) for(int v=s;v<e;++v)

struct Hoge {
	double _e[102][102][102];
	constexpr Hoge():_e(){
		rep(i,101){
			rep3(j,i,101){
				rep3(k,j?:1,101){
					e(i,j,k)=(i*e(i-1,j,k)+(j-i)*e(i,j-1,k)+(k-j)*e(i,j,k-1)+1)/k;
				}
			}
		}
	}
};

constexpr Hoge h;

int main(){
	int n,c0=0,c1=0,c2=0;
	cin>>n;
	rep(i,n){
		int a;
		cin>>a;
		c0+=a<=0;
		c1+=a<=1;
		c2+=a<=2;
	}
	//cout<<n*h.e(c0,c1,c2);
	cout<<(int)(n*h.e(c0,c1,c2)*1e6)<<"e-6";
	return 0;
}
0