QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#800269#9619. 乘积,欧拉函数,求和DarwinA66Compile Error//C++203.1kb2024-12-06 04:15:192024-12-06 04:15:20

Judging History

你现在查看的是最新测评结果

  • [2024-12-06 04:15:20]
  • 评测
  • [2024-12-06 04:15:19]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=3010;
ll mod=998244353;
ll n;
ll pri[]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59};
ll a[N],s[N],v[N];
ll id[N];
ll st[1<<16];
ll dp[1<<16];
ll add_dp[1<<16];
ll tp[1<<16];
ll add_tp[1<<16];
bool cmp(ll x,ll y)
{
    return v[x]<v[y];
}
ll fastpow(ll x,ll p)
{
    ll base=x;
    ll res=1ll;
    while(p)
    {
        if(p&1ll)res=(res*base)%mod;
        base=(base*base)%mod;
        p>>=1ll;
    }
    return res;
}
ll mod_inverse(ll x)
{
    ll res=fastpow(x,mod-2ll);
    return res;
}
signed main()
{
    scanf("%lld",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%lld",&a[i]);
        id[i]=i*1ll;
        ll temp=a[i];
        ll max_p=0ll;
        for(int j=0;j<16;j++)
        {
            while(temp%pri[j]==0)
            {
                temp/=pri[j];
                s[i]|=1ll<<j;
                max_p=pri[j]*1ll;
            }
        }
        if(temp>53)v[i]=temp;
        else v[i]=max_p;
    }
    sort(id+1,id+1+n);
    for(ll mask=0;mask<(1ll<<16);mask++)
    {
        ll temp=1ll;
        for(int j=0;j<16;j++)
        {
            if(mask&(1ll<<j))
            {
                temp=(temp*(pri[j]-1ll))%mod;
                temp=(temp*mod_inverse(pri[j]))%mod;
            }
        }
        st[mask]=temp;
        dp[mask]=0ll;
        tp[mask]=0ll;
    }
    dp[0]=1ll;
    for(int i=1;i<=n;i++)
    {
        
        for(ll mask=0;mask<(1ll<<16);mask++)
        {
            add_dp[mask]=0ll;
            add_tp[mask]=0ll;
        }
        if(v[id[i]]<=53)
        {
            for(ll mask=0;mask<(1ll<<16);mask++)
            {
                if(dp[mask]>=1ll)
                {
                    add_dp[mask|s[id[i]]]=(add_dp[mask|s[id[i]]]+((dp[mask]*a[id[i]]*1ll)%mod))%mod;
                }
            }
            for(ll mask=0;mask<(1ll<<16);mask++)
            {
                dp[mask]=(dp[mask]+add_dp[mask])%mod;
            }
        }
        else
        {
           
            for(ll mask=0;mask<(1ll<<16);mask++)
            {
                if(dp[mask]>=1ll)
                {
                    ll num=(dp[mask]*a[id[i]])%mod;
                    num=(((num*(v[id[i]]-1ll))%mod)*(mod_inverse(v[id[i]]))%mod)%mod;
                    add_dp[mask|s[id[i]]]=(add_dp[mask|s[id[i]]]+num*1ll)%mod;
                }
                if(tp[mask]>=1ll)
                {
                    add_tp[mask|s[id[i]]]=(add_tp[mask|s[id[i]]]+((tp[mask]*a[id[i]])%mod))%mod;
                }
            }
            for(ll mask=0;mask<(1ll<<16);mask++)
            {
                tp[mask]=(((tp[mask]+add_dp[mask])%mod)+add_tp[mask])%mod;
                if(i==n||v[id[i+1]]!=v[id[i]]){
					dp[mask]=(dp[mask]+tp[mask])%mod;
											   tp[mask]=0ll;}
            }
        }
    }
    ll ans=0ll;
    for(ll mask=0;mask<(1ll<<16);mask++)
    {
        ans=(ans+(dp[mask]*st[mask])%mod)%mod;
    }
    printf("%lld\n",ans);
    return 0;
}
/*
20
1 1 11 121 255 289 1888 885 788 1145 2242 2714 2211 2948 2803 2927 764 661 1858 1949
372472595
*/

Details

answer.code:5:1: error: ‘ll’ does not name a type
    5 | ll mod=998244353;
      | ^~
answer.code:6:1: error: ‘ll’ does not name a type
    6 | ll n;
      | ^~
answer.code:7:1: error: ‘ll’ does not name a type
    7 | ll pri[]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59};
      | ^~
answer.code:8:1: error: ‘ll’ does not name a type
    8 | ll a[N],s[N],v[N];
      | ^~
answer.code:9:1: error: ‘ll’ does not name a type
    9 | ll id[N];
      | ^~
answer.code:10:1: error: ‘ll’ does not name a type
   10 | ll st[1<<16];
      | ^~
