結果

問題 No.2517 Right Triangles on Circle
ユーザー srjywrdnprkt
提出日時 2023-11-29 19:19:41
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 323 ms / 2,000 ms
コード長 483 bytes
コンパイル時間 1,982 ms
コンパイル使用メモリ 198,656 KB
最終ジャッジ日時 2025-02-18 02:23:58
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

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

    ll N, M, A, ans=0;
    cin >> N >> M;
    set<ll> st;
    if (M % 2 == 1){
        cout << 0 << endl;
        return 0;
    }
    for (int i=0; i<N; i++){
        cin >> A;
        A %= M;
        st.insert(A);
    }

    for (auto x : st){
        if (st.count((x+M/2)%M)) ans += N-2;
    }
    cout << ans/2 << endl;

    return 0;
}
0