結果

問題 No.2260 Adic Sum
ユーザー tsugutsugutsugutsugu
提出日時 2023-04-07 21:26:12
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 895 ms / 2,000 ms
コード長 493 bytes
コンパイル時間 1,828 ms
コンパイル使用メモリ 170,200 KB
実行使用メモリ 8,320 KB
最終ジャッジ日時 2024-04-15 23:39:23
合計ジャッジ時間 8,006 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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,944 KB
testcase_09 AC 3 ms
6,944 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 3 ms
6,940 KB
testcase_14 AC 23 ms
6,940 KB
testcase_15 AC 33 ms
6,940 KB
testcase_16 AC 19 ms
6,940 KB
testcase_17 AC 36 ms
6,940 KB
testcase_18 AC 506 ms
7,992 KB
testcase_19 AC 552 ms
8,320 KB
testcase_20 AC 361 ms
8,064 KB
testcase_21 AC 365 ms
8,192 KB
testcase_22 AC 299 ms
7,936 KB
testcase_23 AC 193 ms
8,320 KB
testcase_24 AC 511 ms
8,320 KB
testcase_25 AC 57 ms
8,024 KB
testcase_26 AC 56 ms
7,812 KB
testcase_27 AC 59 ms
8,192 KB
testcase_28 AC 58 ms
7,936 KB
testcase_29 AC 58 ms
7,936 KB
testcase_30 AC 64 ms
6,944 KB
testcase_31 AC 174 ms
6,940 KB
testcase_32 AC 169 ms
6,944 KB
testcase_33 AC 62 ms
8,192 KB
testcase_34 AC 171 ms
8,240 KB
testcase_35 AC 895 ms
8,192 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, p;
    cin >> n >> p;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    long long np = p;
    long long ans = 0;
    while (np < 1001001001) {
        map<int, int> mp;
        for (int i = 0; i < n; i++) {
            ans += mp[a[i] % np];
            mp[a[i] % np]++;
        }
        np *= p;
    }
    cout << ans << '\n';
}
0