結果

問題 No.2709 1975 Powers
ユーザー 👑 NachiaNachia
提出日時 2024-03-31 13:43:26
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 93 ms / 2,000 ms
コード長 878 bytes
コンパイル時間 925 ms
コンパイル使用メモリ 87,852 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-03-31 13:43:34
合計ジャッジ時間 2,680 ms
ジャッジサーバーID
(参考情報)
judge13 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 3 ms
6,676 KB
testcase_03 AC 48 ms
6,676 KB
testcase_04 AC 80 ms
6,676 KB
testcase_05 AC 54 ms
6,676 KB
testcase_06 AC 18 ms
6,676 KB
testcase_07 AC 2 ms
6,676 KB
testcase_08 AC 17 ms
6,676 KB
testcase_09 AC 55 ms
6,676 KB
testcase_10 AC 2 ms
6,676 KB
testcase_11 AC 3 ms
6,676 KB
testcase_12 AC 6 ms
6,676 KB
testcase_13 AC 57 ms
6,676 KB
testcase_14 AC 9 ms
6,676 KB
testcase_15 AC 11 ms
6,676 KB
testcase_16 AC 43 ms
6,676 KB
testcase_17 AC 2 ms
6,676 KB
testcase_18 AC 7 ms
6,676 KB
testcase_19 AC 78 ms
6,676 KB
testcase_20 AC 2 ms
6,676 KB
testcase_21 AC 17 ms
6,676 KB
testcase_22 AC 93 ms
6,676 KB
testcase_23 AC 93 ms
6,676 KB
testcase_24 AC 93 ms
6,676 KB
testcase_25 AC 93 ms
6,676 KB
testcase_26 AC 93 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <atcoder/modint>
#define rep(i,n) for(int i=0; i<int(n); i++)
#define repr(i,n) for(int i=int(n)-1; i>=0; i--)
using namespace std;

int main(){
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int N, P, Q; cin >> N >> P >> Q;
    using Modint = atcoder::modint;
    Modint::set_mod(P);
    vector<int> A(N); rep(i,N) cin >> A[i];
    sort(A.begin(), A.end());
    vector<vector<Modint>> X(4, vector<Modint>(N));
    rep(i,N) X[0][i] = Modint(10).pow(A[i]);
    rep(i,N) X[1][i] = Modint(9).pow(A[i]);
    rep(i,N) X[2][i] = Modint(7).pow(A[i]);
    rep(i,N) X[3][i] = Modint(5).pow(A[i]);
    int ans = 0;
    rep(i,N) rep(j,i) rep(k,j) rep(l,k){
        Modint t = X[3][i] + X[2][j] + X[1][k] + X[0][l];
        if(t.val() == Q) ans++;
    }
    cout << ans << '\n';
    return 0;
}
0