結果

問題 No.2709 1975 Powers
ユーザー mizuho0613mizuho0613
提出日時 2024-03-31 14:59:33
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 6,684 bytes
コンパイル時間 5,360 ms
コンパイル使用メモリ 313,304 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-09-30 20:09:21
合計ジャッジ時間 13,159 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,820 KB
testcase_02 AC 6 ms
6,816 KB
testcase_03 AC 345 ms
6,816 KB
testcase_04 AC 574 ms
6,820 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 2 ms
6,820 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 2 ms
6,820 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 57 ms
6,816 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 676 ms
6,820 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 677 ms
6,816 KB
testcase_26 AC 676 ms
6,820 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#include<random>
#include<atcoder/all>

#define start_template                 \
    cin.tie(nullptr);                  \
    cout.tie(nullptr);                 \
    ios::sync_with_stdio(false);       \
    cout<<fixed<<setprecision(15);     \
    srand((unsigned)time(NULL));
#define rep(i,n) for(ll i=0;i<(ll)(n);++i)
#define rep1(i,n) for(ll i=1;i<=(ll)(n);++i)
#define rep2(i,m,n) for(ll i=(ll)(m);i<(ll)(n);++i)
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;--i)
#define rrep1(i,n) for(ll i=(ll)(n);i>0;--i)
#define rrep2(i,m,n) for(ll i=(ll)(m);i>n;--i)
#define _GLIBCXX_DEBUG
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define SORT(a) sort(all(a));
#define RSORT(a) sort(rall(a));
#define REV(a) reverse(all(a));
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a) accumulate(all(a),0LL)
#define lb(a,x) static_cast<int>(lower_bound(all(a),x)-a.begin())
#define ub(a,x) static_cast<int>(upper_bound(all(a),x)-a.begin())
#define SZ(a) ll(a.size())
#define CEIL(x,y) (x+y-1)/y
#define smallexpect(a,b) (a%smallMOD)*pow_mod(b,smallMOD-2,smallMOD)%smallMOD
#define bigexpect(a,b) (a%bigMOD)*pow_mod(b,bigMOD-2,bigMOD)%bigMOD
#define pf push_front
#define pb push_back
#define eb emplace_back
#define ppf pop_front()
#define ppb pop_back()
#define fi first
#define se second
#define INT(...) int __VA_ARGS__;scan(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;scan(__VA_ARGS__)
#define STRING(...) string __VA_ARGS__;scan(__VA_ARGS__)
#define CHAR(...) char __VA_ARGS__;scan(__VA_ARGS__)
#define DOUBLE(...) double __VA_ARGS__;scan(__VA_ARGS__)
#define LD(...) ld __VA_ARGS__;scan(__VA_ARGS__)
#define YES print("YES");
#define Yes print("Yes");
#define yes print("yes");
#define NO print("NO");
#define No print("No");
#define no print("no");
#define YESNO {print("YES");}else{print("NO");}
#define YesNo {print("Yes");}else{print("No");}
#define yesno {print("yes");}else{print("no");}
#define TA {print("Takahashi");}else{print("Aoki");}

