結果
問題 |
No.2260 Adic Sum
|
ユーザー |
|
提出日時 | 2024-03-06 22:39:32 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 1,244 ms / 2,000 ms |
コード長 | 554 bytes |
コンパイル時間 | 24,149 ms |
コンパイル使用メモリ | 359,212 KB |
最終ジャッジ日時 | 2025-02-20 01:27:38 |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 33 |
ソースコード
#pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include<bits/stdc++.h> #include<atcoder/all> using namespace std; using namespace atcoder; using ll=long long; void IO(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); } int main(){ IO(); ll n,p; cin>>n>>p; vector<ll> a(n); for(ll i=0;i<n;i++){ cin>>a[i]; } ll mod=p; ll ans=0; while(mod<=1e9){ map<ll,ll> mp; for(ll i=0;i<n;i++){ ans+=mp[a[i]%mod]; mp[a[i]%mod]++; } mod*=p; } cout<<ans<<endl; }