結果

問題 No.2651 [Cherry 6th Tune B] $\mathbb{C}$omplex комбинат
ユーザー otoshigootoshigo
提出日時 2024-02-23 23:04:52
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 120 ms / 2,500 ms
コード長 1,273 bytes
コンパイル時間 971 ms
コンパイル使用メモリ 82,864 KB
実行使用メモリ 6,912 KB
最終ジャッジ日時 2024-02-23 23:05:07
合計ジャッジ時間 6,490 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 108 ms
6,676 KB
testcase_03 AC 109 ms
6,676 KB
testcase_04 AC 106 ms
6,676 KB
testcase_05 AC 108 ms
6,676 KB
testcase_06 AC 107 ms
6,676 KB
testcase_07 AC 107 ms
6,676 KB
testcase_08 AC 113 ms
6,676 KB
testcase_09 AC 109 ms
6,676 KB
testcase_10 AC 108 ms
6,676 KB
testcase_11 AC 107 ms
6,676 KB
testcase_12 AC 108 ms
6,676 KB
testcase_13 AC 108 ms
6,676 KB
testcase_14 AC 107 ms
6,676 KB
testcase_15 AC 107 ms
6,676 KB
testcase_16 AC 107 ms
6,676 KB
testcase_17 AC 108 ms
6,676 KB
testcase_18 AC 108 ms
6,676 KB
testcase_19 AC 109 ms
6,676 KB
testcase_20 AC 120 ms
6,676 KB
testcase_21 AC 33 ms
6,676 KB
testcase_22 AC 58 ms
6,676 KB
testcase_23 AC 74 ms
6,676 KB
testcase_24 AC 90 ms
6,676 KB
testcase_25 AC 7 ms
6,676 KB
testcase_26 AC 53 ms
6,676 KB
testcase_27 AC 108 ms
6,784 KB
testcase_28 AC 80 ms
6,676 KB
testcase_29 AC 34 ms
6,676 KB
testcase_30 AC 9 ms
6,676 KB
testcase_31 AC 100 ms
6,676 KB
testcase_32 AC 15 ms
6,676 KB
testcase_33 AC 82 ms
6,676 KB
testcase_34 AC 50 ms
6,676 KB
testcase_35 AC 97 ms
6,676 KB
testcase_36 AC 97 ms
6,676 KB
testcase_37 AC 108 ms
6,912 KB
testcase_38 AC 103 ms
6,912 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include<vector>
#include<atcoder/modint>
using namespace std;
using ll=long long;
using mint=atcoder::modint998244353;
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
template<class T> bool chmax(T &a, T b){if (a < b){a = b;return true;} else return false;}
template<class T> bool chmin(T &a, T b){if (a > b){a = b;return true;} else return false;}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int T;
    cin>>T;
    while(T--){
        int N;
        cin>>N;
        vector<int>X(N),Y(N);
        for(int i=0;i<N;i++)cin>>X[i]>>Y[i];
        vector<mint>Z(N);
        for(int i=0;i<N;i++)Z[i]=1/(mint)(X[i]*X[i]+Y[i]*Y[i]);
        mint ans=0;
        for(int t=0;t<2;t++){
            mint xp=0,xq=0,yp=0,yq=0;
            for(int i=0;i<N;i++){
                if(t==0){
                    xp+=X[i]*X[i]+Y[i]*Y[i];
                    yp+=Z[i];
                }else{
                    xp+=(X[i]*X[i]-Y[i]*Y[i])*Z[i];
                    xq+=-2*X[i]*Y[i]*Z[i];
                    yp+=(X[i]*X[i]-Y[i]*Y[i])*Z[i];
                    yq+=2*X[i]*Y[i]*Z[i];
                }
            }
            ans+=(t==0?1:-1)*(xp*yp-xq*yq);
        }
        cout<<ans.val()<<"\n";
    }
}
0