結果

問題 No.2260 Adic Sum
ユーザー Carpenters-CatCarpenters-Cat
提出日時 2023-04-07 22:41:15
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 422 ms / 2,000 ms
コード長 551 bytes
コンパイル時間 2,437 ms
コンパイル使用メモリ 201,928 KB
実行使用メモリ 9,420 KB
最終ジャッジ日時 2024-04-15 23:57:00
合計ジャッジ時間 6,640 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,944 KB
testcase_07 AC 2 ms
6,944 KB
testcase_08 AC 3 ms
6,940 KB
testcase_09 AC 2 ms
6,944 KB
testcase_10 AC 3 ms
6,940 KB
testcase_11 AC 3 ms
6,940 KB
testcase_12 AC 3 ms
6,944 KB
testcase_13 AC 4 ms
6,940 KB
testcase_14 AC 26 ms
6,940 KB
testcase_15 AC 38 ms
6,940 KB
testcase_16 AC 23 ms
6,944 KB
testcase_17 AC 42 ms
6,940 KB
testcase_18 AC 258 ms
9,244 KB
testcase_19 AC 278 ms
9,420 KB
testcase_20 AC 199 ms
9,276 KB
testcase_21 AC 199 ms
9,288 KB
testcase_22 AC 173 ms
9,268 KB
testcase_23 AC 119 ms
8,684 KB
testcase_24 AC 273 ms
9,312 KB
testcase_25 AC 65 ms
8,476 KB
testcase_26 AC 67 ms
8,660 KB
testcase_27 AC 68 ms
8,704 KB
testcase_28 AC 67 ms
8,800 KB
testcase_29 AC 67 ms
8,804 KB
testcase_30 AC 60 ms
6,940 KB
testcase_31 AC 160 ms
6,940 KB
testcase_32 AC 160 ms
6,940 KB
testcase_33 AC 60 ms
8,852 KB
testcase_34 AC 86 ms
8,724 KB
testcase_35 AC 422 ms
9,308 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main () {
    int N; ll P;
    cin >> N >> P;
    ll A[200020];
    for (int i = 0; i < N; i ++) cin >> A[i];
    ll xx = 1;
    ll mA = *max_element(A, A + N);
    ll ans = 0;
    for (int aj = 0; aj < 60; aj ++) {
        xx *= P;
        if (xx > mA) {
            break;
        }
        unordered_map<ll, int> mp;
        for (int i = 0; i < N; i ++) {
            ll a = A[i] % xx;
            ans += mp[a];
            mp[a] ++;
        }
    }
    cout << ans << endl;
}
0