結果

問題 No.1554 array_and_me
ユーザー kotatsugamekotatsugame
提出日時 2021-06-18 22:18:27
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 824 bytes
コンパイル時間 793 ms
コンパイル使用メモリ 82,124 KB
実行使用メモリ 8,468 KB
最終ジャッジ日時 2023-09-04 23:29:24
合計ジャッジ時間 4,096 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,376 KB
testcase_01 AC 21 ms
4,380 KB
testcase_02 AC 21 ms
4,380 KB
testcase_03 AC 21 ms
4,380 KB
testcase_04 AC 21 ms
4,380 KB
testcase_05 AC 21 ms
4,376 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 27 ms
7,348 KB
testcase_12 AC 28 ms
7,020 KB
testcase_13 AC 27 ms
8,056 KB
testcase_14 AC 28 ms
7,212 KB
testcase_15 AC 28 ms
7,400 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 41 ms
4,376 KB
testcase_37 AC 41 ms
4,380 KB
testcase_38 AC 41 ms
4,380 KB
testcase_39 AC 41 ms
4,380 KB
testcase_40 AC 41 ms
4,376 KB
testcase_41 AC 25 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:9:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-Wreturn-type]
    9 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<queue>
#include<atcoder/modint>
using namespace std;
using mint=atcoder::modint998244353;
int T,N,K;
int A[1<<17];
mint inv[1<<17];
main()
{
	cin>>T;
	inv[1]=1;
	for(int i=2;i<1<<17;i++)inv[i]=-(998244353/i)*inv[998244353%i];
	for(;T--;)
	{
		cin>>N>>K;
		int sum=0;
		priority_queue<pair<pair<int,double>,pair<int,int> > >P;
		for(int i=0;i<N;i++)
		{
			cin>>A[i];
			P.push(make_pair(make_pair(A[i]*K,A[i]),make_pair(0,A[i])));
			sum+=A[i];
		}
		mint ans=1,invsum=mint(1)/sum;
		for(int i=1;i<=K;i++)
		{
			ans*=i;
			pair<pair<int,double>,pair<int,int> >p=P.top();P.pop();
			p.first.first-=sum;
			p.second.first--;
			p.first.second=p.second.second/(double)(1-p.second.first);
			P.push(p);
			ans*=inv[-p.second.first];
			ans*=p.second.second*invsum;
		}
		cout<<ans.val()<<endl;
	}
}
0