結果

問題 No.2260 Adic Sum
ユーザー karinohitokarinohito
提出日時 2023-03-15 00:43:21
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 414 ms / 2,000 ms
コード長 382 bytes
コンパイル時間 2,288 ms
コンパイル使用メモリ 201,056 KB
実行使用メモリ 9,024 KB
最終ジャッジ日時 2024-04-15 23:36:53
合計ジャッジ時間 7,091 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 1 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 3 ms
5,376 KB
testcase_10 AC 3 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 3 ms
5,376 KB
testcase_13 AC 4 ms
5,376 KB
testcase_14 AC 26 ms
5,376 KB
testcase_15 AC 37 ms
5,864 KB
testcase_16 AC 22 ms
5,376 KB
testcase_17 AC 42 ms
6,012 KB
testcase_18 AC 257 ms
9,016 KB
testcase_19 AC 273 ms
8,916 KB
testcase_20 AC 191 ms
8,900 KB
testcase_21 AC 197 ms
8,908 KB
testcase_22 AC 170 ms
9,024 KB
testcase_23 AC 120 ms
8,448 KB
testcase_24 AC 260 ms
8,924 KB
testcase_25 AC 65 ms
8,308 KB
testcase_26 AC 64 ms
8,304 KB
testcase_27 AC 66 ms
8,320 KB
testcase_28 AC 65 ms
8,312 KB
testcase_29 AC 65 ms
8,304 KB
testcase_30 AC 60 ms
6,032 KB
testcase_31 AC 181 ms
6,480 KB
testcase_32 AC 180 ms
6,356 KB
testcase_33 AC 61 ms
8,340 KB
testcase_34 AC 116 ms
8,464 KB
testcase_35 AC 414 ms
8,916 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){
        unordered_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