結果

問題 No.2517 Right Triangles on Circle
ユーザー twooimp2twooimp2
提出日時 2023-10-27 21:34:57
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 340 ms / 2,000 ms
コード長 338 bytes
コンパイル時間 1,500 ms
コンパイル使用メモリ 175,936 KB
実行使用メモリ 24,380 KB
最終ジャッジ日時 2023-10-27 21:35:06
合計ジャッジ時間 6,092 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 1 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 207 ms
14,876 KB
testcase_14 AC 297 ms
24,380 KB
testcase_15 AC 333 ms
24,380 KB
testcase_16 AC 340 ms
24,380 KB
testcase_17 AC 221 ms
19,364 KB
testcase_18 AC 209 ms
18,572 KB
testcase_19 AC 169 ms
16,724 KB
testcase_20 AC 182 ms
16,988 KB
testcase_21 AC 325 ms
23,324 KB
testcase_22 AC 63 ms
9,068 KB
testcase_23 AC 200 ms
18,308 KB
testcase_24 AC 84 ms
10,388 KB
testcase_25 AC 55 ms
8,012 KB
testcase_26 AC 238 ms
20,948 KB
testcase_27 AC 60 ms
8,540 KB
testcase_28 AC 32 ms
6,272 KB
testcase_29 AC 81 ms
10,124 KB
testcase_30 AC 45 ms
7,484 KB
testcase_31 AC 228 ms
18,308 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll=long long;

int main(){
  ll n,m;
  cin>>n>>m;
  vector<ll> a(n);
  for(ll i=0;i<n;i++){
    cin>>a[i];
    a[i]*=2;
  }
  map<ll,ll> mp;
  for(ll i=0;i<n;i++){
    mp[a[i]%m]++;
  }
  ll ans=0;
  for(auto u:mp){
    ll v=u.second;
    ans+=(v*(v-1)/2)*(n-v);
  }
  cout<<ans<<endl;
}
0