結果

問題 No.2260 Adic Sum
ユーザー planesplanes
提出日時 2023-04-07 21:33:10
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 991 ms / 2,000 ms
コード長 472 bytes
コンパイル時間 1,836 ms
コンパイル使用メモリ 171,448 KB
実行使用メモリ 10,240 KB
最終ジャッジ日時 2024-04-15 23:45:42
合計ジャッジ時間 9,712 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,816 KB
testcase_01 AC 1 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 4 ms
6,940 KB
testcase_09 AC 3 ms
6,940 KB
testcase_10 AC 4 ms
6,944 KB
testcase_11 AC 2 ms
6,944 KB
testcase_12 AC 4 ms
6,944 KB
testcase_13 AC 4 ms
6,944 KB
testcase_14 AC 52 ms
6,944 KB
testcase_15 AC 73 ms
7,168 KB
testcase_16 AC 44 ms
6,944 KB
testcase_17 AC 86 ms
7,560 KB
testcase_18 AC 586 ms
9,728 KB
testcase_19 AC 639 ms
10,112 KB
testcase_20 AC 436 ms
10,112 KB
testcase_21 AC 445 ms
10,112 KB
testcase_22 AC 387 ms
9,984 KB
testcase_23 AC 289 ms
10,240 KB
testcase_24 AC 611 ms
10,240 KB
testcase_25 AC 134 ms
9,728 KB
testcase_26 AC 141 ms
9,600 KB
testcase_27 AC 152 ms
9,984 KB
testcase_28 AC 138 ms
9,856 KB
testcase_29 AC 136 ms
9,728 KB
testcase_30 AC 142 ms
10,240 KB
testcase_31 AC 247 ms
10,240 KB
testcase_32 AC 244 ms
10,240 KB
testcase_33 AC 135 ms
10,240 KB
testcase_34 AC 261 ms
10,240 KB
testcase_35 AC 991 ms
10,240 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

  #include <bits/stdc++.h> 
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 #define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)

ll INF=2e18;

int main() {
  ll N,P;cin>>N>>P;
  vector<ll> A(N);
  for(ll i=0;i<N;i++) cin>>A[i];

  ll now=1;
  ll ans=0;

  while(now<=1000000000) {
    now*=P;
    map<ll,ll> S;
  for(ll i=0;i<N;i++) {
    ll k=A[i]%now;
    ans+=S[k];
    S[k]++;
  }

  }

  cout<<ans<<endl;

}

0