結果

問題 No.2517 Right Triangles on Circle
ユーザー MasKoaTS
提出日時 2023-08-26 17:01:26
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 287 ms / 2,000 ms
コード長 534 bytes
コンパイル時間 2,043 ms
コンパイル使用メモリ 198,996 KB
最終ジャッジ日時 2025-02-16 14:40:30
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
    int n, m;   cin >> n >> m;
    unordered_set<int> a = {};
    for(int i = 0; i < n; ++i){
        int x;  cin >> x;
        a.insert(x);
    }

    if(m & 1){
        cout << 0 << endl;
        return 0;
    }

    ll ans = 0;
    for(auto itr = a.begin(); itr != a.end(); ++itr){
        int x = (*itr) + m / 2;
        if(a.find(x) == a.end()){
            continue;
        }
        ans += n - 2;
    }
    cout << ans << endl;

    return 0;
}
0