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