結果

問題 No.2651 [Cherry 6th Tune B] $\mathbb{C}$omplex комбинат
ユーザー coindarwcoindarw
提出日時 2024-02-28 10:29:06
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,020 ms / 2,500 ms
コード長 1,643 bytes
コンパイル時間 6,767 ms
コンパイル使用メモリ 315,424 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-02-28 10:29:48
合計ジャッジ時間 39,004 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 922 ms
6,676 KB
testcase_03 AC 954 ms
6,676 KB
testcase_04 AC 933 ms
6,676 KB
testcase_05 AC 907 ms
6,676 KB
testcase_06 AC 908 ms
6,676 KB
testcase_07 AC 934 ms
6,676 KB
testcase_08 AC 934 ms
6,676 KB
testcase_09 AC 908 ms
6,676 KB
testcase_10 AC 910 ms
6,676 KB
testcase_11 AC 929 ms
6,676 KB
testcase_12 AC 934 ms
6,676 KB
testcase_13 AC 908 ms
6,676 KB
testcase_14 AC 933 ms
6,676 KB
testcase_15 AC 908 ms
6,676 KB
testcase_16 AC 937 ms
6,676 KB
testcase_17 AC 933 ms
6,676 KB
testcase_18 AC 908 ms
6,676 KB
testcase_19 AC 935 ms
6,676 KB
testcase_20 AC 1,020 ms
6,676 KB
testcase_21 AC 270 ms
6,676 KB
testcase_22 AC 503 ms
6,676 KB
testcase_23 AC 615 ms
6,676 KB
testcase_24 AC 780 ms
6,676 KB
testcase_25 AC 50 ms
6,676 KB
testcase_26 AC 438 ms
6,676 KB
testcase_27 AC 918 ms
6,676 KB
testcase_28 AC 660 ms
6,676 KB
testcase_29 AC 280 ms
6,676 KB
testcase_30 AC 62 ms
6,676 KB
testcase_31 AC 751 ms
6,676 KB
testcase_32 AC 113 ms
6,676 KB
testcase_33 AC 680 ms
6,676 KB
testcase_34 AC 440 ms
6,676 KB
testcase_35 AC 818 ms
6,676 KB
testcase_36 AC 796 ms
6,676 KB
testcase_37 AC 931 ms
6,676 KB
testcase_38 AC 900 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#include <atcoder/all>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define all(v) begin(v), end(v)
using namespace std;
using namespace atcoder;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    using mint = modint998244353;
    using P = pair<mint, mint>;
    int Q;
    cin >> Q;
    while (Q--) {
        int n;
        cin >> n;
        vector<P> z(n);
        rep(i, n) {
            int l, r;
            cin >> l >> r;
            z[i] = {l, r};
        }
        mint A = 0, B = 0, C = 0, D = 0, E = 0, F = 0, G = 0;
        rep(i, n) {
            auto [x, y] = z[i];
            mint xxyy = x * x + y * y;
            A += (2 * x * x) / xxyy;
            B += (8 * x * y) / xxyy;
            C += (2 * y * y) / xxyy;
            D += x * x;
            E += y * y;
            F += x * x / xxyy / xxyy;
            G += y * y / xxyy / xxyy;
        }

        mint ans = 0;
        rep(i, n) {
            auto [a, b] = z[i];
            mint aabb = a * a + b * b;
            ans += -A * (a * a) / aabb;
            ans += A * (b * b) / aabb;
            ans += -B * a * b / aabb;
            ans += C * (a * a) / aabb;
            ans += -C * (b * b) / aabb;
            ans += D * (a * a) / aabb / aabb;
            ans += D * (b * b) / aabb / aabb;
            ans += E * (a * a) / aabb / aabb;
            ans += E * (b * b) / aabb / aabb;
            ans += F * (a * a);
            ans += F * (b * b);
            ans += G * (a * a);
            ans += G * (b * b);
        }
        ans /= 2;
        cout << ans.val() << endl;
    }
    return 0;
}
0