結果
問題 | No.2260 Adic Sum |
ユーザー |
|
提出日時 | 2023-04-07 21:41:18 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 375 bytes |
コンパイル時間 | 7,538 ms |
コンパイル使用メモリ | 263,860 KB |
最終ジャッジ日時 | 2025-02-12 00:53:21 |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 TLE * 9 |
ソースコード
#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;}