using namespace std;using namespace atcoder;
using ull=unsigned long long;using ll=long long;using ld=long double;using i7=__int128_t;
using pii=pair<int,int>;using pid=pair<int,ld>;using pis=pair<int,string>;using pll=pair<ll,ll>;
using pld=pair<ll,ld>;using pls=pair<ll,string>;using pdi=pair<ld,int>;using pdl=pair<ld,ll>;
using pdd=pair<ld,ld>;using pds=pair<ld,string>;using psi=pair<string, int>;using psl=pair<string,ll>;
using psd=pair<string,ld>;using pss=pair<string, string>;using mii=map<int, int>;using mid=map<int,ld>;
using mis=map<int,string>;using mll=map<ll,ll>;using mld=map<ll,ld>;using mls=map<ll,string>;using mli=map<ll,int>;
using mdi=map<ld,int>;using mdl=map<ld,ll>;using mdd=map<ld,ld>;using mds=map<ld,string>;using mil=map<int,ll>;
using msi=map<string, int>;using msl=map<string, ll>;using msd=map<string,ld>;using mss=map<string,string>;
using vi=vector<int>;using vi7=vector<i7>;using vs=vector<string>;using vl=vector<ll>;using vc=vector<char>;
using vb=vector<bool>;using vd=vector<ld>;using vpii=vector<pii>;using vpll=vector<pll>;using vpsi=vector<psi>;
using vpis=vector<pis>;using si=set<int>;using sl=set<ll>;using sc=set<char>;using ss=set<string>;
using sd=set<ld>;using vvi=vector<vi>;using vvi7=vector<vi7>;using vvl=vector<vl>;using vvc=vector<vc>;
using vvs=vector<vs>;using vvb=vector<vb>;using vvd=vector<vd>;using vvpii=vector<vpii>;using vvpll=vector<vpll>;
using vsi=vector<si>;using vsl=vector<sl>;using vvvi=vector<vvi>;using vvvi7=vector<vvi7>;using vvvl=vector<vvl>;
using vvvc=vector<vvc>;using vvvb=vector<vvb>;using vvvd=vector<vvd>;using mint=modint998244353;
using vvvvi=vector<vvvi>;using vvvvl=vector<vvvl>;using vvvvi7=vector<vvvi7>;using vvvvc=vector<vvvc>;
using vvvvb=vector<vvvb>;using vvvvd=vector<vvvd>;using vmii=vector<mii>;using vmil=vector<mil>;using vmli=vector<mli>;
using vmll=vector<mll>;using vmsi=vector<msi>;using vmsl=vector<msl>;using vmis=vector<mis>;using vmls=vector<mls>;
using vmss=vector<mss>;using vmid=vector<mid>;using vmdi=vector<mdi>;using vmdd=vector<mdd>;using vmld=vector<mld>;
using vmdl=vector<mdl>;using vmds=vector<mds>;using vmsd=vector<msd>;

void scan(){}
template<class T>void scan(vector<T> &v){
    for(T &t:v)cin>>t;
}
template<class T>void scan(vector<vector<T>> &v){
    for(auto &row:v)for(T&element:row)cin>>element;
}
template<class Head, class... Tail>void scan(Head &head, Tail &...tail){
    cin>>head;scan(tail...);
}
template<class T>void print(const T &t){
    cout<<t<<endl;
}
template<class Head,class...Tail>void print(const Head &head, const Tail &...tail){
    cout<<head;print(tail...);
}
template<class T>void vecout1(const vector<T> &v,char div='\n'){
    rep(i,v.size())cout<<v[i]<<(i==ll(v.size()-1)?div:' ');
}
template<class T>void vecout2(const vector<T> &v,char div='\n'){
    rep(i,v.size())cout<<v[i]<<div;
}
template<class T>void operator++(vector<T> &v,int){for(T &t:v)t++;}
template<class T>void operator--(vector<T> &v,int){for(T &t:v)t--;}
template<class T>void operator+=(vector<T> &v,T x){for(T &t:v)t+=x;}
template<class T>void operator-=(vector<T> &v,T x){for (T &t:v)t-=x;}
template<class T>void operator*=(vector<T> &v,T x){for(T &t:v)t*=x;}
template<class T>void operator/=(vector<T> &v,T x){for(T &t:v)t/=x;}
template<typename T>bool chmax(T &a, T b){return((a<b)?(a=b,true):(false));}
template<typename T>bool chmin(T &a, T b){return((a>b)?(a=b,true):(false));}
template<class T>void uni(T &a){
    sort(all(a));
    a.erase(unique(all(a)),a.end());
}

const ld PI=3.1415926535897932;
const int INF=INT_MAX-314159;const ll LINF=LLONG_MAX-3141592653;
const int bigMOD=1000000007;int smallMOD=998244353;
const int dx[]={-1,0,1,0,-1,1,1,-1};const int dy[]={0,1,0,-1,1,1,-1,-1};
const string ALPHA="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const string alpha="abcdefghijklmnopqrstuvwxyz";
/*--------------------------------------------------------------------------------------------------------------------------*/
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
/*--------------------------------------------------------------------------------------------------------------------------*/
int main(){
    start_template

    LL(n,p,q);vl a(n);scan(a);ll cnt=0;
    vvl list(4,vl(n));vl b={10,9,7,5};
    rep(i,4){
        rep(j,n){
            list[i][j]=modpow(b[i],a[j],p);
        }
    }
    rep(i,n-3)rep2(j,i+1,n-2)rep2(k,j+1,n-1)rep2(l,k+1,n){
        if((list[0][i]+list[1][j]+list[2][k]+list[3][l])%p==q){
            cnt++;
        }
    }
    print(cnt);
}
0