結果

問題 No.2260 Adic Sum
ユーザー karinohitokarinohito
提出日時 2023-03-15 00:32:32
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,009 ms / 2,000 ms
コード長 372 bytes
コンパイル時間 2,160 ms
コンパイル使用メモリ 203,424 KB
実行使用メモリ 9,984 KB
最終ジャッジ日時 2024-04-15 23:35:59
合計ジャッジ時間 9,148 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,812 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,940 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 2 ms
6,944 KB
testcase_08 AC 4 ms
6,944 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 3 ms
6,944 KB
testcase_11 AC 3 ms
6,940 KB
testcase_12 AC 4 ms
6,940 KB
testcase_13 AC 4 ms
6,944 KB
testcase_14 AC 36 ms
6,944 KB
testcase_15 AC 52 ms
7,120 KB
testcase_16 AC 31 ms
6,940 KB
testcase_17 AC 58 ms
7,200 KB
testcase_18 AC 561 ms
9,344 KB
testcase_19 AC 601 ms
9,856 KB
testcase_20 AC 408 ms
9,600 KB
testcase_21 AC 433 ms
9,680 KB
testcase_22 AC 366 ms
9,472 KB
testcase_23 AC 235 ms
9,856 KB
testcase_24 AC 589 ms
9,984 KB
testcase_25 AC 97 ms
9,600 KB
testcase_26 AC 90 ms
9,216 KB
testcase_27 AC 96 ms
9,856 KB
testcase_28 AC 91 ms
9,600 KB
testcase_29 AC 92 ms
9,472 KB
testcase_30 AC 94 ms
7,168 KB
testcase_31 AC 212 ms
7,680 KB
testcase_32 AC 214 ms
7,680 KB
testcase_33 AC 101 ms
9,984 KB
testcase_34 AC 231 ms
9,908 KB
testcase_35 AC 1,009 ms
9,856 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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

    ll an=0;
    ll p=P;
    while(p<1e9+3){
        map<ll,ll> M;
        for(int i=0;i<N;i++){
            an+=M[A[i]%p];
            M[A[i]%p]++;
        }
        p*=P;
    }
    cout<<an<<endl;
    
}
0