結果
問題 | No.2260 Adic Sum |
ユーザー |
![]() |
提出日時 | 2023-04-07 21:22:23 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 891 ms / 2,000 ms |
コード長 | 409 bytes |
コンパイル時間 | 2,151 ms |
コンパイル使用メモリ | 174,356 KB |
実行使用メモリ | 8,448 KB |
最終ジャッジ日時 | 2024-10-06 06:52:08 |
合計ジャッジ時間 | 7,734 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 33 |
ソースコード
#include <bits/stdc++.h>using namespace std;int main(){int N, P;cin >> N >> P;vector<int> A(N);for (int i = 0; i < N; i++){cin >> A[i];}long long ans = 0;long long x = P;while (true){map<int, int> mp;for (int i = 0; i < N; i++){ans += mp[A[i] % x];mp[A[i] % x]++;}x *= P;if (x > 1000000000){break;}}cout << ans << endl;}