結果

問題 No.2651 [Cherry 6th Tune B] $\mathbb{C}$omplex комбинат
ユーザー kotatsugamekotatsugame
提出日時 2024-02-23 21:54:17
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 122 ms / 2,500 ms
コード長 879 bytes
コンパイル時間 667 ms
コンパイル使用メモリ 69,692 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-02-23 21:54:56
合計ジャッジ時間 7,267 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
6,676 KB
testcase_01 AC 3 ms
6,676 KB
testcase_02 AC 114 ms
6,676 KB
testcase_03 AC 112 ms
6,676 KB
testcase_04 AC 113 ms
6,676 KB
testcase_05 AC 113 ms
6,676 KB
testcase_06 AC 113 ms
6,676 KB
testcase_07 AC 113 ms
6,676 KB
testcase_08 AC 113 ms
6,676 KB
testcase_09 AC 112 ms
6,676 KB
testcase_10 AC 112 ms
6,676 KB
testcase_11 AC 113 ms
6,676 KB
testcase_12 AC 112 ms
6,676 KB
testcase_13 AC 112 ms
6,676 KB
testcase_14 AC 111 ms
6,676 KB
testcase_15 AC 112 ms
6,676 KB
testcase_16 AC 113 ms
6,676 KB
testcase_17 AC 113 ms
6,676 KB
testcase_18 AC 113 ms
6,676 KB
testcase_19 AC 113 ms
6,676 KB
testcase_20 AC 122 ms
6,676 KB
testcase_21 AC 36 ms
6,676 KB
testcase_22 AC 61 ms
6,676 KB
testcase_23 AC 77 ms
6,676 KB
testcase_24 AC 93 ms
6,676 KB
testcase_25 AC 9 ms
6,676 KB
testcase_26 AC 56 ms
6,676 KB
testcase_27 AC 110 ms
6,676 KB
testcase_28 AC 82 ms
6,676 KB
testcase_29 AC 55 ms
6,676 KB
testcase_30 AC 11 ms
6,676 KB
testcase_31 AC 94 ms
6,676 KB
testcase_32 AC 17 ms
6,676 KB
testcase_33 AC 85 ms
6,676 KB
testcase_34 AC 53 ms
6,676 KB
testcase_35 AC 101 ms
6,676 KB
testcase_36 AC 94 ms
6,676 KB
testcase_37 AC 111 ms
6,676 KB
testcase_38 AC 104 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<cassert>
#include<atcoder/modint>
using namespace std;
using mint=atcoder::modint998244353;
int N;
mint X[3<<17],Y[3<<17];
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int T;cin>>T;
	for(;T--;)
	{
		cin>>N;
		mint A1=0,A2=0;
		mint B1=0,B2=0;
		mint C1=0,C2=0;
		mint D1=0;
		mint E1=0;
		mint F1=0;
		for(int i=0;i<N;i++)
		{
			int x,y;cin>>x>>y;
			X[i]=x,Y[i]=y;
			mint sz=(X[i]*X[i]+Y[i]*Y[i]).inv();
			mint sz2=sz*sz;
			A1+=X[i]*X[i];
			A2+=X[i]*X[i]*sz2;
			B1+=X[i]*Y[i];
			B2+=X[i]*Y[i]*sz2;
			C1+=Y[i]*Y[i];
			C2+=Y[i]*Y[i]*sz2;
			D1+=X[i]*X[i]*sz;
			E1+=X[i]*Y[i]*sz;
			F1+=Y[i]*Y[i]*sz;
		}
		mint ans=0;
		ans+=A1*A2;
		ans+=2*B1*B2;
		ans+=C1*C2;
		ans-=D1*D1;
		ans-=2*E1*E1;
		ans-=F1*F1;
		ans+=C1*A2;
		ans-=2*B1*B2;
		ans+=A1*C2;
		ans+=D1*F1;
		ans-=2*E1*E1;
		ans+=D1*F1;
		cout<<ans.val()<<"\n";
	}
}
0