結果

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

テストケース

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

ソースコード

diff #

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

#include<unistd.h>
#include<sys/mman.h>

#define rd() ({int _v=0,_c;while(_c=*rp++-48,_c>=0)_v=_v*10+_c;_v;})
#define wt(v) ({unsigned _z=v;do*--wp=_z%10+48;while(_z/=10);})
#define rep(v,e) for(int v=0;v<e;++v)
#define rep3(v,s,e) for(int v=s;v<e;++v)
#define e(a,b,c) _e[a+1][b+1][c+1]

constexpr 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;
				}
			}
		}
	}
} h;

static double f1(){
	char*rp=static_cast<char*>(mmap(0,1<<25,1,2,0,0));
	int n=rd();
	int c0=0,c1=0,c2=0;
	while(*rp){
		int a=rd();
		c0+=a<=0;
		c1+=a<=1;
		c2+=a<=2;
	}
	return n*h.e(c0,c1,c2);
}

static void f2(double z){
	char wbuf[64],*wp=wbuf+sizeof wbuf;
	*--wp='6';
	*--wp='-';
	*--wp='e';
	wt(z*1e6);
	write(1,wp,wbuf+sizeof wbuf-wp);
}

int main(){
	f2(f1());
	return 0;
}
0