結果

問題 No.2260 Adic Sum
ユーザー cho435cho435
提出日時 2023-04-07 21:43:00
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,259 ms / 2,000 ms
コード長 398 bytes
コンパイル時間 2,387 ms
コンパイル使用メモリ 203,368 KB
実行使用メモリ 10,028 KB
最終ジャッジ日時 2024-04-15 23:49:47
合計ジャッジ時間 10,822 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 3 ms
6,940 KB
testcase_09 AC 3 ms
6,940 KB
testcase_10 AC 3 ms
6,940 KB
testcase_11 AC 2 ms
6,944 KB
testcase_12 AC 4 ms
6,940 KB
testcase_13 AC 4 ms
6,940 KB
testcase_14 AC 35 ms
6,944 KB
testcase_15 AC 51 ms
6,988 KB
testcase_16 AC 29 ms
6,940 KB
testcase_17 AC 59 ms
7,332 KB
testcase_18 AC 693 ms
9,344 KB
testcase_19 AC 775 ms
9,836 KB
testcase_20 AC 556 ms
9,600 KB
testcase_21 AC 552 ms
9,728 KB
testcase_22 AC 407 ms
9,600 KB
testcase_23 AC 227 ms
9,988 KB
testcase_24 AC 713 ms
9,856 KB
testcase_25 AC 96 ms
9,344 KB
testcase_26 AC 100 ms
9,216 KB
testcase_27 AC 100 ms
9,600 KB
testcase_28 AC 96 ms
9,472 KB
testcase_29 AC 98 ms
9,600 KB
testcase_30 AC 82 ms
7,168 KB
testcase_31 AC 234 ms
9,984 KB
testcase_32 AC 228 ms
10,028 KB
testcase_33 AC 82 ms
9,856 KB
testcase_34 AC 175 ms
9,856 KB
testcase_35 AC 1,259 ms
9,856 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
  int n,p;
  cin>>n>>p;
  vector<int> a(n);
  rep(i,n) cin>>a.at(i);
  ll np=p;
  ll ans=0;
  rep(i,32){
    map<int,ll> na;
    rep(i,n) na[a.at(i)%np]++;
    for(auto [nw,nm]:na){
      ans+=nm*(nm-1)/2;
    }
    np*=p;
    if(np>1e10) break;
  }
  cout<<ans<<endl;
}
0