answer.code:11:1: error: ‘ll’ does not name a type
   11 | ll dp[1<<16];
      | ^~
answer.code:12:1: error: ‘ll’ does not name a type
   12 | ll add_dp[1<<16];
      | ^~
answer.code:13:1: error: ‘ll’ does not name a type
   13 | ll tp[1<<16];
      | ^~
answer.code:14:1: error: ‘ll’ does not name a type
   14 | ll add_tp[1<<16];
      | ^~
answer.code:15:10: error: ‘ll’ was not declared in this scope
   15 | bool cmp(ll x,ll y)
      |          ^~
answer.code:15:15: error: ‘ll’ was not declared in this scope
   15 | bool cmp(ll x,ll y)
      |               ^~
answer.code:15:19: error: expression list treated as compound expression in initializer [-fpermissive]
   15 | bool cmp(ll x,ll y)
      |                   ^
answer.code:19:1: error: ‘ll’ does not name a type
   19 | ll fastpow(ll x,ll p)
      | ^~
answer.code:31:1: error: ‘ll’ does not name a type
   31 | ll mod_inverse(ll x)
      | ^~
answer.code: In function ‘int main()’:
answer.code:38:19: error: ‘n’ was not declared in this scope
   38 |     scanf("%lld",&n);
      |                   ^
answer.code:41:23: error: ‘a’ was not declared in this scope
   41 |         scanf("%lld",&a[i]);
      |                       ^
answer.code:42:9: error: ‘id’ was not declared in this scope; did you mean ‘i’?
   42 |         id[i]=i*1ll;
      |         ^~
      |         i
answer.code:43:9: error: ‘ll’ was not declared in this scope
   43 |         ll temp=a[i];
      |         ^~
answer.code:44:11: error: expected ‘;’ before ‘max_p’
   44 |         ll max_p=0ll;
      |           ^~~~~~
      |           ;
answer.code:47:19: error: ‘temp’ was not declared in this scope; did you mean ‘tm’?
   47 |             while(temp%pri[j]==0)
      |                   ^~~~
      |                   tm
answer.code:47:24: error: ‘pri’ was not declared in this scope
   47 |             while(temp%pri[j]==0)
      |                        ^~~
answer.code:50:17: error: ‘s’ was not declared in this scope
   50 |                 s[i]|=1ll<<j;
      |                 ^
answer.code:51:17: error: ‘max_p’ was not declared in this scope
   51 |                 max_p=pri[j]*1ll;
      |                 ^~~~~
answer.code:54:12: error: ‘temp’ was not declared in this scope; did you mean ‘tm’?
   54 |         if(temp>53)v[i]=temp;
      |            ^~~~
      |            tm
answer.code:54:20: error: ‘v’ was not declared in this scope
   54 |         if(temp>53)v[i]=temp;
      |                    ^
answer.code:55:14: error: ‘v’ was not declared in this scope
   55 |         else v[i]=max_p;
      |              ^
answer.code:55:19: error: ‘max_p’ was not declared in this scope
   55 |         else v[i]=max_p;
      |                   ^~~~~
answer.code:57:10: error: ‘id’ was not declared in this scope
   57 |     sort(id+1,id+1+n);
      |          ^~
answer.code:58:9: error: ‘ll’ was not declared in this scope
   58 |     for(ll mask=0;mask<(1ll<<16);mask++)
      |         ^~
answer.code:58:19: error: ‘mask’ was not declared in this scope; did you mean ‘std::filesystem::perms::mask’?
   58 |     for(ll mask=0;mask<(1ll<<16);mask++)
      |                   ^~~~
      |                   std::filesystem::perms::mask
In file included from /usr/include/c++/13/filesystem:48,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:200,
                 from answer.code:1:
/usr/include/c++/13/bits/fs_fwd.h:158:7: note: ‘std::filesystem::perms::mask’ declared here
  158 |       mask              = 07777,
      |       ^~~~
answer.code:60:11: error: expected ‘;’ before ‘temp’
   60 |         ll temp=1ll;
      |           ^~~~~
      |           ;
answer.code:65:17: error: ‘temp’ was not declared in this scope; did you mean ‘tm’?
   65 |                 temp=(temp*(pri[j]-1ll))%mod;
      |                 ^~~~
      |                 tm
answer.code:65:29: error: ‘pri’ was not declared in this scope
   65 |                 temp=(temp*(pri[j]-1ll))%mod;
      |                             ^~~
answer.code:65:42: error: ‘mod’ was not declared in this scope; did you mean ‘modf’?
   65 |                 temp=(temp*(pri[j]-1ll))%mod;
      |                                          ^~~
      |                                          modf
answer.code:66:28: error: ‘mod_inverse’ was not declared in this scope
   66 |                 temp=(temp*mod_inverse(pri[j]))%mod;
      |                            ^~~~~~~~~~~
answer.code:69:9: error: ‘st’ w...