結果
問題 |
No.2709 1975 Powers
|
ユーザー |
|
提出日時 | 2024-03-31 13:41:09 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 748 bytes |
コンパイル時間 | 876 ms |
コンパイル使用メモリ | 84,844 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-30 18:14:16 |
合計ジャッジ時間 | 2,391 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 9 WA * 16 |
ソースコード
#include<iostream> #include<algorithm> #include<map> #include<cassert> #include<atcoder/modint> using namespace std; using mint=atcoder::modint; int N,P,Q; int A[200]; mint T[200][4]; map<int,int>L[200]; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cin>>N>>P>>Q; mint::set_mod(P); for(int i=0;i<N;i++)cin>>A[i]; for(int i=0;i<N;i++) { T[i][0]=mint(10).pow(A[i]); T[i][1]=mint(9).pow(A[i]); T[i][2]=mint(7).pow(A[i]); T[i][3]=mint(5).pow(A[i]); } for(int i=0;i<N;i++)for(int j=i+1;j<N;j++) { L[j][(T[i][0]+T[j][1]).val()]++; } long ans=0; for(int l=0;l<N;l++)for(int i=l+1;i<N;i++)for(int j=i+1;j<N;j++) { int t=(Q-(T[i][2]+T[j][3])).val(); if(L[l].find(t)!=L[l].end())ans+=L[l][t]; } cout<<ans<<endl; }