結果
| 問題 | No.2260 Adic Sum |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-04-07 21:41:18 |
| 言語 | C++17(gcc12) (gcc 12.4.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 1,431 ms / 2,000 ms |
| コード長 | 375 bytes |
| 記録 | |
| コンパイル時間 | 1,486 ms |
| コンパイル使用メモリ | 209,988 KB |
| 実行使用メモリ | 10,112 KB |
| 最終ジャッジ日時 | 2026-06-30 04:39:28 |
| 合計ジャッジ時間 | 22,771 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 33 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for (int i=0;i<(int)(n);i++)
int main(){
int n,p;
cin>>n>>p;
vector<int> a(n);
rep(i,n) cin>>a.at(i);
ll np=p;
ll ans=0;
rep(i,32){
map<int,ll> na;
rep(i,n) na[a.at(i)%np]++;
for(auto [nw,nm]:na){
ans+=nm*(nm-1)/2;
}
np*=p;
}
cout<<ans<<endl;
}