結果

問題 No.2517 Right Triangles on Circle
ユーザー FplusFplusFFplusFplusF
提出日時 2023-10-27 21:47:21
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 344 ms / 2,000 ms
コード長 850 bytes
コンパイル時間 2,118 ms
コンパイル使用メモリ 212,636 KB
実行使用メモリ 24,260 KB
最終ジャッジ日時 2023-10-27 21:47:28
合計ジャッジ時間 6,983 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 343 ms
24,260 KB
testcase_14 AC 30 ms
5,516 KB
testcase_15 AC 326 ms
24,260 KB
testcase_16 AC 292 ms
24,260 KB
testcase_17 AC 282 ms
20,300 KB
testcase_18 AC 231 ms
19,244 KB
testcase_19 AC 203 ms
17,396 KB
testcase_20 AC 207 ms
17,660 KB
testcase_21 AC 344 ms
23,996 KB
testcase_22 AC 11 ms
4,348 KB
testcase_23 AC 213 ms
18,452 KB
testcase_24 AC 75 ms
10,268 KB
testcase_25 AC 10 ms
4,348 KB
testcase_26 AC 258 ms
20,828 KB
testcase_27 AC 10 ms
4,348 KB
testcase_28 AC 27 ms
6,228 KB
testcase_29 AC 72 ms
10,004 KB
testcase_30 AC 37 ms
7,364 KB
testcase_31 AC 215 ms
18,188 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll,ll>;
using ld=long double;
const ll INF=(1ll<<60);
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(),v.end()
template<class T> void chmin(T &a,T b){
    if(a>b){
        a=b;
    }
}
template<class T> void chmax(T &a,T b){
    if(a<b){
        a=b;
    }
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n,m;
    cin >> n >> m;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    if(m%2==1){
        cout << "0\n";
        return 0;
    }
    map<ll,ll> mp;
    rep(i,n){
        mp[a[i]%m]++;
    }
    ll ans=0;
    for(auto &[k,v]:mp){
        ll x=(k+m/2)%m;
        if(k==x) continue;
        if(mp.find(x)==mp.end()) continue;
        ans+=v*mp[x]*(n-2);
    }
    cout << ans/2 << '\n';
}
0