結果

問題 No.2517 Right Triangles on Circle
ユーザー nono00
提出日時 2023-10-28 05:17:50
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 275 ms / 2,000 ms
コード長 759 bytes
コンパイル時間 2,811 ms
コンパイル使用メモリ 252,916 KB
実行使用メモリ 19,584 KB
最終ジャッジ日時 2024-09-25 16:04:52
合計ジャッジ時間 6,591 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

namespace nono {

struct Init {};

void solve([[maybe_unused]] const Init& init) {
    long long n, m;
    std::cin >> n >> m;
    std::vector<long long> a(n);
    for (int i = 0; i < n; i++) std::cin >> a[i];
    if (m % 2 == 1) {
        std::cout << 0 << std::endl;
        return;
    }
    long long half = m / 2;
    std::set<long long> s(a.begin(), a.end());
    long long ans = 0;
    for (auto v: a) {
        if (s.contains(v + half)) {
            ans += n - 2;
        }
    }
    std::cout << ans << std::endl;
}

}  //  namespace nono

int main() {
    std::cin.tie(0)->sync_with_stdio(0);
    std::cout << std::fixed << std::setprecision(16);

    int t = 1;
    nono::Init init;

    while (t--) nono::solve(init);
}
0