結果

問題 No.2260 Adic Sum
ユーザー keisuke6keisuke6
提出日時 2023-04-07 21:26:35
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,203 ms / 2,000 ms
コード長 352 bytes
コンパイル時間 2,450 ms
コンパイル使用メモリ 202,588 KB
実行使用メモリ 10,368 KB
最終ジャッジ日時 2024-04-15 23:40:34
合計ジャッジ時間 10,261 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 3 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 4 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 4 ms
5,376 KB
testcase_13 AC 4 ms
5,376 KB
testcase_14 AC 34 ms
6,144 KB
testcase_15 AC 48 ms
7,168 KB
testcase_16 AC 27 ms
5,752 KB
testcase_17 AC 74 ms
7,552 KB
testcase_18 AC 737 ms
9,728 KB
testcase_19 AC 802 ms
10,368 KB
testcase_20 AC 522 ms
9,984 KB
testcase_21 AC 522 ms
9,984 KB
testcase_22 AC 428 ms
9,856 KB
testcase_23 AC 269 ms
10,240 KB
testcase_24 AC 763 ms
10,240 KB
testcase_25 AC 84 ms
9,984 KB
testcase_26 AC 82 ms
9,600 KB
testcase_27 AC 85 ms
9,984 KB
testcase_28 AC 82 ms
9,856 KB
testcase_29 AC 85 ms
9,856 KB
testcase_30 AC 126 ms
10,240 KB
testcase_31 AC 371 ms
10,240 KB
testcase_32 AC 364 ms
10,240 KB
testcase_33 AC 102 ms
10,240 KB
testcase_34 AC 203 ms
10,368 KB
testcase_35 AC 1,203 ms
10,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int N,P;
  cin>>N>>P;
  int ans = 0;
  vector<int> S(N);
  for(int i=0;i<N;i++) cin>>S[i];
  int p = P;
  while(P < 1e12){
    map<int,int> m;
    for(int i=0;i<N;i++) m[S[i]%P]++;
    for(auto x:m) ans += x.second*(x.second-1)/2;
    P *= p;
  }
  cout<<ans<<endl;
}
0