結果

問題 No.2651 [Cherry 6th Tune B] $\mathbb{C}$omplex комбинат
ユーザー 沙耶花沙耶花
提出日時 2024-02-23 21:54:26
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,114 ms / 2,500 ms
コード長 1,424 bytes
コンパイル時間 5,236 ms
コンパイル使用メモリ 268,476 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-02-23 21:55:11
合計ジャッジ時間 37,860 ms
ジャッジサーバーID
(参考情報)
judge16 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 1,057 ms
6,676 KB
testcase_03 AC 1,038 ms
6,676 KB
testcase_04 AC 1,032 ms
6,676 KB
testcase_05 AC 1,014 ms
6,676 KB
testcase_06 AC 1,064 ms
6,676 KB
testcase_07 AC 1,013 ms
6,676 KB
testcase_08 AC 1,035 ms
6,676 KB
testcase_09 AC 1,014 ms
6,676 KB
testcase_10 AC 1,059 ms
6,676 KB
testcase_11 AC 1,033 ms
6,676 KB
testcase_12 AC 1,010 ms
6,676 KB
testcase_13 AC 1,011 ms
6,676 KB
testcase_14 AC 1,035 ms
6,676 KB
testcase_15 AC 1,017 ms
6,676 KB
testcase_16 AC 1,010 ms
6,676 KB
testcase_17 AC 1,027 ms
6,676 KB
testcase_18 AC 1,011 ms
6,676 KB
testcase_19 AC 1,023 ms
6,676 KB
testcase_20 AC 1,114 ms
6,676 KB
testcase_21 AC 301 ms
6,676 KB
testcase_22 AC 538 ms
6,676 KB
testcase_23 AC 684 ms
6,676 KB
testcase_24 AC 861 ms
6,676 KB
testcase_25 AC 56 ms
6,676 KB
testcase_26 AC 489 ms
6,676 KB
testcase_27 AC 1,022 ms
6,676 KB
testcase_28 AC 743 ms
6,676 KB
testcase_29 AC 313 ms
6,676 KB
testcase_30 AC 70 ms
6,676 KB
testcase_31 AC 832 ms
6,676 KB
testcase_32 AC 126 ms
6,676 KB
testcase_33 AC 781 ms
6,676 KB
testcase_34 AC 458 ms
6,676 KB
testcase_35 AC 930 ms
6,676 KB
testcase_36 AC 841 ms
6,676 KB
testcase_37 AC 1,011 ms
6,676 KB
testcase_38 AC 1,038 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000001
#define Inf64 1000000000000000001


int main(){
	vector<mint> kei = {-2,2,-8,2,-2,1,1,1,1,1,1,1,1};

vector<vector<int>> bunsi = {{2,0,2,0},{0,2,2,0},{1,1,1,1},{2,0,0,2},{0,2,0,2},{2,0,2,0},{0,2,2,0},{2,0,0,2},{0,2,0,2},{2,0,2,0},{2,0,0,2},{0,2,2,0},{0,2,0,2}};
	//cout<<kei.size()<<' '<<bunsi.size()<<endl;
	int _t;
	cin>>_t;
	
	rep(_,_t){
		int n;
		cin>>n;
		vector<mint> x(n),y(n);
		rep(i,n){
			int a,b;
			cin>>a>>b;
			x[i] = a,y[i] = b;
		}
		mint ans = 0;
		rep(k,kei.size()){
			mint sum = 0;
			rep(i,n){
				mint A = x[i] * x[i] + y[i] * y[i];
				{
					mint t = 1;
					t *= x[i].pow(bunsi[k][2]);
					t *= y[i].pow(bunsi[k][3]);
					if(k<5)t /= A;
					else if(k>=9)t /= A*A;
					ans += t * sum * kei[k];
				}
				{
					mint t = 1;
					t *= x[i].pow(bunsi[k][0]);
					t *= y[i].pow(bunsi[k][1]);
					if(k<5)t /= A;
					else if(k<9)t /= A*A;
					sum += t;
				}
				/*
				for(int j=i+1;j<n;j++){
					mint t = 1;
					
					
					
					mint B = x[j] * x[j] + y[j] * y[j];
					if(k<5){
						t /= A*B;
						
					}
					else if(k<9){
						t /= A*A;
						
					}
					else t /= B*B;
					t *= kei[k];
					ans += t;
				}
				*/
			}
		}
		cout<<ans.val()<<endl;
	}
	
	return 0;
}
0