結果

問題 No.2517 Right Triangles on Circle
ユーザー umezo
提出日時 2023-10-27 22:36:26
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 185 ms / 2,000 ms
コード長 510 bytes
コンパイル時間 1,933 ms
コンパイル使用メモリ 202,088 KB
最終ジャッジ日時 2025-02-17 15:27:38
ジャッジサーバーID
(参考情報)
judge5 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
 
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  ll n,m;
  cin>>n>>m;
  vector<int> A(n);
  set<int> s;
  rep(i,n){
    cin>>A[i];
    s.insert(A[i]);
  }
  sort(ALL(A));
  
  if(m%2){
    cout<<0<<endl;
    return 0;
  }
  
  m/=2;
  ll cnt=0;
  rep(i,n-1){
    if(s.count(m+A[i])) cnt++;
  }
  cout<<cnt*(n-2)<<endl;
    
  return 0;
}
0