結果
問題 | No.2260 Adic Sum |
ユーザー |
![]() |
提出日時 | 2023-04-07 21:26:35 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 352 bytes |
コンパイル時間 | 8,553 ms |
コンパイル使用メモリ | 263,916 KB |
最終ジャッジ日時 | 2025-02-12 00:19:53 |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 32 TLE * 1 |
ソースコード
#include <bits/stdc++.h>using namespace std;#define int long longsigned 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;}