結果

問題 No.1552 Simple Dice Game
ユーザー kotatsugamekotatsugame
提出日時 2021-06-18 21:36:47
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 445 ms / 2,500 ms
コード長 494 bytes
コンパイル時間 694 ms
コンパイル使用メモリ 69,400 KB
実行使用メモリ 8,772 KB
最終ジャッジ日時 2023-09-04 22:33:34
合計ジャッジ時間 6,869 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
8,468 KB
testcase_01 AC 4 ms
8,480 KB
testcase_02 AC 4 ms
8,664 KB
testcase_03 AC 439 ms
8,516 KB
testcase_04 AC 4 ms
8,480 KB
testcase_05 AC 4 ms
8,476 KB
testcase_06 AC 4 ms
8,480 KB
testcase_07 AC 4 ms
8,548 KB
testcase_08 AC 4 ms
8,448 KB
testcase_09 AC 347 ms
8,448 KB
testcase_10 AC 399 ms
8,532 KB
testcase_11 AC 408 ms
8,480 KB
testcase_12 AC 120 ms
8,772 KB
testcase_13 AC 341 ms
8,528 KB
testcase_14 AC 200 ms
8,520 KB
testcase_15 AC 255 ms
8,464 KB
testcase_16 AC 39 ms
8,456 KB
testcase_17 AC 60 ms
8,552 KB
testcase_18 AC 316 ms
8,468 KB
testcase_19 AC 442 ms
8,520 KB
testcase_20 AC 443 ms
8,768 KB
testcase_21 AC 438 ms
8,460 KB
testcase_22 AC 445 ms
8,468 KB
testcase_23 AC 436 ms
8,468 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:8:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-Wreturn-type]
    8 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<atcoder/modint>
using namespace std;
using mint=atcoder::modint998244353;
long N;
int M;
mint L[5<<17],R[5<<17];
main()
{
	cin>>N>>M;
	L[0]=0;
	mint ans=0,pre=0;
	for(int i=1;i<=M;i++)
	{
		L[i]=mint(i).pow(N)*N*(i+1)/2;
		mint tmp=L[i];
		L[i]-=pre;
		pre=tmp;
		ans+=i*L[i];
	}
	R[M+1]=0;
	pre=0;
	for(int i=M;i>=1;i--)
	{
		int j=M-i+1;
		R[i]=mint(j).pow(N)*N*(M-mint(j-1)/2);
		mint tmp=R[i];
		R[i]-=pre;
		pre=tmp;
		ans-=i*R[i];
	}
	cout<<ans.val()<<endl;
}
0