結果

問題 No.1546 [Cherry 2nd Tune D] 思ったよりも易しくない
ユーザー kotatsugamekotatsugame
提出日時 2021-06-11 22:04:04
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 558 ms / 2,000 ms
コード長 491 bytes
コンパイル時間 1,258 ms
コンパイル使用メモリ 70,152 KB
実行使用メモリ 9,692 KB
最終ジャッジ日時 2023-08-21 12:31:01
合計ジャッジ時間 21,130 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,476 KB
testcase_01 AC 2 ms
5,416 KB
testcase_02 AC 2 ms
5,484 KB
testcase_03 AC 2 ms
5,416 KB
testcase_04 AC 2 ms
5,484 KB
testcase_05 AC 2 ms
5,476 KB
testcase_06 AC 2 ms
5,480 KB
testcase_07 AC 2 ms
5,608 KB
testcase_08 AC 2 ms
5,416 KB
testcase_09 AC 2 ms
5,420 KB
testcase_10 AC 2 ms
5,512 KB
testcase_11 AC 2 ms
5,420 KB
testcase_12 AC 2 ms
5,408 KB
testcase_13 AC 198 ms
6,316 KB
testcase_14 AC 500 ms
9,500 KB
testcase_15 AC 260 ms
8,564 KB
testcase_16 AC 254 ms
8,536 KB
testcase_17 AC 187 ms
6,208 KB
testcase_18 AC 360 ms
9,124 KB
testcase_19 AC 331 ms
8,884 KB
testcase_20 AC 407 ms
9,328 KB
testcase_21 AC 16 ms
5,480 KB
testcase_22 AC 357 ms
8,992 KB
testcase_23 AC 296 ms
8,728 KB
testcase_24 AC 59 ms
5,712 KB
testcase_25 AC 524 ms
9,500 KB
testcase_26 AC 550 ms
9,564 KB
testcase_27 AC 259 ms
8,552 KB
testcase_28 AC 547 ms
9,500 KB
testcase_29 AC 548 ms
9,504 KB
testcase_30 AC 550 ms
9,496 KB
testcase_31 AC 547 ms
9,552 KB
testcase_32 AC 547 ms
9,628 KB
testcase_33 AC 547 ms
9,500 KB
testcase_34 AC 547 ms
9,568 KB
testcase_35 AC 549 ms
9,496 KB
testcase_36 AC 548 ms
9,688 KB
testcase_37 AC 548 ms
9,632 KB
testcase_38 AC 548 ms
9,500 KB
testcase_39 AC 547 ms
9,556 KB
testcase_40 AC 547 ms
9,688 KB
testcase_41 AC 548 ms
9,692 KB
testcase_42 AC 548 ms
9,492 KB
testcase_43 AC 486 ms
9,492 KB
testcase_44 AC 485 ms
9,556 KB
testcase_45 AC 487 ms
9,496 KB
testcase_46 AC 486 ms
9,628 KB
testcase_47 AC 486 ms
9,500 KB
testcase_48 AC 558 ms
9,564 KB
testcase_49 AC 550 ms
9,552 KB
testcase_50 AC 3 ms
5,420 KB
testcase_51 AC 2 ms
5,468 KB
testcase_52 AC 2 ms
5,412 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:7:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-Wreturn-type]
    7 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<atcoder/modint>
using namespace std;
using mint=atcoder::modint998244353;
int N;
long T[3<<17],v[3<<17];
main()
{
	cin>>N;
	mint n=0;
	for(int i=0;i<N;i++)
	{
		cin>>T[i]>>v[i];
		n+=T[i];
	}
	mint p=0,ans=0;
	for(int i=0;i<N;i++)
	{
		mint now;
		now-=n*p*(p+1)*(2*p+1)/6;
		now-=(n+1)*p*(p+1)/2;
		now+=p*p*(p+1)*(p+1)/4;
		p+=T[i];
		now+=n*p*(p+1)*(2*p+1)/6;
		now+=(n+1)*p*(p+1)/2;
		now-=p*p*(p+1)*(p+1)/4;
		ans+=now*v[i];
	}
	cout<<(ans/2).val()<<endl;
}
0