/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Accepted 2ms 532.0 KiB
#3 Accepted 6ms 764.0 KiB
#4 Accepted 5ms 532.0 KiB
#5 Accepted 5ms 532.0 KiB
#6 Accepted 5ms 532.0 KiB
#7 Accepted 4ms 532.0 KiB

Code

#include<bits/stdc++.h>
using namespace std;
#define int             long long
#define pb              push_back
#define endl            '\n'
#define ff              first
#define ss              second
#define debug           cout<<"HERE"<<endl;
void edm()
{
    ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("outputtt.txt","w",stdout);
    #endif
}
map<int,int>mp;
int n;
int arr[15];
const int mod = 1e9+7;
void idk(int ind,int g,int koyta)
{
    if(ind==n)
    {
        mp[koyta] += g;
        return;
    }
    int gg = __gcd(g,arr[ind]);
    idk(ind+1,gg,koyta+1);
    idk(ind+1,g,koyta);
}
void solve()
{
    cin>>n;
    for(int i=0;i<n;i++)cin>>arr[i];
    idk(0,0,0);
    int ans=1;
    for(auto i:mp)
    {
        if(i.ss)
        {
            ans = ans * i.ss;
            ans = ans % mod;
        }
        // cout<<i.ff<<" "<<i.ss<<endl;
    }
    cout<<ans<<endl;
    mp.clear();
}
int32_t main()
{
    //edm();
    int t = 1;
    cin>>t;
    for(int i=1;i<=t;i++)
    {
        solve();
    }
}

Information

Submit By
Type
Submission
Problem
P1105 Ohh that gcd again
Contest
LUCC Presents Intra LU Junior Programming Contest - Replay
Language
C++17 (G++ 13.2.0)
Submit At
2025-09-02 16:28:41
Judged At
2025-09-02 16:28:41
Judged By
Score
100
Total Time
6ms
Peak Memory
764.0 KiB