結果
| 問題 |
No.2260 Adic Sum
|
| コンテスト | |
| ユーザー |
planes
|
| 提出日時 | 2023-04-07 21:33:10 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 1,003 ms / 2,000 ms |
| コード長 | 472 bytes |
| コンパイル時間 | 1,761 ms |
| コンパイル使用メモリ | 175,860 KB |
| 実行使用メモリ | 10,368 KB |
| 最終ジャッジ日時 | 2024-10-06 07:05:40 |
| 合計ジャッジ時間 | 8,819 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 33 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
ll INF=2e18;
int main() {
ll N,P;cin>>N>>P;
vector<ll> A(N);
for(ll i=0;i<N;i++) cin>>A[i];
ll now=1;
ll ans=0;
while(now<=1000000000) {
now*=P;
map<ll,ll> S;
for(ll i=0;i<N;i++) {
ll k=A[i]%now;
ans+=S[k];
S[k]++;
}
}
cout<<ans<<endl;
}
planes