結果

問題 No.2709 1975 Powers
ユーザー kotatsugamekotatsugame
提出日時 2024-03-31 13:41:39
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 61 ms / 2,000 ms
コード長 762 bytes
コンパイル時間 874 ms
コンパイル使用メモリ 86,896 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-03-31 13:41:43
合計ジャッジ時間 2,243 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 34 ms
6,676 KB
testcase_04 AC 54 ms
6,676 KB
testcase_05 AC 39 ms
6,676 KB
testcase_06 AC 17 ms
6,676 KB
testcase_07 AC 2 ms
6,676 KB
testcase_08 AC 16 ms
6,676 KB
testcase_09 AC 38 ms
6,676 KB
testcase_10 AC 2 ms
6,676 KB
testcase_11 AC 4 ms
6,676 KB
testcase_12 AC 7 ms
6,676 KB
testcase_13 AC 40 ms
6,676 KB
testcase_14 AC 10 ms
6,676 KB
testcase_15 AC 11 ms
6,676 KB
testcase_16 AC 33 ms
6,676 KB
testcase_17 AC 2 ms
6,676 KB
testcase_18 AC 8 ms
6,676 KB
testcase_19 AC 49 ms
6,676 KB
testcase_20 AC 3 ms
6,676 KB
testcase_21 AC 16 ms
6,676 KB
testcase_22 AC 31 ms
6,676 KB
testcase_23 AC 60 ms
6,676 KB
testcase_24 AC 61 ms
6,676 KB
testcase_25 AC 60 ms
6,676 KB
testcase_26 AC 60 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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];
	sort(A,A+N);
	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;
}
0