結果
| 問題 | No.2260 Adic Sum |
| コンテスト | |
| ユーザー |
keisuke6
|
| 提出日時 | 2023-04-07 21:26:35 |
| 言語 | C++17(gcc12) (gcc 12.4.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 995 ms / 2,000 ms |
| コード長 | 352 bytes |
| 記録 | |
| コンパイル時間 | 1,869 ms |
| コンパイル使用メモリ | 210,200 KB |
| 実行使用メモリ | 10,368 KB |
| 最終ジャッジ日時 | 2026-06-30 04:27:52 |
| 合計ジャッジ時間 | 8,026 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 33 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
int N,P;
cin>>N>>P;
int ans = 0;
vector<int> S(N);
for(int i=0;i<N;i++) cin>>S[i];
int p = P;
while(P < 1e12){
map<int,int> m;
for(int i=0;i<N;i++) m[S[i]%P]++;
for(auto x:m) ans += x.second*(x.second-1)/2;
P *= p;
}
cout<<ans<<endl;
}
keisuke6