Submission #1187651

#TimeUsernameProblemLanguageResultExecution timeMemory
1187651travelerMultiplication (BOI24_multiplication)C++20
100 / 100
1 ms328 KiB
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define int long long
#define itn int
#define no cout << "NO" << endl;
#define yes cout << "YES" << endl;
#define all(v) v.begin(), v.end()
#define For(i, n) for(int i=0;i<n;i++)
#define vi vector<int>
#define vii vector<vector<int>>
#define vpi vector<pair<int, int>>
#define pii pair<int, int>
#define ci cin >>
#define pu push
#define pb push_back
#define fi first
#define sec second
#define lowbit(x) (x&(-x)) // 8 = 8 | 20=4
#define INF INT_MAX
#define in insert
using namespace std;
using namespace __gnu_pbds;
template <typename T>
using o_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
const int MAXN = 2e5+1;
const int MOD = 1e9+7;
int n, k, x,y=0, x2, y2,  arr[MAXN], fact[MAXN], inv[MAXN], phi[MAXN];
int binpow(int a, int b, int mod = MOD){
    int res=1;
    a%=mod;
    while(b>0){
        if(b&1)res=(res*a)%mod;
        a=(a*a)%mod;
        b>>=1;
    }
    return res;
}
int inverse(int a, int mod=MOD){
    return binpow(a, mod-2, mod);
}
const int MAXSUM = 100000000;
vector<bool> primes;
void sieve(){
    primes.assign(MAXSUM+1,true);
    primes[0]=false;
    primes[1]=false;
    for(int i=2;i*i<=MAXSUM;i++){
        if(primes[i]){
            for(int j=i*i;j<=MAXSUM;j+=i){
                primes[j]=false;
            }
        }
    }
}
void pre(){
    fact[0]=1;
    for(itn i=1;i<MAXN;i++){
        fact[i]=(fact[i-1]*i)%MOD;
    }
    inv[MAXN]=binpow(fact[MAXN], MOD-2, MOD);
    for(int i=MAXN-1;i>=0;i--){
        inv[i]=(inv[i+1]*(i+1))%MOD;
    }
}
int C(int n, int k){
    return ((fact[n]*inv[k])%MOD*inv[n-k])%MOD;
}
void ph(){
    for(int i=1;i<MAXN;i++)phi[i]=i;
    for(int i=2;i<MAXN;i++){
        if(phi[i]==i){
            for(int j=i;j<MAXN;j+=i)phi[j]-=phi[j]/i;
        }
    }
}
void solve(){
    cin>>n;
    int ans=1;
    while(n--){
        cin>>x;
        x%=MOD;
        ans=(ans*x)%MOD;
    }
    cout<<ans%MOD<<endl;
}
signed main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
	// sieve();
    // freopen("snowboots.in", "r", stdin);
    // freopen("snowboots.out", "w", stdout);
    int t=1;
    // cin>>t;
    while (t--){
        solve();
    }
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...