結果

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

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
typedef long long ll;
using namespace std;

int main() {
    cin.tie(0)->sync_with_stdio(0);

    int N, M;
    cin >> N >> M;
    set<ll> st;
    rep(i, N) {
        ll a;
        cin >> a;
        st.insert(a * 2);
    }

    ll ans = 0;
    for (ll s : st) {
        ll x = s + M;
        if (st.find(x) != st.end())
            ans += N - 2;
    }

    cout << ans << "\n";

    return 0;
}
0