結果

問題 No.2260 Adic Sum
ユーザー ruthenruthen
提出日時 2023-04-07 21:34:41
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 763 bytes
コンパイル時間 2,337 ms
コンパイル使用メモリ 205,264 KB
実行使用メモリ 88,448 KB
最終ジャッジ日時 2024-04-15 23:46:57
合計ジャッジ時間 12,470 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 1 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,944 KB
testcase_09 AC 2 ms
6,944 KB
testcase_10 AC 3 ms
6,940 KB
testcase_11 AC 2 ms
6,940 KB
testcase_12 AC 4 ms
6,940 KB
testcase_13 AC 3 ms
6,944 KB
testcase_14 AC 25 ms
6,940 KB
testcase_15 AC 37 ms
7,168 KB
testcase_16 AC 21 ms
6,944 KB
testcase_17 AC 40 ms
7,424 KB
testcase_18 AC 951 ms
52,864 KB
testcase_19 AC 1,064 ms
55,936 KB
testcase_20 AC 711 ms
37,760 KB
testcase_21 AC 710 ms
38,016 KB
testcase_22 AC 544 ms
32,640 KB
testcase_23 AC 292 ms
20,992 KB
testcase_24 AC 986 ms
51,584 KB
testcase_25 AC 61 ms
9,728 KB
testcase_26 AC 60 ms
9,600 KB
testcase_27 AC 66 ms
9,984 KB
testcase_28 AC 62 ms
9,728 KB
testcase_29 AC 65 ms
9,728 KB
testcase_30 AC 71 ms
8,192 KB
testcase_31 AC 313 ms
12,160 KB
testcase_32 AC 312 ms
12,288 KB
testcase_33 AC 80 ms
10,624 KB
testcase_34 AC 293 ms
31,104 KB
testcase_35 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#ifdef _RUTHEN
#include <debug.hpp>
#else
#define show(...) true
#endif

using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
template <class T> using V = vector<T>;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    long long N, P;
    cin >> N >> P;
    V<long long> A(N);
    rep(i, N) cin >> A[i];
    V<long long> B;
    long long c = 1;
    while (c <= 1000000000LL / P) {
        B.push_back(c * P);
        c *= P;
    }
    show(B);
    int K = B.size();
    long long ans = 0;
    V<map<long long, int>> r(K);
    rep(i, N) {
        rep(j, K) {
            ans += r[j][A[i] % B[j]];
            r[j][A[i] % B[j]]++;
        }
    }
    cout << ans << '\n';
    return 0;
}
0