結果

問題 No.2260 Adic Sum
ユーザー hiro71687khiro71687k
提出日時 2023-04-07 21:32:16
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 773 ms / 2,000 ms
コード長 693 bytes
コンパイル時間 5,221 ms
コンパイル使用メモリ 259,536 KB
実行使用メモリ 10,240 KB
最終ジャッジ日時 2024-04-15 23:45:31
合計ジャッジ時間 9,912 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 1 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 33 ms
6,356 KB
testcase_15 AC 47 ms
7,424 KB
testcase_16 AC 28 ms
6,004 KB
testcase_17 AC 53 ms
7,424 KB
testcase_18 AC 435 ms
9,856 KB
testcase_19 AC 482 ms
10,112 KB
testcase_20 AC 319 ms
9,984 KB
testcase_21 AC 333 ms
10,112 KB
testcase_22 AC 278 ms
9,984 KB
testcase_23 AC 192 ms
10,240 KB
testcase_24 AC 436 ms
10,240 KB
testcase_25 AC 80 ms
9,856 KB
testcase_26 AC 83 ms
9,600 KB
testcase_27 AC 87 ms
10,112 KB
testcase_28 AC 81 ms
9,856 KB
testcase_29 AC 83 ms
9,856 KB
testcase_30 AC 78 ms
7,552 KB
testcase_31 AC 147 ms
8,192 KB
testcase_32 AC 142 ms
8,320 KB
testcase_33 AC 76 ms
10,240 KB
testcase_34 AC 160 ms
10,240 KB
testcase_35 AC 773 ms
10,240 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll=long long;
using ld=long double;
ld pie=3.141592653589793;
ll inf=144494;
ll mod=1000000007;
int main(){
    ll n,p;
    cin >> n >> p;
    vector<ll>a(n);
    for (ll i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    ll now=1;
    ll ans=0;
    for (ll i = 1; i >=0; i++)
    {
        now*=p;
        if (now>1000000000)
        {
            break;
        }
        map<ll,ll>memo;
        for (ll j = 0; j < n; j++)
        {
            memo[a[j]%now]+=1;
        }
        for(auto v:memo){
            ans+=(v.second*(v.second-1))/2;
        }
    }
    cout << ans << endl;
}
0