結果

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

ソースコード

diff #

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

int main(){
	int n,m;
	cin>>n>>m;
	vector<int> a(n);
	rep(i,n) cin>>a.at(i);
	if(m&1){
		cout<<0<<endl;
		return 0;
	}
	rep(i,n) a.at(i)%=m;
	set<int> st;
	rep(i,n) st.insert(a.at(i));
	ll ans=0;
	rep(i,n){
		if(st.count((a.at(i)+m/2)%m)) ans+=n-2;
	}
	cout<<ans/2<<endl;
}
0