結果
| 問題 | 
                            No.2517 Right Triangles on Circle
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2023-10-27 21:32:28 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 170 ms / 2,000 ms | 
| コード長 | 525 bytes | 
| コンパイル時間 | 1,658 ms | 
| コンパイル使用メモリ | 198,320 KB | 
| 最終ジャッジ日時 | 2025-02-17 14:37:49 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 29 | 
ソースコード
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
using namespace std;
int main() {
  cin.tie(0); cout.tie(0);
  ios::sync_with_stdio(false);
  int N, M;
  cin >> N >> M;
  set<int> st;
  for(int i = 0; i < N; i++) {
    int A;
    cin >> A;
    st.insert(A);
  }
  if(M % 2 == 1) {
    cout << 0 << '\n';
  } else {
    long long ans = 0;
    for(int x : st) {
      if(st.find(x + M / 2) != st.end()) {
        ans += N - 2;
      }
    }
    cout << ans << '\n';
  }
  return 0;
}