結果
問題 | No.2260 Adic Sum |
ユーザー |
|
提出日時 | 2023-04-07 21:26:12 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 891 ms / 2,000 ms |
コード長 | 493 bytes |
コンパイル時間 | 1,683 ms |
コンパイル使用メモリ | 174,096 KB |
実行使用メモリ | 8,320 KB |
最終ジャッジ日時 | 2024-10-06 06:56:45 |
合計ジャッジ時間 | 7,637 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 33 |
ソースコード
#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';}