Submission #1121813

#TimeUsernameProblemLanguageResultExecution timeMemory
1121813vjudge1Calvinball championship (CEOI15_teams)C++17
0 / 100
3 ms592 KiB
/*
#ifndef ONLINE_JUDGE
#include "AkbarKING.h" // aska geldi akbarking.h
#else
#define debug(...)
#define debugArr(...)
#define debugG(...)
#endif
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/hash_policy.hpp>

#define int long long
#define $AzH_TxdmN$ ios_base::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")

#define ep emplace_back
#define pb push_back
#define pii pair<int,int>
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()

using namespace std;
using namespace __gnu_pbds;

template <typename T>
using __indexed_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T>
using __indexed_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;

const int sz = 3e5+9;
const int LOG = 63;
const int MOD = 1e9+7;
const int INF = 1e18;
int a[sz],dp[sz],sdp[sz];

int n;

void solve()
{
    cin>>n;
    int pw = 1;
    auto dec = [&](int x)
    {
        for (int i = 1; i*i <= x; ++i)
        {
            if (x%i == 0)
            {
                dp[i] = (dp[i]+dp[x/i]*sdp[i])%MOD;
                if (i != x/i)
                {
                    dp[x/i] = (dp[x/i]+dp[i]*sdp[i])%MOD;
                }
            }
        }
        for (int i = 1; i <= x; ++i)
        {
            if (!sdp[i])
            {
                dp[i] += (sdp[i]>>1);
            }
        }
    };
    dp[1] = 1;
    for (int i = 1; i <= n; ++i)
    {
        cin>>a[i];
        ++sdp[a[i]];
    }
    for (int i = 1; i <= n; ++i)
    {
        dec(a[i]);
    }
    cout<<dp[1]<<'\n';
}

signed main()
{
    $AzH_TxdmN$
    int t = 1;
    //cin>>t;
    while (t--)
    {
        solve();
    }
}

Compilation message (stderr)

teams.cpp: In function 'void solve()':
teams.cpp:47:9: warning: unused variable 'pw' [-Wunused-variable]
   47 |     int pw = 1;
      |         ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...