結果

問題 No.2709 1975 Powers
ユーザー kotatsugamekotatsugame
提出日時 2024-03-31 13:41:09
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 748 bytes
コンパイル時間 827 ms
コンパイル使用メモリ 84,828 KB
実行使用メモリ 6,548 KB
最終ジャッジ日時 2024-03-31 13:41:16
合計ジャッジ時間 2,532 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,548 KB
testcase_01 AC 2 ms
6,548 KB
testcase_02 AC 3 ms
6,548 KB
testcase_03 AC 33 ms
6,548 KB
testcase_04 AC 55 ms
6,548 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 2 ms
6,548 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 2 ms
6,548 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 10 ms
6,548 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 31 ms
6,548 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 62 ms
6,548 KB
testcase_26 AC 61 ms
6,548 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];
	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