結果

問題 No.2517 Right Triangles on Circle
ユーザー eve__fuyukieve__fuyuki
提出日時 2023-11-29 04:41:14
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 312 ms / 2,000 ms
コード長 614 bytes
コンパイル時間 2,210 ms
コンパイル使用メモリ 208,312 KB
実行使用メモリ 18,560 KB
最終ジャッジ日時 2023-11-29 04:41:24
合計ジャッジ時間 6,823 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 1 ms
6,676 KB
testcase_04 AC 2 ms
6,676 KB
testcase_05 AC 2 ms
6,676 KB
testcase_06 AC 2 ms
6,676 KB
testcase_07 AC 2 ms
6,676 KB
testcase_08 AC 2 ms
6,676 KB
testcase_09 AC 2 ms
6,676 KB
testcase_10 AC 2 ms
6,676 KB
testcase_11 AC 2 ms
6,676 KB
testcase_12 AC 1 ms
6,676 KB
testcase_13 AC 303 ms
18,560 KB
testcase_14 AC 172 ms
18,560 KB
testcase_15 AC 312 ms
18,560 KB
testcase_16 AC 214 ms
18,560 KB
testcase_17 AC 227 ms
15,872 KB
testcase_18 AC 200 ms
14,976 KB
testcase_19 AC 171 ms
13,696 KB
testcase_20 AC 182 ms
13,824 KB
testcase_21 AC 290 ms
18,432 KB
testcase_22 AC 62 ms
7,552 KB
testcase_23 AC 183 ms
14,336 KB
testcase_24 AC 70 ms
8,448 KB
testcase_25 AC 30 ms
6,912 KB
testcase_26 AC 232 ms
16,256 KB
testcase_27 AC 34 ms
7,296 KB
testcase_28 AC 27 ms
6,676 KB
testcase_29 AC 66 ms
8,320 KB
testcase_30 AC 37 ms
6,676 KB
testcase_31 AC 194 ms
14,208 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
void fast_io() {
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
}

int main() {
    fast_io();
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    set<int> st;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        a[i] %= m;
        st.insert(a[i]);
    }
    if (m % 2) {
        cout << 0 << endl;
        return 0;
    }
    long long ans = 0;
    for (int i = 0; i < n; i++) {
        int x = (m / 2 + a[i]) % m;
        if (st.find(x) != st.end()) {
            ans += n - 2;
        }
    }
    ans /= 2;
    cout << ans << endl;
}
0